Merge pull request #10098 from agh1/4.7.18-release-notes
[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 } else {
21 return array();
22 }
23 }
24
25 $DM_SOURCEDIR = getenv('DM_SOURCEDIR');
26 $DM_VERSION = getenv('DM_VERSION');
27 $data = array(
28 'version' => $DM_VERSION,
29 'timestamp' => array(
30 'pretty' => date('r'),
31 'epoch' => time(),
32 ),
33 'tar' => array(),
34 'git' => array(
35 'civicrm-backdrop@1.x' => repo("$DM_SOURCEDIR/backdrop", getenv('DM_REF_BACKDROP')),
36 'civicrm-core' => repo("$DM_SOURCEDIR", getenv('DM_REF_CORE')),
37 'civicrm-drupal@6.x' => repo("$DM_SOURCEDIR/drupal", getenv('DM_REF_DRUPAL6')),
38 'civicrm-drupal@7.x' => repo("$DM_SOURCEDIR/drupal", getenv('DM_REF_DRUPAL')),
39 //'civicrm-drupal@8.x' => repo("$DM_SOURCEDIR/drupal", getenv('DM_REF_DRUPAL8')),
40 'civicrm-packages' => repo("$DM_SOURCEDIR/packages", getenv('DM_REF_PACKAGES')),
41 'civicrm-wordpress' => repo("$DM_SOURCEDIR/WordPress", getenv('DM_REF_WORDPRESS')),
42 ),
43 );
44
45 if (getenv('BPACK')) {
46 $data['tar']['Backdrop'] = "civicrm-$DM_VERSION-backdrop-unstable.tar.gz";
47 }
48 if (getenv('J5PACK')) {
49 $data['tar']['Joomla'] = "civicrm-$DM_VERSION-joomla.zip";
50 }
51 if (getenv('D56PACK')) {
52 $data['tar']['Drupal6'] = "civicrm-$DM_VERSION-drupal6.tar.gz";
53 }
54 if (getenv('D5PACK')) {
55 $data['tar']['Drupal'] = "civicrm-$DM_VERSION-drupal.tar.gz";
56 }
57 if (getenv('WPPACK')) {
58 $data['tar']['WordPress'] = "civicrm-$DM_VERSION-wordpress.zip";
59 }
60 if (getenv('L10NPACK')) {
61 $data['tar']['L10n'] = "civicrm-$DM_VERSION-l10n.tar.gz";
62 }
63
64 ksort($data);
65 ksort($data['tar']);
66 ksort($data['git']);
67 $data['rev'] = $DM_VERSION . '-' . md5(json_encode($data));
68 echo json_encode($data);