forked from gem/oq-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackager.sh
executable file
·92 lines (72 loc) · 1.62 KB
/
packager.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
GEM_BUILD_ROOT="build-deb"
GEM_BUILD_SRC="${GEM_BUILD_ROOT}/python-oq"
GEM_ALWAYS_YES=false
mksafedir () {
local dname
dname="$1"
if [ "$GEM_ALWAYS_YES" != "true" -a -d "$dname" ]; then
echo "$dname already exists"
echo "press Enter to continue or CTRL+C to abort"
read a
fi
rm -rf $dname
mkdir -p $dname
}
usage () {
local ret
ret=$1
echo
echo "USAGE:"
echo " $0 [-B] build debian source package, if -B argument is present binary package is build too"
echo
exit $ret
}
#
# MAIN
BUILD_BINARIES=0
# args management
while [ $# -gt 0 ]; do
case $1 in
-B|--binaries)
BUILD_BINARIES=1
;;
-h|--help)
usage 0
break
;;
*)
usage 1
break
;;
esac
shift
done
DPBP_FLAG=""
if [ "$BUILD_BINARIES" -eq 0 ]; then
DPBP_FLAG="-S"
fi
mksafedir "$GEM_BUILD_ROOT"
mksafedir "$GEM_BUILD_SRC"
git archive HEAD | (cd "$GEM_BUILD_SRC" ; tar xv)
git submodule init
git submodule update
# "submodule foreach" vars: $name, $path, $sha1 and $toplevel:
git submodule foreach "git archive HEAD | (cd \"\${toplevel}/${GEM_BUILD_SRC}/\$path\" ; tar xv ) "
cd "$GEM_BUILD_SRC"
# mods pre-packaging
mv LICENSE openquake
mv README.txt openquake/README
mv celeryconfig.py openquake
mv logging.cfg openquake
mv openquake.cfg openquake
dpkg-buildpackage $DPBP_FLAG
cd -
exit 0
#
# DEVEL
GEM_BUILD_EXTR="${GEM_BUILD_ROOT}/extr"
mksafedir "$GEM_BUILD_EXTR"
cd "$GEM_BUILD_EXTR"
dpkg -x ../python-oq_*.deb .
dpkg -e ../python-oq_*.deb