confdir=$(dirname $0)
start_point="$1"
version="$2"
+first_act="$3"
+distmaker_tgt=all
if [ ! -f "$confdir/releaser.conf" ]; then
echo
fi
source "$confdir/releaser.conf"
-if [ -z "$version" -o -z "$start_point" ]; then
+if [ -z "$start_point" -o -z "$version" -o -z "$first_act" ]; then
echo
- echo "Usage: $0 <start_point> <version>"
+ echo "Usage:"
+ echo " $0 <start_point> <version> --build"
+ echo " $0 <start_point> <version> --publish"
+ echo " $0 <start_point> <version> --update"
+ echo " $0 <start_point> <version> --clean"
+ echo " $0 <start_point> <version> --build --publish --update --clean [[ORDER SIGNIFICANT]]"
+ echo "Arguments:"
echo " <start_point> is a branch name (e.g. \"master\")"
echo " <version> is Civi release (e.g. \"4.3.beta2\"); it will become a tag name"
exit 2
is_stable=
fi
-set -ex
-
#################################################
## Git setup
function do_git_config() {
fi
done
- $cmd_gitify all "$git_base_url" "$workdir/$version/export" --l10n
+ $cmd_gitify all "$git_base_url" "$workdir/$version/export" --l10n --branch "$start_point" --skip-gencode
}
#################################################
DM_VERSION=$version
DM_REVISION=$rev
DM_ZIP=$cmd_zip
+ DM_REF_CORE=${start_point}
+ DM_REF_DRUPAL=7.x-${start_point}
+ DM_REF_DRUPAL6=6.x-${start_point}
+ DM_REF_JOOMLA=${start_point}
+ DM_REF_WORDPRESS=${start_point}
+ DM_REF_PACKAGES=${start_point}
" > $workdir/$version/export/distmaker/distmaker.conf
# create a minimal civicrm.settings.php file
# run the exported distmaker
cd $workdir/$version/export/distmaker
- ./distmaker.sh all > $workdir/$version/build.log
+ ./distmaker.sh $distmaker_tgt > $workdir/$version/build.log
}
#################################################
# publish to sf.net
cd $workdir/$version/tarballs
- $cmd_md5sum *.tar.gz *.zip > civicrm-$version.MD5SUMS
+ $cmd_md5sum *.tar.gz *.tgz *.zip > civicrm-$version.MD5SUMS
echo $gpg_pass | $cmd_gpg --armor --batch --passphrase-fd 0 --sign civicrm-$version.MD5SUMS
if [ "$is_stable" ]; then
$cmd_rsync -aP --exclude='*starterkit.tgz' *.tar.gz *.zip *MD5SUMS* ${publish_ssh}:${publish_latest_dir}/$version
fi
- mv *.tar.gz *.zip *MD5SUMS* $build_dest
+ mv *.tar.gz *.tgz *.zip *MD5SUMS* $build_dest
# publish to latest.civicrm.org
# FIXME: isn't this racy when doing concurrent security releases
echo $version > $latest/latest.txt
}
+#################################################
+## Update Version Info
+function do_update() {
+ echo "VERSION UPDATE: Enter the version that comes after $version (or enter nothing to abort)"
+ read new_ver
+ if [ -n "$new_ver" ]; then
+ cd $workdir/$version/export
+ # create sql upgrade file
+ tpl="CRM/Upgrade/Incremental/sql/$new_ver.mysql.tpl"
+ if [ ! -f $tpl ]; then
+ echo "{* file to handle db changes in $new_ver during upgrade *}" > $tpl
+ fi
+ # escape regex special chars
+ arg=`echo "$version" | sed 's:[]\[\^\$\.\*\/]:\\\\&:g'`
+ for file in xml/version.xml sql/civicrm_generated.mysql; do
+ set -ex
+ git checkout $file
+ sed "s/$arg/$new_ver/" < $file > $file.tmp
+ mv $file.tmp $file
+ set +x
+ done
+ # print the diff directly to the screen
+ git diff | cat
+ echo "Push these changes? y/n"
+ read input
+ if [ "$input" = "y" ]; then
+ set -ex
+ git add xml/version.xml sql/civicrm_generated.mysql $tpl
+ git commit -m "Update version to $new_ver"
+ git push origin "$start_point"
+ set +x
+ else
+ do_update
+ fi
+ else
+ echo "No version entered. Aborting version update."
+ fi
+}
+
#################################################
## Cleanup
function do_cleanup() {
## Refactoring note: this used to be one monolithic script
-do_git_config
-do_mk_project
-do_git_tag
-do_distmaker
-do_git_tag_push
-do_publish
-do_cleanup
+shift ## start point
+shift ## version
+for ACT in "$@" ; do
+ case "$ACT" in
+ --build)
+ set -ex
+ do_git_config
+ do_mk_project
+ do_git_tag
+ do_distmaker
+ set +x
+ ;;
+ --publish)
+ set -ex
+ do_git_tag_push
+ do_publish
+ set +x
+ ;;
+ --update)
+ set +x
+ do_update
+ ;;
+ --clean)
+ set -ex
+ do_cleanup
+ set +x
+ ;;
+ *)
+ echo "unrecognized: $ACT"
+ ;;
+ esac
+done
+