Mercurial > dive4elements > river
comparison contrib/make_flys_release/bin/make-importer-package.sh @ 8675:ae3df0f96e15
Mavenize importer packaging and allow packaging for specific versions and database systems.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 09 Apr 2015 17:29:45 +0200 |
parents | 32682fa2127d |
children | f7007b1aaa3f |
comparison
equal
deleted
inserted
replaced
8674:44ba71b0b75a | 8675:ae3df0f96e15 |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 # Packaging-script for Dive4Elements River-Importer | |
3 # | |
4 # Copyright (C) 2011 - 2014 by Bundesanstalt für Gewässerkunde | |
5 # Software engineering by Intevation GmbH | |
6 # | |
7 # This file is Free Software under the GNU AGPL (>=v3) | |
8 # and comes with ABSOLUTELY NO WARRANTY! Check out the | |
9 # documentation coming with Dive4Elements River for details. | |
10 | |
2 set -e | 11 set -e |
3 | 12 |
4 # See README for more information | 13 # See ../README for more information |
14 # The working directory. Resulting tarball will be placed here. | |
15 PKG_DIR=/tmp/flys-importer | |
16 # Path to the flys checkout | |
17 SOURCE_DIR=$(readlink -f `dirname $0`)/../../.. | |
5 | 18 |
6 # The working directory. Resulting tarball will be placed in the directory above. | 19 usage(){ |
7 PKG_DIR=~/tmp/flys-importer | 20 cat << EOF |
8 # Path to the flys checkout | |
9 FLYS_DIR=~/flys/river/ | |
10 # Tarball that will be extracted into flys-importer/opt | |
11 EXTRAS=$1 | |
12 | 21 |
13 rm -fr $PKG_DIR | 22 usage: $0 [options] VERSION [EXTRAS] |
14 mkdir -p $PKG_DIR/hydr_morph | |
15 mkdir -p $PKG_DIR/geodaesie | |
16 mkdir -p $PKG_DIR/opt/lib64 | |
17 mkdir -p $PKG_DIR/schema | |
18 | 23 |
19 cd ${FLYS_DIR}/backend | 24 Create a D4E River Importer-package |
20 mvn -f pom-oracle.xml clean compile assembly:single | 25 |
21 cp target/backend-1.0-SNAPSHOT-jar-with-dependencies.jar \ | 26 OPTIONS: |
22 $PKG_DIR/hydr_morph/importer.jar | 27 -?, --help Show this message |
23 mvn -f pom.xml clean compile assembly:single | 28 -o, --oracle Package is for Oracle. |
24 cp target/river-backend-1.0-SNAPSHOT-jar-with-dependencies.jar \ | 29 Suitable jar-file for JDBC driver has to be given with |
25 $PKG_DIR/hydr_morph/importer_psql.jar | 30 the environment variable ORACLE_JDBC |
26 cp ${FLYS_DIR}/backend/contrib/shpimporter/*.py $PKG_DIR/geodaesie | 31 VERSION must specify a tag (usually MAYOR.MINOR.PATCH) or a branch name. |
27 cp ${FLYS_DIR}/backend/contrib/run_geo.sh \ | 32 With EXTRAS, a tarball with dependencies can be given. |
28 ${FLYS_DIR}/backend/contrib/run_hydr_morph.sh \ | 33 EOF |
29 ${FLYS_DIR}/backend/contrib/import_river.sh \ | 34 exit 0 |
30 $PKG_DIR | 35 } |
31 cp -r ${FLYS_DIR}/backend/doc/conf $PKG_DIR/ | 36 |
32 if [ -f "$EXTRAS" ]; then | 37 OPTS=`getopt -o ?,o -l help,oracle -n $0 -- "$@"` |
33 cd $PKG_DIR | 38 |
34 tar -xzf "$EXTRAS" | 39 if [ $? != 0 ] ; then usage; fi |
40 eval set -- "$OPTS" | |
41 while true ; do | |
42 case "$1" in | |
43 "-?"|"--help") | |
44 usage;; | |
45 "--") | |
46 shift | |
47 break;; | |
48 "-o"|"--oracle") | |
49 BUILD_ORACLE="TRUE" | |
50 shift;; | |
51 *) | |
52 echo "Unknown Option $1" | |
53 usage;; | |
54 esac | |
55 done | |
56 | |
57 if [ $# != 1 ]; then | |
58 usage | |
35 fi | 59 fi |
36 | 60 |
37 cp ${FLYS_DIR}/backend/doc/schema/*.sql $PKG_DIR/schema | 61 VERSION=$1 |
62 EXTRAS=$2 | |
63 | |
64 # Update to VERSION | |
65 echo "WARNING: any local changes in $SOURCE_DIR will be packaged." | |
66 cd ${SOURCE_DIR} | |
67 if [ -z "`hg tags | sed -n "/$VERSION/p"`" -a -z "`hg branches | sed -n "/$VERSION/p"`" ] | |
68 then | |
69 echo "WARNING: $VERSION not found in $repo! Updating to default." | |
70 hg up default | |
71 else | |
72 hg up "$VERSION" | |
73 fi | |
38 | 74 |
39 # create PDF of manual | 75 # create PDF of manual |
40 REV=`hg parent | sed -n '1s/[[:alnum:]]*: *\([0-9]*:.*\)/\1/;1p'` | 76 REV=`hg parent | sed -n '1s/[[:alnum:]]*: *\([0-9]*:.*\)/\1/;1p'` |
41 cd ${FLYS_DIR}/backend/doc/documentation/de/ | 77 cd ${SOURCE_DIR}/backend/doc/documentation/de/ |
42 sed -i "s/documentrevision..rev.*/documentrevision}{rev$REV}/" \ | 78 sed -i "s/documentrevision..rev.*/documentrevision}{rev$REV}/" \ |
43 importer-manual.tex | 79 importer-manual.tex |
44 # run pdflatex three times to get references and page numbering right | 80 # run pdflatex three times to get references and page numbering right |
45 pdflatex importer-manual.tex | 81 pdflatex importer-manual.tex |
46 pdflatex importer-manual.tex | 82 pdflatex importer-manual.tex |
47 pdflatex importer-manual.tex | 83 pdflatex importer-manual.tex |
48 cp importer-manual.pdf $PKG_DIR | |
49 | 84 |
50 sed -i 's/shpimporter\/shp/geodaesie\/shp/' $PKG_DIR/run_geo.sh | 85 # package importer |
86 if [ "$BUILD_ORACLE" = "TRUE" ]; then | |
87 if [ ! -f $ORACLE_JDBC ]; then | |
88 echo "Could not find oracle jdbc in $ORACLE_JDBC" | |
89 echo "Please make sure that the ORACLE_JDBC variable is set correctly" | |
90 exit 1 | |
91 fi | |
92 mvn install:install-file -DgroupId=ojdbc -DartifactId=ojdbc \ | |
93 -Dversion=0 -Dpackaging=jar -Dfile=$ORACLE_JDBC -DgeneratePom=true | |
94 mvn -f $SOURCE_DIR/backend/pom-oracle.xml clean package assembly:single | |
95 else | |
96 mvn -f $SOURCE_DIR/backend/pom.xml clean package assembly:single | |
97 fi | |
51 | 98 |
52 cd $PKG_DIR/.. | 99 echo "INFO: create tarball" |
53 DATE=$(date +%Y%m%d%H%M) | 100 rm -fr $PKG_DIR |
54 tar -czf flys-importer_${DATE}.tar.gz flys-importer | 101 mkdir $PKG_DIR |
55 sha1sum flys-importer_${DATE}.tar.gz > flys-importer_${DATE}.tar.gz.sha1 | 102 cd $PKG_DIR |
56 echo Package is at: `readlink -f flys-importer_${DATE}.tar.gz` | 103 |
104 mv $SOURCE_DIR/backend/target/river-backend-1.0-SNAPSHOT*-flys-importer.tar \ | |
105 flys-importer-$VERSION.tar | |
106 if [ -f "$EXTRAS" ]; then | |
107 tar -xzf "$EXTRAS" | |
108 tar -rf flys-importer-$VERSION.tar opt | |
109 fi | |
110 | |
111 gzip flys-importer-$VERSION.tar | |
112 sha1sum flys-importer-$VERSION.tar.gz > flys-importer-$VERSION.tar.gz.sha1 | |
113 echo Package is at: `readlink -f flys-importer-$VERSION.tar.gz` |