view contrib/make_flys_release/bin/make-importer-package.sh @ 9763:ce7c67445cbb 3.2.x

No more hacks for getting description in case of official lines In case the name contained one and only one number, that number had been returned as description because in that case, the name matched WQ.NUMBERS_PATTERN.
author Tom Gottfried <tom@intevation.de>
date Fri, 11 Nov 2022 18:12:26 +0100
parents b1b48fa7bd80
children b57b236c4f4e
line wrap: on
line source
#!/bin/bash
# Packaging-script for Dive4Elements River-Importer
#
# Copyright (C) 2011 - 2014 by Bundesanstalt für Gewässerkunde
# Software engineering by Intevation GmbH
#
# This file is Free Software under the GNU AGPL (>=v3)
# and comes with ABSOLUTELY NO WARRANTY! Check out the
# documentation coming with Dive4Elements River for details.

set -e

# See ../README for more information
# The working directory. Resulting tarball will be placed here.
PKG_DIR=/tmp/flys-importer
# Path to the flys checkout
SOURCE_DIR=$(readlink -f `dirname $0`)/../../..

usage(){
    cat << EOF

usage: $0 [options] VERSION [EXTRAS]

Create a D4E River Importer-package

OPTIONS:
   -?, --help          Show this message
   VERSION must specify a tag (usually MAYOR.MINOR.PATCH) or a branch name.
   With EXTRAS, a tarball with dependencies can be given.
EOF
exit 0
}

OPTS=`getopt -o ? -l help -n $0 -- "$@"`

if [ $? != 0 ] ; then usage; fi
eval set -- "$OPTS"
while true ; do
  case "$1" in
    "-?"|"--help")
      usage;;
    "--")
      shift
      break;;
    *)
      echo "Unknown Option $1"
      usage;;
  esac
done

if [ $# != 1 ]; then
    usage
fi

VERSION=$1
EXTRAS=$2

# Update to VERSION
echo "WARNING: any local changes in $SOURCE_DIR will be packaged."
cd ${SOURCE_DIR}
if [ -z "`hg tags | sed -n "/$VERSION/p"`" -a -z "`hg branches | sed -n "/$VERSION/p"`" ]
then
    echo "ERROR: No tag or branch $VERSION found in repository of $repo!"
    exit 1
else
    hg up "$VERSION"
fi

# create PDF of manual
REV=`hg parent | sed -n '1s/[[:alnum:]]*: *\([0-9]*:.*\)/\1/;1p'`
cd ${SOURCE_DIR}/backend/doc/documentation/de/
sed -i "s/documentrevision..rev.*/documentrevision}{rev$REV}/" \
    importer-manual.tex
# run pdflatex three times to get references and page numbering right
pdflatex importer-manual.tex
pdflatex importer-manual.tex
pdflatex importer-manual.tex

# package importer
mvn -f $SOURCE_DIR/backend/pom.xml clean package assembly:single

echo "INFO: create tarball"
rm -fr $PKG_DIR
mkdir $PKG_DIR
cd $PKG_DIR

mv $SOURCE_DIR/backend/target/river-backend-1.0-SNAPSHOT*-flys-importer.tar \
    flys-importer-$VERSION.tar
if [ -f "$EXTRAS" ]; then
    tar -xzf "$EXTRAS"
    tar -rf flys-importer-$VERSION.tar opt
fi

gzip flys-importer-$VERSION.tar
sha1sum flys-importer-$VERSION.tar.gz > flys-importer-$VERSION.tar.gz.sha1
echo Package is at: `readlink -f flys-importer-$VERSION.tar.gz`

http://dive4elements.wald.intevation.org