distmaker - Allow running individual builds without switching branches
authortotten@civicrm.org <Tim Otten>
Sat, 21 Jun 2014 13:22:52 +0000 (06:22 -0700)
committertotten@civicrm.org <Tim Otten>
Sun, 22 Jun 2014 07:58:12 +0000 (00:58 -0700)
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
distmaker/dists/common.sh
distmaker/dists/drupal6_php5.sh
distmaker/dists/drupal_php5.sh
distmaker/dists/drupal_sk_php5.sh
distmaker/dists/joomla_php5.sh
distmaker/dists/wordpress_php5.sh

index 407152a8b45041b42f9668c4e507980eed8aab4d..6c0072eb8c42fc3d260cca502ea380467ae37cff 100755 (executable)
@@ -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
 
index 6cd98a40ed746fc7ac524c20eac3563daf25d2e8..8451f65a1637323d604408d122443bbdc8ca1f20 100644 (file)
@@ -174,3 +174,12 @@ function civicrmVersion( ) {
 }
 " > "$to"
 }
+
+## Perform a hard checkout on a given report
+## usage: dm_git_checkout <repo_path> <tree-ish>
+function dm_git_checkout() {
+  pushd "$1"
+    git checkout .
+    git checkout "$2"
+  popd
+}
index d961acdd35ee2274fb15668e36ec7d7a495e9035..feb201e2446700c7ae94f9caa3f7b7ab7631338d 100755 (executable)
@@ -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
index 2eec1ec10c12bb6d549738a6730a8518930e11ca..581eae32063be0f08e94d4c051e2859a39eeed31 100755 (executable)
@@ -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
index 80b98dcdd6a059204dd26bd590197c67a4f91f12..592cf9af975caa674e2ff1624d0be03ad62a4ab4 100755 (executable)
@@ -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
index 05865ddd7cbcf591f64814af3610d1297456ce4a..6519cbe3074cdcfebbb5bb974d49177e03c51e05 100755 (executable)
@@ -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
index 373d88d2d9677002cd3d4b56ad7d8cf60fce98d3..df71cbb3b737861f0f4efa52c179d3a1530ce9f8 100644 (file)
@@ -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