From: totten@civicrm.org Date: Sat, 21 Jun 2014 13:22:52 +0000 (-0700) Subject: distmaker - Allow running individual builds without switching branches X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=445009ec51fddf0a5aa056c3dd93414029173bb9;p=civicrm-core.git 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 --- 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