blob: fdb5b08eda29963da26995075097922ad8b7cacc (
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
#!/bin/bash -e
# start from the directory above the subsurface directory
#
# we need to build the google maps plugin which is not part of our sources, so let's make sure
# it is included in our source tar file
#
# also, for bionic we need newer versions of libgit2 than what ships with the
# distro, so let's just use libgit2 1.0 everywhere
if [[ $(pwd | grep "subsurface$") || ! -d subsurface || ! -d subsurface/libdivecomputer ]] ; then
echo "Please start this script from the folder ABOVE the subsurface source directory"
exit 1;
fi
if [[ ! -d googlemaps ]] ; then
echo "Please make sure you have the current master of git://github.com/Subsurface-divelog/googlemaps"
echo "checked out in parallel to the Subsurface directory"
exit 1;
fi
if [[ ! -d libgit2 ]] ; then
echo "Please make sure you have libgit2 1.0 from git://github.com/libgit2/libgit2"
echo "checked out in parallel to the Subsurface directory"
exit 1;
fi
if [[ "$1" = "-obs" ]] ; then
echo "Also pushing update to OBS"
OBS="1"
fi
# ensure that the libdivecomputer module is there and current
cd subsurface
git submodule init
git submodule update
cd -
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)
if [[ "$GITVERSION" = "" ]] ; then
SUFFIX=".release"
else
SUFFIX=".daily"
fi
echo "building Subsurface" $VERSION "with libdivecomputer" $LIBDCREVISION
# we put all of the files into the distrobuilds directory in order not to clutter the 'src' directory
mkdir -p distrobuilds
cd distrobuilds
if [[ ! -d subsurface_$VERSION ]]; then
mkdir subsurface_$VERSION
if [[ "$GITREVISION" != "" ]] ; then
rm -f subsurfacedaily-$VERSION
ln -s subsurface_$VERSION subsurfacedaily-$VERSION
else
rm -f subsurface-$VERSION
ln -s subsurface_$VERSION subsurface-$VERSION
fi
echo "copying sources"
(cd ../subsurface ; tar cf - . ) | (cd subsurface_$VERSION ; tar xf - )
cd subsurface_$VERSION;
cp -a ../../googlemaps .
cp -a ../../libgit2 .
# now make sure we have libgit2 1.0
cd libgit2
git fetch
git checkout v1.0.0
cd ..
rm -rf .git libdivecomputer/.git googlemaps/.git build build-mobile libdivecomputer/build googlemaps/build libgit2/.git libgit2/build
echo $GITVERSION > .gitversion
echo $GITDATE > .gitdate
echo $LIBDCREVISION > libdivecomputer/revision
if [[ "$OBS" = "1" ]]; then
# oops, this isn't really for Debian/Ubuntu... it just creates corresponding source tar files for
# the Open Build Service to create SUSE and Fedora packages while we are at it
if [[ "$GITREVISION" != "" ]] ; then
(cd .. ; tar ch subsurfacedaily-$VERSION | xz > home:Subsurface-Divelog/Subsurface-daily/subsurface-$VERSION.orig.tar.xz) &
else
(cd .. ; tar ch subsurface-$VERSION | xz > home:Subsurface-Divelog/Subsurface/subsurface-$VERSION.orig.tar.xz) &
fi
fi
echo "creating source tar file for OBS and Ununtu PPA"
tar cf - . | xz > ../subsurface_$VERSION.orig.tar.xz
else
echo "using existing source tree"
cd subsurface_$VERSION
fi
echo "preparing the debian directory"
# this uses my (Dirk's) email address by default... simply set that variable in your
# environment prior to starting the script
test -z $DEBEMAIL && export DEBEMAIL=dirk@hohndel.org
# copy over the debian files and allow maintaining a release and daily changelog files
rm -rf debian
mkdir -p debian
cp -a ../../subsurface/packaging/ubuntu/debian .
# start with the bundled dummy changelog, but use our last one if it exists
test -f ../changelog$SUFFIX && cp ../changelog$SUFFIX debian/changelog
# pick a new revision number
rev=0
while [ $rev -le "99" ]
do
rev=$(($rev+1))
if [[ ! $(grep $VERSION-$rev debian/changelog) ]] ; then
break
fi
done
# we need to do this for each Ubuntu release we support - right now the oldest is 16.04/Xenial
if [[ "$GITREVISION" = "" ]] ; then
dch -v $VERSION-$rev~bionic -D bionic -M -m "Next release build - please check https://subsurface-divelog.org/category/news/ for details"
else
dch -v $VERSION-$rev~bionic -D bionic -M -m "next daily build"
fi
cp debian/changelog ../changelog$SUFFIX
debuild -S
#create builds for the newer Ubuntu releases that Launchpad supports
rel=bionic
others="eoan focal"
for next in $others
do
sed -i "s/${rel}/${next}/g" debian/changelog
debuild -S
rel=$next
done
cd ..
if [[ "$1" = "post" ]] ; then
# daily vs. release
if [[ "$GITREVISION" == "" ]] ; then
# this is a release
dput ppa:subsurface/subsurface subsurface_$VERSION-$rev~*.changes
if [[ "$OBS" = "1" ]]; then
# more stuff for OBS / SUSE / Fedora
cd home:Subsurface-Divelog/Subsurface
osc rm $(ls subsurface*.tar.xz | grep -v $VERSION)
osc add subsurface-$VERSION.orig.tar.xz
sed -i "s/%define latestVersion.*/%define latestVersion $VERSION/" subsurface.spec
sed -i "s/%define gitVersion .*/%define gitVersion 0/" subsurface.spec
osc commit -m "next release build"
fi
else
dput ppa:subsurface/subsurface-daily subsurface_$VERSION-$rev~*.changes
if [[ "$OBS" = "1" ]]; then
# more stuff for OBS / SUSE / Fedora
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
fi
|