Merge pull request #24022 from colemanw/afformFrontend
[civicrm-core.git] / distmaker / utils / repo-report.php
1 <?php
2
3 /**
4 * Make a small report about the git content in a given folder+branch.
5 * @param string $path
6 * @param string $branch
7 * @return array
8 * - branch: string
9 * - commit: string
10 */
11 function repo($path, $branch) {
12 $escPath = escapeshellarg($path);
13 $escBranch = escapeshellarg($branch);
14 $commit = file_exists($path) ? trim(`cd $escPath ; git show $escBranch | head -n1 | cut -f2 -d\ `) : NULL;
15 if (!empty($commit)) {
16 return array(
17 'branch' => $branch,
18 'commit' => $commit,
19 );
20 }
21 else {
22 return array();
23 }
24 }
25
26 $DM_SOURCEDIR = getenv('DM_SOURCEDIR');
27 $DM_VERSION = getenv('DM_VERSION');
28 $data = array(
29 'version' => $DM_VERSION,
30 'timestamp' => array(
31 'pretty' => date('r'),
32 'epoch' => time(),
33 ),
34 'tar' => array(),
35 'git' => array(
36 'civicrm-backdrop@1.x' => repo("$DM_SOURCEDIR/backdrop", getenv('DM_REF_BACKDROP')),
37 'civicrm-core' => repo("$DM_SOURCEDIR", getenv('DM_REF_CORE')),
38 'civicrm-drupal@7.x' => repo("$DM_SOURCEDIR/drupal", getenv('DM_REF_DRUPAL')),
39 'civicrm-drupal-8' => repo("$DM_SOURCEDIR/drupal-8", getenv('DM_REF_DRUPAL8')),
40 'civicrm-joomla' => repo("$DM_SOURCEDIR/joomla", getenv('DM_REF_JOOMLA')),
41 'civicrm-packages' => repo("$DM_SOURCEDIR/packages", getenv('DM_REF_PACKAGES')),
42 'civicrm-wordpress' => repo("$DM_SOURCEDIR/WordPress", getenv('DM_REF_WORDPRESS')),
43 ),
44 );
45
46 if (getenv('BPACK')) {
47 $data['tar']['Backdrop'] = "civicrm-$DM_VERSION-backdrop-unstable.tar.gz";
48 }
49 if (getenv('J5PACK')) {
50 $data['tar']['Joomla'] = "civicrm-$DM_VERSION-joomla.zip";
51 }
52 if (getenv('D5PACK')) {
53 $data['tar']['Drupal'] = "civicrm-$DM_VERSION-drupal.tar.gz";
54 }
55 if (getenv('WPPACK')) {
56 $data['tar']['WordPress'] = "civicrm-$DM_VERSION-wordpress.zip";
57 }
58 if (getenv('L10NPACK')) {
59 $data['tar']['L10n'] = "civicrm-$DM_VERSION-l10n.tar.gz";
60 }
61
62 ksort($data);
63 ksort($data['tar']);
64 ksort($data['git']);
65 $data['rev'] = $DM_VERSION . '-' . md5(json_encode($data));
66 echo json_encode($data);