From ed5f9af59e07fe251da640be2c35589ce06553a6 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 28 Sep 2016 15:21:08 -0400 Subject: [PATCH] CRM-19417 - distmaker - Rename report file. Tweak edge-case for missing repos. --- distmaker/dists/repo-report.sh | 6 +++--- distmaker/utils/repo-report.php | 23 ++++++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/distmaker/dists/repo-report.sh b/distmaker/dists/repo-report.sh index 4a14e41f72..411ede8e33 100755 --- a/distmaker/dists/repo-report.sh +++ b/distmaker/dists/repo-report.sh @@ -12,7 +12,7 @@ fi . "$P/common.sh" SRC=$DM_SOURCEDIR -REPORT="$DM_TARGETDIR/civicrm-$DM_VERSION-repos.json" +REPORT="$DM_TARGETDIR/civicrm-$DM_VERSION.json" env \ DM_VERSION="$DM_VERSION" \ @@ -32,5 +32,5 @@ env \ SKPACK="$SKPACK" \ J5PACK="$J5PACK" \ WP5PACK="$WP5PACK" \ - php "$DM_SOURCEDIR/distmaker/utils/repo-report.php" > "$REPORT" - + php "$DM_SOURCEDIR/distmaker/utils/repo-report.php" \ + > "$REPORT" diff --git a/distmaker/utils/repo-report.php b/distmaker/utils/repo-report.php index 91b6cf93b4..8551f4cd8e 100644 --- a/distmaker/utils/repo-report.php +++ b/distmaker/utils/repo-report.php @@ -1,12 +1,25 @@ $branch, - 'commit' => `cd $escPath ; git show $escBranch | head -n1 | cut -f2 -d\ `, - ); + $commit = file_exists($path) ? trim(`cd $escPath ; git show $escBranch | head -n1 | cut -f2 -d\ `) : NULL; + if (!empty($commit)) { + return array( + 'branch' => $branch, + 'commit' => $commit, + ); + } else { + return array(); + } } $DM_SOURCEDIR = getenv('DM_SOURCEDIR'); @@ -51,5 +64,5 @@ if (getenv('L10NPACK')) { ksort($data); ksort($data['tar']); ksort($data['git']); -$data['rev'] = md5(json_encode($data)); +$data['rev'] = $DM_VERSION . '-' . md5(json_encode($data)); echo json_encode($data); -- 2.25.1