blob: 2dbf45f5b4c3967861e290d7cb6f7b0cfdc31855 (
plain) (
blame)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
#!/bin/bash -e
# start from the directory above the combined subsurface & subsurface/libdivecomputer directory
#
# in order to be able to make changes to the debian/* files without changing the source
# this script assumes that the debian/* files plus a separate debian.changelog are in
# this directory as well - this makes testing builds on launchpad easier
# for most people all it should take is to run
# cp -a packaging/ubuntu/debian .
#
if [[ $(pwd | grep "subsurface$") || ! -d subsurface || ! -d subsurface/libdivecomputer || ! -d subsurface/libgit2 ]] ; then
echo "Please start this script from the folder ABOVE the subsurface source directory"
echo "which includes libdivecomputer and libgit2 as subdirectories)."
exit 1;
fi
GITVERSION=$(cd subsurface ; git describe --abbrev=12 | sed -e 's/-g.*$// ; s/^v//')
GITREVISION=$(echo $GITVERSION | sed -e 's/.*-// ; s/.*\..*//')
VERSION=$(echo $GITVERSION | sed -e 's/-/./')
GITDATE=$(cd subsurface ; git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d)
LIBDCREVISION=$(cd subsurface/libdivecomputer ; git rev-parse --verify HEAD)
#
#
echo "building Subsurface" $VERSION "with libdivecomputer" $LIBDCREVISION
#
if [[ ! -d subsurface_$VERSION ]]; then
mkdir subsurface_$VERSION
if [[ "x$GITREVISION" != "x" ]] ; then
rm -f subsurfacedaily-$VERSION
ln -s subsurface_$VERSION subsurfacedaily-$VERSION
else
rm -f subsurfacebeta-$VERSION
ln -s subsurface_$VERSION subsurfacebeta-$VERSION
fi
#
#
echo "copying sources"
#
(cd subsurface ; tar cf - . ) | (cd subsurface_$VERSION ; tar xf - )
cd subsurface_$VERSION;
rm -rf .git libdivecomputer/.git libgit2/.git
echo $GITVERSION > .gitversion
echo $GITDATE > .gitdate
echo $LIBDCREVISION > libdivecomputer/revision
# dh_make --email dirk@hohndel.org -c gpl2 --createorig --single --yes -p subsurface_$VERSION
# rm debian/*.ex debian/*.EX debian/README.*
#
#
echo "creating source tar file for OBS and Ununtu PPA"
#
if [[ "x$GITREVISION" != "x" ]] ; then
(cd .. ; tar ch subsurfacedaily-$VERSION | xz > home:Subsurface-Divelog/Subsurface-daily/subsurface-$VERSION.orig.tar.xz) &
else
(cd .. ; tar ch subsurfacebeta-$VERSION | xz > home:Subsurface-Divelog/Subsurface-beta/subsurface-$VERSION.orig.tar.xz) &
fi
tar cf - . | xz > ../subsurface_$VERSION.orig.tar.xz
else
echo "using existing source tree"
cd subsurface_$VERSION
fi
#
#
echo "preparint the debian directory"
#
export DEBEMAIL=dirk@hohndel.org
rm -rf debian
mkdir -p debian
cp -a ../debian .
cp ../debian.changelog debian/changelog
rev=0
while [ $rev -le "99" ]
do
rev=$(($rev+1))
if [[ ! $(grep $VERSION-$rev debian/changelog) ]] ; then
break
fi
done
if [[ "$RELEASE" = "1" ]] ; then
dch -v $VERSION-$rev~xenial -D xenial -M -m "Next release build - please check https://subsurface-divelog.org/category/news/ for details"
else
dch -v $VERSION-$rev~xenial -D xenial -M -m "next daily build"
fi
mv ~/src/debian.changelog ~/src/debian.changelog.previous
cp debian/changelog ~/src/debian.changelog
debuild -S
#create builds for the newer Ubuntu releases that Launchpad supports
rel=xenial
others="artful bionic"
for next in $others
do
sed -i "s/${rel}/${next}/g" debian/changelog
debuild -S
rel=$next
done
cd ..
if [[ "$1x" = "postx" ]] ; then
# daily vs. beta vs. release
if [[ "x$GITREVISION" == "x" ]] ; then
# this is a beta or a release; assume beta for now and deal with release later :-)
dput ppa:subsurface/subsurface-beta subsurface_$VERSION-$rev~*.changes
cd home:Subsurface-Divelog/Subsurface-beta
osc rm $(ls subsurface*.tar.xz | grep -v $VERSION)
osc add subsurface-$VERSION.orig.tar.xz
sed -i "s/%define latestVersion.*/%define latestVersion $VERSION/" subsurfacebeta.spec
sed -i "s/%define gitVersion .*/%define gitVersion 0/" subsurfacebeta.spec
osc commit -m "next beta build"
else
dput ppa:subsurface/subsurface-daily subsurface_$VERSION-$rev~*.changes
cd home:Subsurface-Divelog/Subsurface-daily
osc rm $(ls subsurface*.tar.xz | grep -v $VERSION)
osc add subsurface-$VERSION.orig.tar.xz
sed -i "s/%define latestVersion.*/%define latestVersion $VERSION/" subsurfacedaily.spec
sed -i "s/%define gitVersion .*/%define gitVersion $GITREVISION/" subsurfacedaily.spec
osc commit -m "next daily build"
fi
fi
|