From: <jbo...@li...> - 2005-10-07 19:52:02
|
Author: dam...@jb... Date: 2005-10-07 15:51:59 -0400 (Fri, 07 Oct 2005) New Revision: 1330 Added: scripts/ scripts/doWork.sh scripts/releaseServicePack.sh scripts/startPatch.sh scripts/startServicePack.sh Log: Added a scripts dir and some scripts to demo the use of service packs and automatically generating those service packs from a list of tasks branches. Added: scripts/doWork.sh =================================================================== --- scripts/doWork.sh 2005-10-07 19:48:57 UTC (rev 1329) +++ scripts/doWork.sh 2005-10-07 19:51:59 UTC (rev 1330) @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Here's a script.. to walk you through.. how things would +# work if we did service packs using Subversion. +# +# First, we start a new service pack code line... +# This thing would live over weeks or months: +./startServicePack.sh jboss-4.0.3 https://svn.labs.jboss.com/trunk/jems/jboss-4.0 sp0 +# +# Now, to do work on individual tasks: +./startPatch.sh jboss-4.0.3 sp0 JBAS-5432 +# After the above, the developer would go work on +# their fix. They commmit to the code line URL +# that is recommended by the output of the +# startPatch.sh script. +# +# And more work: +./startPatch.sh jboss-4.0.3 sp0 JBAS-5434 +# And more work: +./startPatch.sh jboss-4.0.3 sp0 JBAS-5436 +# And more work: +./startPatch.sh jboss-4.0.3 sp0 JBAS-5439 +# +# +# Now, the release service pack script will take +# all the patches that have been created for +# the release and service pack specified, +# apply them to the base where service pack code +# line started. This is is a "last man to make the +# modification wins" policy. +./releaseServicePack.sh jboss-4.0.3 sp0 +# +# Now, after than script executes, you will have a +# branch in the repo: +# +# https://svn.labs.jboss.com/servicepacks/jems/jboss-4.0.3/sp0/release +# +# branch contains all the patches applied in order to the base +# branch where the service pack "work" started. + Property changes on: scripts/doWork.sh ___________________________________________________________________ Name: svn:executable + * Added: scripts/releaseServicePack.sh =================================================================== --- scripts/releaseServicePack.sh 2005-10-07 19:48:57 UTC (rev 1329) +++ scripts/releaseServicePack.sh 2005-10-07 19:51:59 UTC (rev 1330) @@ -0,0 +1,65 @@ +#!/bin/bash +export REPO=https://svn.labs.jboss.com +export RELEASES=releases +export BRANCHES=branches +export SERVICEPACKS=servicepacks/jems +#echo "FUTURE USAGE: ./releaseServicePack.sh release_name service_pack_name" +#echo "Example: ./releaseServicePack.sh jboss-4.0.3 sp0" +RELEASE_NAME=$1 +SP_NAME=$2 +function read_release_name { + while [ -z "$RELEASE_NAME" ] + do + echo "" + echo "What is the name of the release for which" + echo "you want to create a service pack?" + echo "" + echo "Example: jboss-4.0.3" + echo "" + echo -n "Name of release? " + read RELEASE_NAME + done + return 0; +} +function read_sp_name { + while [ -z "$SP_NAME" ] + do + echo "" + echo "What is the name of the service pack?" + echo "" + echo "Example: sp0" + echo "" + echo -n "Name of service pack? " + read SP_NAME + done + return 0; +} +# ---------------- +read_release_name +read_sp_name +echo "" +echo "" +echo "Generating Service Pack Release..." +echo " Release Name: $RELEASE_NAME" +echo " Service Pack Name: $SP_NAME" +echo " " +if svn ls $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/release > /dev/null 2>&1; then + echo "Release already exists. Remove it before running this script if that is really what you want to do."; + exit 1; +fi +echo " Creating service pack release branch: $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/release" +START_REVISION=`svn info $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/base | grep "Last Changed Rev: " | awk '{ print $4 }'` +echo " Service Pack base branch starts at revision: $START_REVISION" +svn cp $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/base $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/release -m "SERVICE PACK RELEASE BRANCH: Creating release branch for $SP_NAME." +END_REVISION=`svn info $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/release | grep "Last Changed Rev: " | awk '{ print $4 }'` +echo " Merging all service pack patches between revisions $START_REVISION and $END_REVISION..." +echo " INSERT CHECK OUT OF WORKING COPY OF $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/release AT R$END_REVISION HERE." +for x in `svn ls $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME | grep -v base | grep -v release | sed -e 's/\///'`; do + echo " Applying patch: $x" + echo " FAKE MERGE: svn merge -r $START_REVISION:$END_REVISION $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/$x ." + echo " FAKE CHECKIN: svn ci -m \"MERGED: SERVICE PACK RELEASE: -r $START_REVISION:$END_REVISION $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/$x ." +done +echo " All patches applied." +echo " Service pack release generated. You can build it by " +echo " checking out a working copy of: " +echo " $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/release" Property changes on: scripts/releaseServicePack.sh ___________________________________________________________________ Name: svn:executable + * Added: scripts/startPatch.sh =================================================================== --- scripts/startPatch.sh 2005-10-07 19:48:57 UTC (rev 1329) +++ scripts/startPatch.sh 2005-10-07 19:51:59 UTC (rev 1330) @@ -0,0 +1,65 @@ +#!/bin/bash +export REPO=https://svn.labs.jboss.com +export RELEASES=releases +export BRANCHES=branches +export SERVICEPACKS=servicepacks/jems +#echo "FUTURE USAGE: ./startPatch.sh release_name service_pack_name task_name" +#echo "Example: ./startPatch.sh jboss-4.0.3 sp0 JBAS-5432" +RELEASE_NAME=$1 +SP_NAME=$2 +TASK_NAME=$3 +function read_release_name { + while [ -z "$RELEASE_NAME" ] + do + echo "" + echo "What is the name of the release for which" + echo "you want to create a service pack?" + echo "" + echo "Example: jboss-4.0.3" + echo "" + echo -n "Name of release? " + read RELEASE_NAME + done + return 0; +} +function read_task_name { + while [ -z "$TASK_NAME" ] + do + echo "" + echo "What is the name of the JIRA task you are workign on?" + echo "" + echo "Examples: JBAS-1334" + echo " JBAS-4123" + echo "" + echo -n "JIRA Task? " + read TASK_NAME + done + return 0; +} +function read_sp_name { + while [ -z "$SP_NAME" ] + do + echo "" + echo "What is the name of the service pack?" + echo "" + echo "Example: sp0" + echo "" + echo -n "Name of service pack? " + read SP_NAME + done + return 0; +} +# ---------------- +read_release_name +read_sp_name +read_task_name +echo "" +echo "" +echo " CREATING TASK BRANCH..." +echo "Release Name: $RELEASE_NAME" +echo "Service Pack Name: $SP_NAME" +echo "JIRA Task: $TASK_NAME" +svn cp $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/base $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/$TASK_NAME -m "TASK BRANCH: Created task branch $TASK_NAME for $SP_NAME of $RELEASE_NAME." +echo "Done. You now need to change to your working copy and issue:" +echo "" +echo " svn switch $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/$TASK_NAME" Property changes on: scripts/startPatch.sh ___________________________________________________________________ Name: svn:executable + * Added: scripts/startServicePack.sh =================================================================== --- scripts/startServicePack.sh 2005-10-07 19:48:57 UTC (rev 1329) +++ scripts/startServicePack.sh 2005-10-07 19:51:59 UTC (rev 1330) @@ -0,0 +1,66 @@ +#!/bin/bash --debug +export REPO=https://svn.labs.jboss.com +export RELEASES=releases +export BRANCHES=branches +export SERVICEPACKS=servicepacks/jems +#echo "FUTURE USAGE: ./startServicePack.sh release_name src_url service_pack_name" +#echo "Example: ./startServicePack.sh jboss-4.0.0 https://svn.labs.jboss.com/releases/jboss-4.0.3 sp0" +RELEASE_NAME=$1 +SRC_URL=$2 +SP_NAME=$3 +function read_release_name { + while [ -z "$RELEASE_NAME" ] + do + echo "" + echo "What is the name of the release for which" + echo "you want to create a service pack?" + echo "" + echo "Example: jboss-4.0.3" + echo "" + echo -n "Name of release? " + read RELEASE_NAME + done + return 0; +} +function read_src_url { + while [ -z "$SRC_URL" ] + do + echo "" + echo "What is the url of the release (or branch) for which" + echo "you want to create a service pack?" + echo "" + echo "Examples: http://svn.labs.jboss.com/releases/jboss-4.0.3" + echo " http://svn.labs.jboss.com/branches/jems/adrian/jboss-4.0" + echo "" + echo -n "URL of release? " + read SRC_URL + done + return 0; +} +function read_sp_name { + while [ -z "$SP_NAME" ] + do + echo "" + echo "What is the name of the service pack?" + echo "" + echo "Example: sp0" + echo "" + echo -n "Name of service pack? " + read SP_NAME + done + return 0; +} +# ---------------- +read_release_name +read_src_url +read_sp_name +echo "" +echo "" +echo " CREATING SERVICE PACK BRANCH..." +echo "Release Name: $RELEASE_NAME" +echo "Src URL: $SRC_URL" +echo "Service Pack Name: $SP_NAME" +svn mkdir $REPO/$SERVICEPACKS/$RELEASE_NAME -m "SERVICE PACK CREATE: Creating release branch $RELEASE_NAME, under /$SERVICEPACKS to hold service packs." +svn mkdir $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME -m "SERVICE PACK CREATE: Creating service pack branch, $SP_NAME, for $RELEASE_NAME." +svn cp $SRC_URL $REPO/$SERVICEPACKS/$RELEASE_NAME/$SP_NAME/base -m "SERVICE PACK BRANCH: Created base branch for $SP_NAME of $RELEASE_NAME." +echo "Done." Property changes on: scripts/startServicePack.sh ___________________________________________________________________ Name: svn:executable + * |