From f97bb7dd985aa4c49beeae12188965cb40cafa72 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Thu, 4 Aug 2011 16:14:15 +0200 Subject: [PATCH] Tweak release scripts --- bacula/release/README | 38 +++++++++++++++++---------- bacula/release/config | 48 ++++++++++++++++++++++++++++++++++ bacula/release/makeall | 25 +++++++++--------- bacula/release/makebacularel | 49 +++++++++++++++++++++++------------ bacula/release/makeclean | 2 -- bacula/release/makedocsrel | 45 +++++++++++++++++++------------- bacula/release/makewinrel | 50 +++++++++++++++++++++--------------- bacula/release/pushtags | 23 +++++++++++++++++ 8 files changed, 196 insertions(+), 84 deletions(-) create mode 100644 bacula/release/config delete mode 100755 bacula/release/makeclean create mode 100755 bacula/release/pushtags diff --git a/bacula/release/README b/bacula/release/README index 4b77fe6eb2..f8b804f341 100644 --- a/bacula/release/README +++ b/bacula/release/README @@ -7,33 +7,43 @@ In general, you do the following: 1. Copy the entire contents of this directory out of the Bacula source tree (this may not be required, but is cleaner). -2. Edit the makeall file, and update the following enviroment variables +2. Edit the config file, and update the following enviroment variables to point to the correct directories on your system. They should point to directories that contain git repos: bacula docs - rescu + rescue -3. Ensure that the environment variable "version" is set correctly - (yes, this could be automatically pulled from $bacula). + Also ensure that you have set repo to the name of your repository. + Normally, it is origin, but some developers (Kern) use bee. -4. Run the makeall script. There should be no errors. If +3. Ensure that "branch" is properly set to the right version in + the config file. + +4. Note, the release version is obtained from bacula/src/version.h and + put into a number of files in the release by the release scripts. + +5. Run the makeall script. + + ./makeall + +6. There should be no errors. If there are, fix them, and re-run the script or re-run the scripts that makeall calls: - makeclean - makebacularel ... - makedocsrel ... - makerescuerel ... - makewinrel ... +7. All the output files should be put in this directory. -5. All the output files should be put in this directory. - -6. Before releasing, detar the main Bacula source into some +8. Before releasing, detar the main Bacula source into some directory and run all the regression tests using the files in the bacula-xx.xx.xx.tar.gz file. This ensures that there are no missing files. -7. Also before releasing, run at least one backup using the +9. Also before releasing, run at least one backup using the Win32 and/or Win64 file daemon. + +10 When you are sure, run: + + pushtags + + which will push each repo and push the tags. diff --git a/bacula/release/config b/bacula/release/config new file mode 100644 index 0000000000..acfebe7d33 --- /dev/null +++ b/bacula/release/config @@ -0,0 +1,48 @@ +# +# Configuration for release scripts + +# +# Set to the Branch you are working on +# +branch=Branch-5.1 +# +# set reltype to release or beta -- for upload and setting DEVELOPER +reltype=beta + + +repo=$reltype + +# Bacula git repos +bacula=${bacula:-${HOME}/bee/bacula} +docs=${docs:-${HOME}/bee/docs} + +# +# Set the following to your remote name. By default it is origin. +remote=${remote:-origin} + +export push=no +# +# Note, you will probably want to set updatepo=no if you +# run this script multiple times for a given release. +export updatepo=no + +cwd=`pwd` + +cd ${bacula}/bacula +if [ $? -ne 0 ]; then + echo "Directory: $1 does not exist" + exit 1 +fi +current=`git branch | awk '/*/ { print $2 }'` +git checkout ${branch} +git pull ${remote} ${branch} +if [ $? -ne 0 ]; then + echo "Checkout of branch ${branch} failed." + exit 1 +fi +ver=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' src/version.h` +lsmdate=`sed -n -e 's/^.*LSMDATE.*"\(.*\)"$/\1/p' src/version.h` + +git checkout ${current} + +cd $cwd diff --git a/bacula/release/makeall b/bacula/release/makeall index 69ef215e27..ce60e1188e 100755 --- a/bacula/release/makeall +++ b/bacula/release/makeall @@ -2,22 +2,21 @@ # # Make full release # -# Bacula git repos -bacula=${bacula:-/home/kern/bacula/k} -docs=${docs:-/home/kern/bacula/docs} -rescue=${rescue:-/home/kern/bacula/rescue} -export push=yes -export updatepo=yes -current=$(cd $bacula ; git branch | awk '/*/ { print $2 }') -branch=${1:-$current} +# Source config +. ./config -./makeclean -./makebacularel $bacula $branch -./makedocsrel $bacula $docs $branch -./makerescuerel $rescue $branch -./makewinrel $bacula $branch | tee win$$.log +echo "Creating release version: ${ver}" +cd $cwd + +./makebacularel $bacula $remote $branch $ver +./makedocsrel $bacula $docs $remote $branch $ver +./makewinrel $bacula $remote $branch $ver | tee win$$.log + +# strip ./configure strerror from Win log file +sed -i -e 's%strerror%%' win$$.log +# check for warning and error messages grep -i warning win$$.log >/dev/null if [ $? -eq 0 ] ; then echo " " diff --git a/bacula/release/makebacularel b/bacula/release/makebacularel index 39c4334bbf..869667af8d 100755 --- a/bacula/release/makebacularel +++ b/bacula/release/makebacularel @@ -12,13 +12,20 @@ # Commit all changes, update the language files, # export the release, make a release tar. # -cwd=`pwd` -reltype=release +# source config +. ./config + tagbase=Release- +base_dir=bacula base_pkg=bacula -if [ $# != 2 ] ; then - echo "Need $0 " - echo "e.g. $0 release-source 3.0.3" + +remote=$2 +branch=$3 +ver=$4 + +if [ $# != 4 ] ; then + echo "Need $0 " + echo "e.g. $0 release-source bee Branch-4.0 4.0.3" exit 1 fi cd $1 @@ -27,25 +34,24 @@ if [ $? -ne 0 ]; then exit 1 fi src=`pwd` -cd $base_pkg +current=`git branch | awk '/*/ { print $2 }'` +cd $base_dir if [ $? -ne 0 ]; then echo "Directory: $1 does not exist" exit 1 fi -branch=$2 git checkout ${branch} -git pull origin ${branch} +git pull ${remote} ${branch} if [ $? -ne 0 ]; then echo "Checkout of branch ${branch} failed." exit 1 fi -ver=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' src/version.h` fulltag=$tagbase$ver echo " " echo "Making $reltype for $base_pkg-$ver ..." echo " " -echo "OK? ctl-c to stop" -read a +#echo "OK? ctl-c to stop" +#read a rm -rf Release-$ver if [ $reltype != "beta" ] ; then cd src @@ -59,8 +65,8 @@ if [ a$updatepo != ano ]; then cd po make update-po cd ${src} - git commit -am "Final po changes for ${fulltag}" fi + git tag -d ${fulltag} echo "Creating new tag -- $fulltag" git tag $fulltag @@ -76,6 +82,7 @@ rm -rf $base_pkg-$ver $base_pkg-$ver.tar.gz $base_pkg-$ver.tar.gz.sig rm -rf $fulltag cd ${src} git archive --format=tar --prefix=$base_pkg-$ver/ $fulltag | gzip >${cwd}/$base_pkg-$ver.tar.gz + if [ $? != 0 ] ; then echo " " echo "Non-zero return status from Git" @@ -83,23 +90,33 @@ if [ $? != 0 ] ; then exit 1 fi echo "Exported release into ${cwd}/$base_pkg-$ver.tar.gz" -git checkout master cd ${cwd} tar xfz $base_pkg-$ver.tar.gz -cd $base_pkg-$ver/ +# First remove Enterprise Win32 plugin source +cd $base_pkg-$ver/bacula +cp -fp ReleaseNotes ${cwd}/ReleaseNotes + +cd ${cwd}/$base_pkg-$ver +# Move directories to release names including version mv bacula $base_pkg-$ver mv gui $base_pkg-gui-$ver mv regress $base_pkg-regress-$ver +# Tar each component individually tar cvfz ../$base_pkg-$ver.tar.gz $base_pkg-$ver tar cvfz ../$base_pkg-gui-$ver.tar.gz $base_pkg-gui-$ver tar cvfz ../$base_pkg-regress-$ver.tar.gz $base_pkg-regress-$ver cd .. +rm -rf $base_pkg-$ver ./sign $base_pkg-$ver.tar.gz ./sign $base_pkg-gui-$ver.tar.gz ./sign $base_pkg-regress-$ver.tar.gz if [ a$push != ano ]; then cd ${src} - git push origin $branch - git push origin tag $fulltag + git push ${remote} ${branch} + git push ${remote} tag ${fulltag} + echo "Pushed ${remote} and push tag ${fulltag}" fi + +cd ${src} +git checkout ${current} diff --git a/bacula/release/makeclean b/bacula/release/makeclean deleted file mode 100755 index 9ed063381d..0000000000 --- a/bacula/release/makeclean +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -rm -rf bacula-* win32bacula* win64bacula* diff --git a/bacula/release/makedocsrel b/bacula/release/makedocsrel index 1073c1f6ef..e6281bcb24 100755 --- a/bacula/release/makedocsrel +++ b/bacula/release/makedocsrel @@ -9,15 +9,20 @@ # # Commit all changes, export the release, make a release tar. # -cwd=`pwd` -reltype=release +# source ./config +. ./config + tagbase=Release- base_dir=docs base_pkg=bacula-$base_dir -branch=$3 -if [ $# != 3 ] ; then - echo "Need $0 " - echo "e.g. $0 bacula-source docs-source master" +remote=$3 +branch=$4 +ver=$5 +fulltag=$tagbase$ver + +if [ $# != 5 ] ; then + echo "Need $0 " + echo "e.g. $0 bacula-source docs-source bee Branch-4.0 4.0.3" exit 1 fi cd $1 @@ -30,12 +35,13 @@ if [ $? -ne 0 ]; then echo "Directory: $1 does not exist" exit 1 fi +bcurrent=`git branch | awk '/*/ { print $2 }'` git checkout ${branch} if [ $? -ne 0 ]; then echo "Checkout of branch ${branch} in $1/bacula failed." exit 1 fi -git pull origin ${branch} +git pull ${remote} ${branch} bsrc=`pwd` cd ${cwd} cd $2 @@ -48,22 +54,21 @@ if [ $? -ne 0 ]; then echo "Directory: $2 does not exist" exit 1 fi +current=`git branch | awk '/*/ { print $2 }'` src=`pwd` git checkout ${branch} if [ $? -ne 0 ]; then echo "Checkout of branch ${branch} in ${src} failed." exit 1 fi -git pull origin ${branch} -ver=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' ${bsrc}/src/version.h` -fulltag=$tagbase$ver +git pull ${remote} ${branch} echo " " echo "Making $reltype for $base_pkg-$ver ..." echo " " -echo "OK? ctl-c to stop" -read a +#echo "OK? ctl-c to stop" +#read a -git tag -d ${fulltag} +git tag -d ${fulltag} 2>/dev/null 1>/dev/null echo "Creating new tag -- $fulltag" git tag $fulltag if [ $? != 0 ] ; then @@ -85,7 +90,6 @@ if [ $? != 0 ] ; then exit 1 fi echo "Exported release into ${cwd}/$base_pkg-$ver.tar.gz" -git checkout master cd ${cwd} tar xfz $base_pkg-$ver.tar.gz cd $base_pkg-$ver/ @@ -93,8 +97,6 @@ mv docs $base_pkg-$ver cd $base_pkg-$ver ./configure --with-bacula=$bsrc make en -cd ${bsrc} -git checkout master cd ${cwd} echo "Tarring docs ..." tar cf $base_pkg-$ver.tar $base_pkg-$ver @@ -106,6 +108,13 @@ ls -l $base_pkg-$ver.tar.* if [ a$push != ano ]; then cd ${src} - git push origin $branch - git push origin tag $fulltag + git push ${remote} ${branch} + git push ${remote} tag ${fulltag} + echo "Pushed ${remote} and push tag ${fulltag}" fi + +cd ${src} +git checkout ${current} + +cd ${bsrc} +git checkout ${bcurrent} diff --git a/bacula/release/makewinrel b/bacula/release/makewinrel index ad29d78d66..0beb7faabd 100755 --- a/bacula/release/makewinrel +++ b/bacula/release/makewinrel @@ -9,15 +9,19 @@ # # Commit all changes, export the release, make a release tar. # -cwd=`pwd` -reltype=release +# source ./config +. ./config + tagbase=Release- -base_pkg=windows -branch=$2 +base_pkg=bacula +remote=$2 +branch=$3 +ver=$4 +fulltag=$tagbase$ver -if [ $# != 2 ] ; then - echo "Need $0 " - echo "e.g. $0 rescue-source master" +if [ $# != 4 ] ; then + echo "Need $0 " + echo "e.g. $0 rescue-source bee Branch-4.0 4.0.3" exit 1 fi cd $1 @@ -30,32 +34,36 @@ if [ $? -ne 0 ]; then echo "Directory: $1 does not exist" exit 1 fi +current=`git branch | awk '/*/ { print $2 }'` src=`pwd` git checkout ${branch} if [ $? -ne 0 ]; then echo "Checkout of branch ${branch} in ${src} failed." exit 1 fi -git pull origin ${branch} -ver=`sed -n -e 's/^.*VERSION.*"\(.*\)"$/\1/p' src/version.h` -fulltag=$tagbase$ver +git pull ${remote} ${branch} echo " " -echo "Making $reltype for $base_pkg-$ver ..." +echo "Making $reltype for Windows $base_pkg-$ver ..." echo " " -echo "OK? ctl-c to stop" -read a +#echo "OK? ctl-c to stop" +#read a cd src/win32 -rm -f release32/win32bacula-$ver.exe -rm -f release64/win64bacula-$ver.exe +rm -f release32/${base_pkg}-win32-$ver.exe +rm -f release64/${base_pkg}-win64-$ver.exe make clean +cd ../.. +./configure --with-sqlite3 +cd src/win32 ./makeall -cp release32/win32bacula-$ver.exe ${cwd} -cp release64/win64bacula-$ver.exe ${cwd} -git checkout master +cp release32/${base_pkg}-win32-$ver.exe ${cwd} +cp release64/${base_pkg}-win64-$ver.exe ${cwd} cd ${cwd} rm -f *.exe.sig -./sign win32bacula-$ver.exe -./sign win64bacula-$ver.exe -ls -l win*.exe* +./sign ${base_pkg}-win32-$ver.exe +./sign ${base_pkg}-win64-$ver.exe +ls -l ${base_pkg}-win*.exe* +cd ${src} +# get back to original branch +git checkout ${current} diff --git a/bacula/release/pushtags b/bacula/release/pushtags new file mode 100755 index 0000000000..a1ed841e9e --- /dev/null +++ b/bacula/release/pushtags @@ -0,0 +1,23 @@ +#!/bin/sh +# +# Push tags +# + +. ./config + +echo "Updating repo and tags for release version: ${ver}" + +cd $cwd + +fulltag=Release-$ver + +for i in $bacula $docs ; do + cd $i + current=`git branch | awk '/*/ { print $2 }'` + git checkout ${branch} + git push ${remote} ${branch} + git push ${remote} tag ${fulltag} + echo "Pushed ${remote} and push tag ${fulltag} in $i" + git checkout ${current} +done + -- 2.39.5