From a714ed5faceb0fd28bbcdcb8f2b4ab259b166df8 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 27 Sep 2016 22:16:53 -0400 Subject: [PATCH] CRM-19417 - distmaker - Change report to JSON --- distmaker/dists/common.sh | 19 ------------------- distmaker/dists/repo-report.sh | 23 +++++++++++++---------- distmaker/utils/repo-report.php | 24 ++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 29 deletions(-) create mode 100644 distmaker/utils/repo-report.php diff --git a/distmaker/dists/common.sh b/distmaker/dists/common.sh index 980bea5062..b3096060ce 100644 --- a/distmaker/dists/common.sh +++ b/distmaker/dists/common.sh @@ -239,22 +239,3 @@ function dm_git_checkout() { git checkout "$2" popd } - -function dm_key_value() { - echo -e "$1\n$2" | php -r '$lines = explode("\n", rtrim(file_get_contents("php://stdin"), "\r\n"), 2); fputcsv(STDOUT, $lines);' -} - -## usage: dm_repo_report -function dm_repo_report() { - local COMMIT - if [ -d "$2" ]; then - pushd "$2" >> /dev/null - COMMIT=$(git show "$3" | head -n1 | cut -f2 -d\ ) - popd >> /dev/null - fi - [ -z "$COMMIT" ] && COMMIT=NONE - - #echo -e "$1\n$3\n$COMMIT" | php -r '$lines = explode("\n", rtrim(file_get_contents("php://stdin"), "\r\n")); fputcsv(STDOUT, $lines);' - dm_key_value "${1}.branch" $3 - dm_key_value "${1}.commit" $COMMIT -} diff --git a/distmaker/dists/repo-report.sh b/distmaker/dists/repo-report.sh index 2bbb705f5d..1b61f66ba1 100755 --- a/distmaker/dists/repo-report.sh +++ b/distmaker/dists/repo-report.sh @@ -12,14 +12,17 @@ fi . "$P/common.sh" SRC=$DM_SOURCEDIR -REPORT="$DM_TARGETDIR/civicrm-$DM_VERSION-repos.txt" +REPORT="$DM_TARGETDIR/civicrm-$DM_VERSION-repos.json" + +env \ + DM_VERSION="$DM_VERSION" \ + DM_SOURCEDIR="$DM_SOURCEDIR" \ + DM_REF_CORE="$DM_REF_CORE" \ + DM_REF_BACKDROP="$DM_REF_BACKDROP" \ + DM_REF_DRUPAL6="$DM_REF_DRUPAL6" \ + DM_REF_DRUPAL="$DM_REF_DRUPAL" \ + DM_REF_JOOMLA="$DM_REF_JOOMLA" \ + DM_REF_WORDPRESS="$DM_REF_WORDPRESS" \ + DM_REF_PACKAGES="$DM_REF_PACKAGES" \ + php "$DM_SOURCEDIR/distmaker/utils/repo-report.php" > "$REPORT" -dm_key_value version "$DM_VERSION" > $REPORT -dm_repo_report "civicrm-core" "$DM_SOURCEDIR" "$DM_REF_CORE" >> $REPORT -dm_repo_report "civicrm-backdrop@1.x" "$DM_SOURCEDIR/backdrop" "$DM_REF_BACKDROP" >> $REPORT -dm_repo_report "civicrm-drupal@6.x" "$DM_SOURCEDIR/drupal" "$DM_REF_DRUPAL6" >> $REPORT -dm_repo_report "civicrm-drupal@7.x" "$DM_SOURCEDIR/drupal" "$DM_REF_DRUPAL" >> $REPORT -#dm_repo_report "civicrm-drupal@8.x" "$DM_SOURCEDIR/drupal" "$DM_REF_DRUPAL8" >> $REPORT -dm_repo_report "civicrm-joomla" "$DM_SOURCEDIR/joomla" "$DM_REF_JOOMLA" >> $REPORT -dm_repo_report "civicrm-wordpress" "$DM_SOURCEDIR/WordPress" "$DM_REF_WORDPRESS" >> $REPORT -dm_repo_report "civicrm-packages" "$DM_SOURCEDIR/packages" "$DM_REF_PACKAGES" >> $REPORT diff --git a/distmaker/utils/repo-report.php b/distmaker/utils/repo-report.php new file mode 100644 index 0000000000..79fe891693 --- /dev/null +++ b/distmaker/utils/repo-report.php @@ -0,0 +1,24 @@ + $branch, + 'commit' => `cd $escPath ; git show $escBranch | head -n1 | cut -f2 -d\ `, + ); +} + +$DM_SOURCEDIR = getenv('DM_SOURCEDIR'); +$data = array( + 'version' => getenv('DM_VERSION'), + 'timestamp' => array( + 'pretty' => date('r'), + 'epoch' => time(), + ), + 'civicrm-core' => repo("$DM_SOURCEDIR", getenv('DM_REF_CORE')), + 'civicrm-packages' => repo("$DM_SOURCEDIR/packages", getenv('DM_REF_PACKAGES')), +); +ksort($data); +$data['sig'] = md5(json_encode($data)); +echo json_encode($data); -- 2.25.1