3 # script to automate EG release packaging for point releases
6 # developed on ubuntu 14.04 and designed to be run there
7 # see https://bugs.launchpad.net/evergreen/+bug/1757455
10 echo "Usage: $0 -o <OpenSRF version> -e <Evergreen version> -g <Git username> -h help"
13 while getopts e:o:g:h OPTIONS
15 e) EG_VERSION="$OPTARG";;
16 o) OSRF_VERSION="$OPTARG";;
17 g) GIT_USERNAME="$OPTARG";;
23 if [ -z $EG_VERSION ] || [ -z $OSRF_VERSION ] || [ -z $GIT_USERNAME ]; then
28 # set up some variables
30 TRANSLATION_USER="bshum"
31 TRANSLATION_EXPORT="translation-export-$(echo $EG_VERSION | cut -b 1-3)"
32 VERSION_STRING="$(echo $EG_VERSION | perl -e 'while (<>) {@c = split /\./, $_; if (length($c[2] == 2)) {print "$c[0].0$c[1]0$c[2]";} else {print "$c[0].0$c[1]$c[2]";}}')"
33 OSRF_GIT="osrf_rel_$(echo $OSRF_VERSION | sed 's/\./_/g')"
34 PREV_EG_VERSION=$(echo $EG_VERSION | perl -e 'while (<>) {@c = split /\./, $_; print "$c[0].$c[1]." . ("$c[2]" - 1)}')
35 UPGRADE_DOC="docs/installation/server_upgrade.adoc"
37 WEBSERVER="www.example.org"
43 if [ ! -d OpenSRF ]; then
44 git clone git://git.evergreen-ils.org/OpenSRF.git
46 echo "OpenSRF directory already exists. Skipping"
48 cd OpenSRF && git fetch && git checkout -b $OSRF_GIT $OSRF_GIT
54 if [ ! -d Evergreen ]; then
55 git clone git://git.evergreen-ils.org/Evergreen.git
57 echo "Evergreen directory already exists. Skipping"
61 # Add working repo so we have somewhere to push
64 if [ "$(git config remote.working.url > /dev/null)" ]; then
65 echo "Git remote 'working' already exists. Skipping"
68 git remote add working git@git.evergreen-ils.org:working/Evergreen.git
77 git checkout rel_$(echo $EG_VERSION | cut -b 1-3 | sed 's/\./_/g')
79 git checkout -b rel_$(echo $EG_VERSION | sed 's/\./_/g')
83 # pull in i18n changes
84 UpdateTranslations () {
86 if [ -d "$TRANSLATION_EXPORT" ]; then
87 echo "Directory $TRANSLATION_EXPORT already exists. Skipping"
89 bzr branch lp:~$TRANSLATION_USER/evergreen/$TRANSLATION_EXPORT
91 cd $TRANSLATION_EXPORT
94 Evergreen/build/i18n/scripts/update_pofiles -l $TRANSLATION_EXPORT -e Evergreen
95 cd Evergreen/build/i18n/po
97 git commit -asm "Translation updates - po files"
101 # update Perl version string
102 UpdatePerlVersionString () {
104 sed -i "s/our \$VERSION = '[0-9].[0-9]*';/our \$VERSION = '$VERSION_STRING';/" Open-ILS/src/perlmods/lib/OpenILS.pm
105 git commit -asm "Bumping Perl version string for $EG_VERSION"
109 # substitute old EG version number with new EG version number in the upgrade doc
110 UpdateUpgradeDoc () {
112 git checkout origin/tags/rel_$(echo $PREV_EG_VERSION | sed 's/\./_/g') docs/installation/server_upgrade.adoc
113 sed -i "s/rel_$(echo $PREV_EG_VERSION | sed 's/\./_/g')/rel_$(echo $EG_VERSION | sed 's/\./_/g')/g" $UPGRADE_DOC
114 sed -i "s/Evergreen $PREV_EG_VERSION/Evergreen $EG_VERSION/g" $UPGRADE_DOC
115 sed -i "s/Evergreen-ILS-$PREV_EG_VERSION/Evergreen-ILS-$EG_VERSION/g" $UPGRADE_DOC
116 sed -i "s/to $PREV_EG_VERSION/to $EG_VERSION/g" $UPGRADE_DOC
117 sed -i "/-$PREV_EG_VERSION-upgrade-db.sql/a - $PREV_EG_VERSION-$EG_VERSION-upgrade-db.sql" $UPGRADE_DOC
118 sed -i "/^-.*-$PREV_EG_VERSION-upgrade-db.sql/a - $PREV_EG_VERSION-$EG_VERSION-upgrade-db.sql" $UPGRADE_DOC
119 sed -i "s^version-upgrade/.*-$PREV_EG_VERSION-upgrade-db.sql^version-upgrade/$PREV_EG_VERSION-$EG_VERSION-upgrade-db.sql^g" $UPGRADE_DOC
120 echo "Please verify make any manual corrections you need to $UPGRADE_DOC"
123 git commit -asm "Updating upgrade docs for $EG_VERSION."
127 # run the make release script
130 export PATH=$PATH:/openils/bin
131 build/tools/make_release -c -v $EG_VERSION -f origin/tags/rel_$(echo $PREV_EG_VERSION | sed 's/\./_/g')
135 # generate release docs
138 cp README ../release/README_$(echo $EG_VERSION | cut -b 1-3 | sed 's/\./_/g')
139 cp docs/RELEASE_NOTES_$(echo $EG_VERSION | cut -b 1-3 | sed 's/\./_/g').adoc ../release/
141 for i in README_$(echo $EG_VERSION | cut -b 1-3 | sed 's/\./_/g') RELEASE_NOTES_$(echo $EG_VERSION | cut -b 1-3 | sed 's/\./_/g').adoc; do
142 asciidoc -a toc -a numbered $i
148 # push the changes to git server
151 git push --force working rel_$(echo $EG_VERSION | sed 's/\./_/g'):user/$GIT_USERNAME/rel_$(echo $EG_VERSION | sed 's/\./_/g')
155 CompressReleaseDir () {
156 tar czvf $WORKDIR/release-${EG_VERSION}.tar.gz release
159 CopyReleaseToWebServer () {
160 scp -P $SSH_PORT $WORKDIR/release-${EG_VERSION}.tar.gz $WEBSERVER_USER@$WEBSERVER:~/public_html
169 UpdatePerlVersionString
175 CopyReleaseToWebServer