You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2015/03/19 23:58:07 UTC

svn commit: r8348 - /dev/jclouds/prepare_release.sh

Author: nacx
Date: Thu Mar 19 22:58:07 2015
New Revision: 8348

Log:
Improved the release preparation script

Modified:
    dev/jclouds/prepare_release.sh

Modified: dev/jclouds/prepare_release.sh
==============================================================================
--- dev/jclouds/prepare_release.sh (original)
+++ dev/jclouds/prepare_release.sh Thu Mar 19 22:58:07 2015
@@ -27,22 +27,30 @@ for REPO in ${REPOS[@]}; do
         echo "${REPO} repo not found. Are you in the wrong directory?"
         exit 1
     fi
+    cd ${REPO}
+    ASF_REMOTE=`git remote -v | grep "repos/asf/${REPO}.git"`
+    if [[ "${ASF_REMOTE}" == "" ]]; then
+        echo "Could not find the ASF remote repo in ${REPO}"
+        exit 1
+    fi
+    cd ..
 done
 
 function current_branch {
-    cd jclouds
+    cd ${1}
     echo `git rev-parse --abbrev-ref HEAD`
     cd ..
 }
 
 function current_snapshot {
-    echo `grep SNAPSHOT jclouds/pom.xml | head -n 1 | cut -d'>' -f2 | cut -d'<' -f1`
+    echo `grep SNAPSHOT ${1}/pom.xml | head -n 1 | cut -d'>' -f2 | cut -d'<' -f1`
 }
 
 function rc_version {
-    cd jclouds
-    git fetch origin --tags
-    LAST_RC=`git tag | grep jclouds-${RELEASE}-rc | sort -r | head -n 1`
+    cd ${1}
+    ASF_REMOTE=`git remote -v | grep "repos/asf/${1}.git" | head -n 1 | awk '{print $1}'`
+    git fetch ${ASF_REMOTE} --tags
+    LAST_RC=`git tag | grep ${1}-${RELEASE}-rc | sort -r | head -n 1`
     if [[ "${LAST_RC}" == "" ]]; then
         echo "rc1"
     else
@@ -58,15 +66,9 @@ function join {
     echo "$*"
 }
 
-function update_versions {
-    find . -name pom.xml -exec sed -i -e "s/${1}/${2}/g" {} \;
-    find . -name pom.xml -exec sed -i -e "s/<tag>${3}<\/tag>/<tag>${4}<\/tag>/g" {} \;
-    find . -name pom.xml-e -delete
-}
-
-BRANCH=$(current_branch)
-CURRENT=$(current_snapshot)
-RC=$(rc_version)
+BRANCH=$(current_branch jclouds)
+CURRENT=$(current_snapshot jclouds)
+RC=$(rc_version jclouds)
 
 cat << EOF
 The release process will start with the following properties:
@@ -79,7 +81,9 @@ The release process will start with the
 EOF
 
 read -p "Do you want to continue? (y|n) "
-[[ ${REPLY} =~ ^[y]$ ]] || exit 0
+[[ ${REPLY} == "y" ]] || exit 0
+
+echo -e "\nGo grab a beer. This will take a while! :-)\n"
 
 for REPO in ${REPOS[@]}; do
     TAG=${REPO}-${RELEASE}-${RC}
@@ -89,7 +93,10 @@ for REPO in ${REPOS[@]}; do
     # Update to the release version, verify the build and tag
     # We don't release if there are SNAPSHOT dependencies, so we can assume that
     # this will only match the current SNAPSHOT versions
-    update_versions ${CURRENT} ${RELEASE} "HEAD" ${TAG}
+    find . -name pom.xml -exec sed -i -e "s/${CURRENT}/${RELEASE}/g" {} \;
+    find . -name pom.xml -exec sed -i -e "s/<tag>HEAD<\/tag>/<tag>${TAG}<\/tag>/g" {} \;
+    find . -name pom.xml-e -delete
+    
     mvn clean install
     git add .
     git commit -m "Apache jclouds ${RELEASE} release"
@@ -105,6 +112,7 @@ for REPO in ${REPOS[@]}; do
     sed -e "s/${CURRENT}/${NEXT}/g" /tmp/${REPO}-${RELEASE}.diff >/tmp/${REPO}-${NEXT}.diff
     git checkout ${BRANCH}
     git apply /tmp/${REPO}-${NEXT}.diff
+    
     mvn clean install
     git add .
     git commit -m "Next development version ${NEXT}"