Mercurial > dive4elements > river
comparison contrib/make_flys_release/make_release.sh @ 9681:8e5a8430b89c 3.2.x
Allow tagging a branch
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 04 Jun 2020 20:16:37 +0200 |
parents | 21c89e39ca72 |
children | f3aa7a12c86a |
comparison
equal
deleted
inserted
replaced
9680:280f250a490f | 9681:8e5a8430b89c |
---|---|
24 | 24 |
25 SCRIPT_DIR=$(readlink -f `dirname $0`) | 25 SCRIPT_DIR=$(readlink -f `dirname $0`) |
26 usage(){ | 26 usage(){ |
27 cat << EOF | 27 cat << EOF |
28 | 28 |
29 usage: $0 [options] VERSION | 29 usage: $0 [options] TARGET |
30 | 30 |
31 Create a D4E River package | 31 Create a D4E River package |
32 | 32 |
33 OPTIONS: | 33 OPTIONS: |
34 -?, --help Show this message | 34 -?, --help Show this message |
35 -w The working directory to use (do not use spaces in path) | 35 -w The working directory to use (do not use spaces in path) |
36 Default: $DEFAULT_WD | 36 Default: $DEFAULT_WD |
37 -t Tag the current default branch as "VERSION" | 37 -t Tag the selected branch with given name. |
38 Note that \$USER is used as the repository user name | 38 Note that \$USER is used as the repository user name |
39 for pushing the tags. | 39 for pushing the tags. |
40 -o, --oracle Release is for oracle. | 40 -o, --oracle Release is for oracle. |
41 Suitable jar-file for JDBC driver has to be given with | 41 Suitable jar-file for JDBC driver has to be given with |
42 the environment variable ORACLE_JDBC | 42 the environment variable ORACLE_JDBC |
43 VERSION must specify a tag (usually MAYOR.MINOR.PATCH) or a branch name. | 43 TARGET must specify a tag (usually MAYOR.MINOR.PATCH) or a branch name. |
44 EOF | 44 EOF |
45 exit 0 | 45 exit 0 |
46 } | 46 } |
47 # --backend-db-url Url of database backend. Default: $BACKENDURL | 47 # --backend-db-url Url of database backend. Default: $BACKENDURL |
48 # --backend-db-pass Backend db password. Default: $BACKENDPASS | 48 # --backend-db-pass Backend db password. Default: $BACKENDPASS |
56 # --seddb-back Sediment db backend. Default: $SEDDBBACK | 56 # --seddb-back Sediment db backend. Default: $SEDDBBACK |
57 | 57 |
58 # customizable variables | 58 # customizable variables |
59 ELBE_MODEL_UUID=${ELBE_MODEL_UUID:-1a4825f6-925f-11e3-8165-001f29e71d12} | 59 ELBE_MODEL_UUID=${ELBE_MODEL_UUID:-1a4825f6-925f-11e3-8165-001f29e71d12} |
60 | 60 |
61 OPTS=`getopt -o ?w:,t,o \ | 61 OPTS=`getopt -o ?w:,?t:,o \ |
62 -l help,oracle \ | 62 -l help,oracle \ |
63 -n $0 -- "$@"` | 63 -n $0 -- "$@"` |
64 | 64 |
65 if [ $? != 0 ] ; then usage; fi | 65 if [ $? != 0 ] ; then usage; fi |
66 eval set -- "$OPTS" | 66 eval set -- "$OPTS" |
76 shift 2;; | 76 shift 2;; |
77 "-o"|"--oracle") | 77 "-o"|"--oracle") |
78 BUILD_ORACLE="TRUE" | 78 BUILD_ORACLE="TRUE" |
79 shift;; | 79 shift;; |
80 "-t") | 80 "-t") |
81 DO_TAG="TRUE" | 81 DO_TAG=$2 |
82 shift;; | 82 shift 2;; |
83 *) | 83 *) |
84 echo "Unknown Option $1" | 84 echo "Unknown Option $1" |
85 usage;; | 85 usage;; |
86 esac | 86 esac |
87 done | 87 done |
88 | 88 |
89 if [ $# != 1 ]; then | 89 if [ $# != 1 ]; then |
90 usage | 90 usage |
91 fi | 91 fi |
92 | 92 |
93 VERSION=$1 | 93 TARGET=$1 |
94 | 94 |
95 if [ -z $WORK_DIR ]; then | 95 if [ -z $WORK_DIR ]; then |
96 WORK_DIR=$DEFAULT_WD | 96 WORK_DIR=$DEFAULT_WD |
97 fi | 97 fi |
98 | 98 |
123 for repo in $REPOS; do | 123 for repo in $REPOS; do |
124 cd $repo && hg revert -a && hg pull -u && cd - | 124 cd $repo && hg revert -a && hg pull -u && cd - |
125 done; | 125 done; |
126 fi | 126 fi |
127 | 127 |
128 if [ "$DO_TAG" = "TRUE" ]; then | 128 # Update to current version |
129 echo "INFO: Tagging version $VERSION" | 129 for repo in $REPOS; do |
130 cd $repo | |
131 if [ -z "`hg tags | sed -n "/$TARGET/p"`" -a -z "`hg branches | sed -n "/$TARGET/p"`" ] | |
132 then | |
133 echo "WARNING: No tag or branch $TARGET found in repository of $repo!" | |
134 echo " Will fallback to 'default'!" | |
135 hg up default | |
136 else | |
137 hg up "$TARGET" | |
138 fi | |
139 cd $FLYS_SOURCE_DIR | |
140 done | |
141 | |
142 if [ -n "$DO_TAG" ]; then | |
143 VERSION=$DO_TAG | |
144 echo "INFO: Tagging current branch as $VERSION" | |
130 for repo in $REPOS; do | 145 for repo in $REPOS; do |
131 cd $repo | 146 cd $repo |
132 CHANGESET=$(hg log -l1 |head -1 | awk -F: '{print $3}') | 147 CHANGESET=$(hg parent |head -1 | awk -F: '{print $3}') |
133 echo "" | 148 echo "" |
134 echo "Do you really want to tag $repo rev: $CHANGESET as Version $VERSION?" | 149 echo "Do you really want to tag $repo rev: $CHANGESET as Version $VERSION?" |
135 echo "press enter to continue or CTRL+C to abort." | 150 echo "press enter to continue or CTRL+C to abort." |
136 echo "" | 151 echo "" |
137 hg log -l1 | 152 hg log -r $CHANGESET -l1 |
138 read | 153 read |
139 OLD_REV=$(cat .hgtags | tail -1 | awk '{print $2}') | 154 OLD_REV=$(cat .hgtags | tail -1 | awk '{print $2}') |
140 hg tag $VERSION -m "Added tag $VERSION for changeset $CHANGESET" | 155 hg tag -r $CHANGESET -m "Added tag $VERSION for changeset $CHANGESET" \ |
156 "$VERSION" | |
141 hg push ssh://$USER@scm.wald.intevation.org/hg/dive4elements/$repo | 157 hg push ssh://$USER@scm.wald.intevation.org/hg/dive4elements/$repo |
142 echo "Changelog for $repo" >> $WORK_DIR/changes_$OLD_REV-$VERSION.txt | 158 echo "Changelog for $repo" >> $WORK_DIR/changes_$OLD_REV-$VERSION.txt |
143 echo "#############################################################################" \ | 159 echo "#############################################################################" \ |
144 >> $WORK_DIR/changes_$OLD_REV-$VERSION.txt | 160 >> $WORK_DIR/changes_$OLD_REV-$VERSION.txt |
145 hg log -r $VERSION:$OLD_REV --style changelog >> $WORK_DIR/changes_$OLD_REV-$VERSION.txt | 161 hg log -r $VERSION:$OLD_REV --style changelog >> $WORK_DIR/changes_$OLD_REV-$VERSION.txt |
146 cd $FLYS_SOURCE_DIR | 162 cd $FLYS_SOURCE_DIR |
147 done; | 163 done; |
148 fi | 164 else |
149 | 165 VERSION=$TARGET |
150 # Update to current version | 166 fi |
151 for repo in $REPOS; do | |
152 cd $repo | |
153 if [ -z "`hg tags | sed -n "/$VERSION/p"`" -a -z "`hg branches | sed -n "/$VERSION/p"`" ] | |
154 then | |
155 echo "WARNING: No tag or branch $VERSION found in repository of $repo!" | |
156 echo " Will fallback to 'default'!" | |
157 hg up default | |
158 else | |
159 hg up "$VERSION" | |
160 fi | |
161 cd $FLYS_SOURCE_DIR | |
162 done | |
163 | |
164 | 167 |
165 if [ ! -f "$FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz" ]; then | 168 if [ ! -f "$FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz" ]; then |
166 echo "INFO: download OpenLayers-2.11 for client" | 169 echo "INFO: download OpenLayers-2.11 for client" |
167 cd $FLYS_SOURCE_DIR | 170 cd $FLYS_SOURCE_DIR |
168 curl -LO "https://github.com/openlayers/ol2/releases/download/release-2.11/OpenLayers-2.11.tar.gz" | 171 curl -LO "https://github.com/openlayers/ol2/releases/download/release-2.11/OpenLayers-2.11.tar.gz" |
206 gunzip wsplgen-linux-64bit-static.gz wsplgen-linux-32bit-static.gz | 209 gunzip wsplgen-linux-64bit-static.gz wsplgen-linux-32bit-static.gz |
207 chmod +x wsplgen-linux-* | 210 chmod +x wsplgen-linux-* |
208 cp wsplgen-linux-32bit-static $FLYS_SOURCE_DIR/river/artifacts/bin/wsplgen | 211 cp wsplgen-linux-32bit-static $FLYS_SOURCE_DIR/river/artifacts/bin/wsplgen |
209 cd - | 212 cd - |
210 | 213 |
211 if [ "$DO_TAG" = "TRUE" ]; then | 214 if [ -n "$DO_TAG" ]; then |
212 echo "INFO: Building packages for publication" | 215 echo "INFO: Building packages for publication" |
213 cd $FLYS_SOURCE_DIR/river/artifacts | 216 cd $FLYS_SOURCE_DIR/river/artifacts |
214 mvn package assembly:single | 217 mvn package assembly:single |
215 mv target/river-artifacts-1.0-SNAPSHOT-bin.tar.bz2 \ | 218 mv target/river-artifacts-1.0-SNAPSHOT-bin.tar.bz2 \ |
216 $WORK_DIR/d4e-river-$VERSION.tar.bz2 && cd .. | 219 $WORK_DIR/d4e-river-$VERSION.tar.bz2 && cd .. |
300 rm -rf flys-$VERSION && mkdir flys-$VERSION | 303 rm -rf flys-$VERSION && mkdir flys-$VERSION |
301 tar -xf flys-$VERSION.tar -C flys-$VERSION | 304 tar -xf flys-$VERSION.tar -C flys-$VERSION |
302 tar cfz flys-$VERSION.tar.gz flys-$VERSION | 305 tar cfz flys-$VERSION.tar.gz flys-$VERSION |
303 ## | 306 ## |
304 | 307 |
305 if [ "$DO_TAG" = "TRUE" ]; then | 308 if [ -n "$DO_TAG" ]; then |
306 echo "Binary-packages for publication:" | 309 echo "Binary-packages for publication:" |
307 echo "_ $WORK_DIR/d4e-river-$VERSION.tar.bz2" | 310 echo "_ $WORK_DIR/d4e-river-$VERSION.tar.bz2" |
308 echo "_ $WORK_DIR/d4e-river-$VERSION.war" | 311 echo "_ $WORK_DIR/d4e-river-$VERSION.war" |
312 echo "Changelog: $WORK_DIR/changes_$OLD_REV-$VERSION.txt" | |
309 fi | 313 fi |
310 echo "DONE: $WORK_DIR/flys-$VERSION.tar.gz" | 314 echo "DONE: $WORK_DIR/flys-$VERSION.tar.gz" |
311 echo "Changelog: $WORK_DIR/changes_$OLD_REV-$VERSION.txt" |