# HG changeset patch # User Tom Gottfried # Date 1591294597 -7200 # Node ID 8e5a8430b89c49a577d643b7142e20e3d172cb82 # Parent 280f250a490f2f7eef79de1456a2840c0e1ebf63 Allow tagging a branch diff -r 280f250a490f -r 8e5a8430b89c contrib/make_flys_release/make_release.sh --- a/contrib/make_flys_release/make_release.sh Thu Jun 04 19:37:21 2020 +0200 +++ b/contrib/make_flys_release/make_release.sh Thu Jun 04 20:16:37 2020 +0200 @@ -26,7 +26,7 @@ usage(){ cat << EOF -usage: $0 [options] VERSION +usage: $0 [options] TARGET Create a D4E River package @@ -34,13 +34,13 @@ -?, --help Show this message -w The working directory to use (do not use spaces in path) Default: $DEFAULT_WD - -t Tag the current default branch as "VERSION" + -t Tag the selected branch with given name. Note that \$USER is used as the repository user name for pushing the tags. -o, --oracle Release is for oracle. Suitable jar-file for JDBC driver has to be given with the environment variable ORACLE_JDBC - VERSION must specify a tag (usually MAYOR.MINOR.PATCH) or a branch name. + TARGET must specify a tag (usually MAYOR.MINOR.PATCH) or a branch name. EOF exit 0 } @@ -58,7 +58,7 @@ # customizable variables ELBE_MODEL_UUID=${ELBE_MODEL_UUID:-1a4825f6-925f-11e3-8165-001f29e71d12} -OPTS=`getopt -o ?w:,t,o \ +OPTS=`getopt -o ?w:,?t:,o \ -l help,oracle \ -n $0 -- "$@"` @@ -78,8 +78,8 @@ BUILD_ORACLE="TRUE" shift;; "-t") - DO_TAG="TRUE" - shift;; + DO_TAG=$2 + shift 2;; *) echo "Unknown Option $1" usage;; @@ -90,7 +90,7 @@ usage fi -VERSION=$1 +TARGET=$1 if [ -z $WORK_DIR ]; then WORK_DIR=$DEFAULT_WD @@ -125,19 +125,35 @@ done; fi -if [ "$DO_TAG" = "TRUE" ]; then - echo "INFO: Tagging version $VERSION" +# Update to current version +for repo in $REPOS; do + cd $repo + if [ -z "`hg tags | sed -n "/$TARGET/p"`" -a -z "`hg branches | sed -n "/$TARGET/p"`" ] + then + echo "WARNING: No tag or branch $TARGET found in repository of $repo!" + echo " Will fallback to 'default'!" + hg up default + else + hg up "$TARGET" + fi + cd $FLYS_SOURCE_DIR +done + +if [ -n "$DO_TAG" ]; then + VERSION=$DO_TAG + echo "INFO: Tagging current branch as $VERSION" for repo in $REPOS; do cd $repo - CHANGESET=$(hg log -l1 |head -1 | awk -F: '{print $3}') + CHANGESET=$(hg parent |head -1 | awk -F: '{print $3}') echo "" echo "Do you really want to tag $repo rev: $CHANGESET as Version $VERSION?" echo "press enter to continue or CTRL+C to abort." echo "" - hg log -l1 + hg log -r $CHANGESET -l1 read OLD_REV=$(cat .hgtags | tail -1 | awk '{print $2}') - hg tag $VERSION -m "Added tag $VERSION for changeset $CHANGESET" + hg tag -r $CHANGESET -m "Added tag $VERSION for changeset $CHANGESET" \ + "$VERSION" hg push ssh://$USER@scm.wald.intevation.org/hg/dive4elements/$repo echo "Changelog for $repo" >> $WORK_DIR/changes_$OLD_REV-$VERSION.txt echo "#############################################################################" \ @@ -145,23 +161,10 @@ hg log -r $VERSION:$OLD_REV --style changelog >> $WORK_DIR/changes_$OLD_REV-$VERSION.txt cd $FLYS_SOURCE_DIR done; +else + VERSION=$TARGET fi -# Update to current version -for repo in $REPOS; do - cd $repo - if [ -z "`hg tags | sed -n "/$VERSION/p"`" -a -z "`hg branches | sed -n "/$VERSION/p"`" ] - then - echo "WARNING: No tag or branch $VERSION found in repository of $repo!" - echo " Will fallback to 'default'!" - hg up default - else - hg up "$VERSION" - fi - cd $FLYS_SOURCE_DIR -done - - if [ ! -f "$FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz" ]; then echo "INFO: download OpenLayers-2.11 for client" cd $FLYS_SOURCE_DIR @@ -208,7 +211,7 @@ cp wsplgen-linux-32bit-static $FLYS_SOURCE_DIR/river/artifacts/bin/wsplgen cd - -if [ "$DO_TAG" = "TRUE" ]; then +if [ -n "$DO_TAG" ]; then echo "INFO: Building packages for publication" cd $FLYS_SOURCE_DIR/river/artifacts mvn package assembly:single @@ -302,10 +305,10 @@ tar cfz flys-$VERSION.tar.gz flys-$VERSION ## -if [ "$DO_TAG" = "TRUE" ]; then +if [ -n "$DO_TAG" ]; then echo "Binary-packages for publication:" echo "_ $WORK_DIR/d4e-river-$VERSION.tar.bz2" echo "_ $WORK_DIR/d4e-river-$VERSION.war" + echo "Changelog: $WORK_DIR/changes_$OLD_REV-$VERSION.txt" fi echo "DONE: $WORK_DIR/flys-$VERSION.tar.gz" -echo "Changelog: $WORK_DIR/changes_$OLD_REV-$VERSION.txt"