From 445009ec51fddf0a5aa056c3dd93414029173bb9 Mon Sep 17 00:00:00 2001 From: "totten@civicrm.org" Date: Sat, 21 Jun 2014 06:22:52 -0700 Subject: [PATCH] distmaker - Allow running individual builds without switching branches One of the more annoying things with distmaker is that it switches all the branches, which means that you need to commit everything before building. This is necessary for building D6 & D7 in the same script, but makes it harder to work on changes to builds. With this patch, one can directly call the "dists/*.sh" files to trigger a build, and it muck with git. All the git checkouts are now specified in the distmaker.sh --- distmaker/distmaker.sh | 19 ++++++++++--------- distmaker/dists/common.sh | 9 +++++++++ distmaker/dists/drupal6_php5.sh | 6 ------ distmaker/dists/drupal_php5.sh | 6 ------ distmaker/dists/drupal_sk_php5.sh | 5 ----- distmaker/dists/joomla_php5.sh | 5 ----- distmaker/dists/wordpress_php5.sh | 5 ----- 7 files changed, 19 insertions(+), 36 deletions(-) diff --git a/distmaker/distmaker.sh b/distmaker/distmaker.sh index 407152a8b4..6c0072eb8c 100755 --- a/distmaker/distmaker.sh +++ b/distmaker/distmaker.sh @@ -28,6 +28,7 @@ set -e P=`dirname $0` # Current dir ORIGPWD=`pwd` +source "$P/dists/common.sh" # Set no actions by default D5PACK=0 @@ -156,16 +157,11 @@ case $1 in esac ## Make sure we have the right branch or tag -pushd "$DM_SOURCEDIR" -git checkout "$DM_REF_CORE" -popd -pushd "$DM_SOURCEDIR/packages" -git checkout "$DM_REF_PACKAGES" -popd +dm_git_checkout "$DM_SOURCEDIR" "$DM_REF_CORE" +dm_git_checkout "$DM_SOURCEDIR/packages" "$DM_REF_PACKAGES" + ## in theory, this shouldn't matter, but GenCode is CMS-dependent, and we've been doing our past builds based on D7 -pushd "$DM_SOURCEDIR/drupal" -git checkout "$DM_REF_DRUPAL" -popd +dm_git_checkout "$DM_SOURCEDIR/drupal" "$DM_REF_DRUPAL" # Before anything - regenerate DAOs @@ -181,26 +177,31 @@ fi if [ "$D56PACK" = 1 ]; then echo; echo "Packaging for Drupal6, PHP5 version"; echo; + dm_git_checkout "$DM_SOURCEDIR/drupal" "$DM_REF_DRUPAL6" bash $P/dists/drupal6_php5.sh fi if [ "$D5PACK" = 1 ]; then echo; echo "Packaging for Drupal7, PHP5 version"; echo; + dm_git_checkout "$DM_SOURCEDIR/drupal" "$DM_REF_DRUPAL" bash $P/dists/drupal_php5.sh fi if [ "$SKPACK" = 1 ]; then echo; echo "Packaging for Drupal7, PHP5 StarterKit version"; echo; + dm_git_checkout "$DM_SOURCEDIR/drupal" "$DM_REF_DRUPAL" bash $P/dists/drupal_sk_php5.sh fi if [ "$J5PACK" = 1 ]; then echo; echo "Packaging for Joomla, PHP5 version"; echo; + dm_git_checkout "$DM_SOURCEDIR/joomla" "$DM_REF_JOOMLA" bash $P/dists/joomla_php5.sh fi if [ "$WP5PACK" = 1 ]; then echo; echo "Packaging for Wordpress, PHP5 version"; echo; + dm_git_checkout "$DM_SOURCEDIR/WordPress" "$DM_REF_WORDPRESS" bash $P/dists/wordpress_php5.sh fi diff --git a/distmaker/dists/common.sh b/distmaker/dists/common.sh index 6cd98a40ed..8451f65a16 100644 --- a/distmaker/dists/common.sh +++ b/distmaker/dists/common.sh @@ -174,3 +174,12 @@ function civicrmVersion( ) { } " > "$to" } + +## Perform a hard checkout on a given report +## usage: dm_git_checkout +function dm_git_checkout() { + pushd "$1" + git checkout . + git checkout "$2" + popd +} diff --git a/distmaker/dists/drupal6_php5.sh b/distmaker/dists/drupal6_php5.sh index d961acdd35..feb201e244 100755 --- a/distmaker/dists/drupal6_php5.sh +++ b/distmaker/dists/drupal6_php5.sh @@ -14,12 +14,6 @@ fi SRC=$DM_SOURCEDIR TRG=$DM_TMPDIR/civicrm -# checkout the right code revisions -pushd "$DM_SOURCEDIR/drupal" -git checkout . -git checkout "$DM_REF_DRUPAL6" -popd - # copy all the stuff dm_reset_dirs "$TRG" cp $SRC/drupal/civicrm.config.php.drupal $TRG/civicrm.config.php diff --git a/distmaker/dists/drupal_php5.sh b/distmaker/dists/drupal_php5.sh index 2eec1ec10c..581eae3206 100755 --- a/distmaker/dists/drupal_php5.sh +++ b/distmaker/dists/drupal_php5.sh @@ -14,12 +14,6 @@ fi SRC=$DM_SOURCEDIR TRG=$DM_TMPDIR/civicrm -# checkout the right code revisions -pushd "$DM_SOURCEDIR/drupal" -git checkout . -git checkout "$DM_REF_DRUPAL" -popd - # copy all the stuff dm_reset_dirs "$TRG" cp $SRC/drupal/civicrm.config.php.drupal $TRG/civicrm.config.php diff --git a/distmaker/dists/drupal_sk_php5.sh b/distmaker/dists/drupal_sk_php5.sh index 80b98dcdd6..592cf9af97 100755 --- a/distmaker/dists/drupal_sk_php5.sh +++ b/distmaker/dists/drupal_sk_php5.sh @@ -14,11 +14,6 @@ fi SRC=$DM_SOURCEDIR TRG=$DM_TMPDIR/civicrm -# checkout the right code revisions -pushd "$DM_SOURCEDIR/drupal" -git checkout "$DM_REF_DRUPAL" -popd - # copy all the stuff dm_reset_dirs "$TRG" cp $SRC/drupal/civicrm.config.php.drupal $TRG/civicrm.config.php diff --git a/distmaker/dists/joomla_php5.sh b/distmaker/dists/joomla_php5.sh index 05865ddd7c..6519cbe307 100755 --- a/distmaker/dists/joomla_php5.sh +++ b/distmaker/dists/joomla_php5.sh @@ -14,11 +14,6 @@ fi SRC=$DM_SOURCEDIR TRG=$DM_TMPDIR/civicrm -# checkout the right code revisions -pushd "$DM_SOURCEDIR/joomla" -git checkout "$DM_REF_JOOMLA" -popd - # copy all the rest of the stuff dm_reset_dirs "$TRG" "$DM_TMPDIR/com_civicrm" cp $SRC/civicrm.config.php $TRG diff --git a/distmaker/dists/wordpress_php5.sh b/distmaker/dists/wordpress_php5.sh index 373d88d2d9..df71cbb3b7 100644 --- a/distmaker/dists/wordpress_php5.sh +++ b/distmaker/dists/wordpress_php5.sh @@ -14,11 +14,6 @@ fi SRC=$DM_SOURCEDIR TRG=$DM_TMPDIR/civicrm -# checkout the right code revisions -pushd "$DM_SOURCEDIR/WordPress" -git checkout "$DM_REF_WORDPRESS" -popd - # copy all the stuff dm_reset_dirs "$TRG" "$TRG/civicrm/civicrm" cp $SRC/WordPress/civicrm.config.php.wordpress $TRG/civicrm/civicrm/civicrm.config.php -- 2.25.1