tools/scripts/releaser - Pass --branch and --skip-gencode
[civicrm-core.git] / tools / scripts / releaser / releaser
index 09eaacd6e653cbbbe4ba98614d01ba38c9c075c0..17bc700fb2bca8958f6de06b9461034e49236018 100755 (executable)
@@ -19,8 +19,9 @@ if [ -z "$start_point" -o -z "$version" -o -z "$first_act" ]; then
   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 --clean [[ORDER SIGNIFICANT]]"
+  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"
@@ -56,7 +57,7 @@ function do_mk_project() {
     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
 }
 
 #################################################
@@ -116,6 +117,12 @@ function do_distmaker() {
   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
@@ -157,6 +164,45 @@ function do_publish() {
   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() {
@@ -187,6 +233,10 @@ for ACT in "$@" ; do
       do_publish
       set +x
       ;;
+    --update)
+      set +x
+      do_update
+      ;;
     --clean)
       set -ex
       do_cleanup