2016-08-17 19:36:50 +00:00
|
|
|
#!/bin/bash -e
|
2020-04-18 21:50:53 +00:00
|
|
|
# start from the directory above the subsurface directory
|
2015-04-08 20:46:01 +00:00
|
|
|
#
|
2020-04-18 21:50:53 +00:00
|
|
|
# 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
|
2015-04-08 20:46:01 +00:00
|
|
|
#
|
2020-04-18 21:50:53 +00:00
|
|
|
|
2023-12-04 03:14:54 +00:00
|
|
|
if [[ ! -d subsurface || ! -d subsurface/libdivecomputer ]] ; then
|
2014-12-02 19:04:37 +00:00
|
|
|
echo "Please start this script from the folder ABOVE the subsurface source directory"
|
|
|
|
exit 1;
|
|
|
|
fi
|
2020-04-18 21:50:53 +00:00
|
|
|
if [[ ! -d googlemaps ]] ; then
|
2022-03-15 20:49:10 +00:00
|
|
|
echo "Please make sure you have the current master of https://github.com/Subsurface/googlemaps"
|
2020-04-18 21:50:53 +00:00
|
|
|
echo "checked out in parallel to the Subsurface directory"
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ensure that the libdivecomputer module is there and current
|
|
|
|
cd subsurface
|
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
cd -
|
2014-12-02 19:04:37 +00:00
|
|
|
|
2023-12-07 12:00:32 +00:00
|
|
|
GITVERSION=$(cd subsurface ; git describe --match "v[0-9]*" --abbrev=12 | sed -e 's/-g.*$// ; s/^v//')
|
2014-12-23 04:26:09 +00:00
|
|
|
GITREVISION=$(echo $GITVERSION | sed -e 's/.*-// ; s/.*\..*//')
|
2014-12-02 23:26:43 +00:00
|
|
|
VERSION=$(echo $GITVERSION | sed -e 's/-/./')
|
2018-09-20 13:12:51 +00:00
|
|
|
GITDATE=$(cd subsurface ; git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d)
|
2014-12-12 18:58:20 +00:00
|
|
|
LIBDCREVISION=$(cd subsurface/libdivecomputer ; git rev-parse --verify HEAD)
|
2014-12-23 04:26:09 +00:00
|
|
|
|
2023-12-04 03:14:54 +00:00
|
|
|
export DEBSIGN_PROGRAM="gpg --passphrase-file passphrase_file.txt --batch --no-use-agent"
|
|
|
|
export DEBSIGN_KEYID="F58109E3"
|
|
|
|
|
2020-04-18 21:50:53 +00:00
|
|
|
if [[ "$GITVERSION" = "" ]] ; then
|
|
|
|
SUFFIX=".release"
|
|
|
|
else
|
|
|
|
SUFFIX=".daily"
|
|
|
|
fi
|
|
|
|
|
2014-12-12 18:58:20 +00:00
|
|
|
echo "building Subsurface" $VERSION "with libdivecomputer" $LIBDCREVISION
|
2020-04-18 21:50:53 +00:00
|
|
|
|
|
|
|
# we put all of the files into the distrobuilds directory in order not to clutter the 'src' directory
|
|
|
|
mkdir -p distrobuilds
|
|
|
|
cd distrobuilds
|
|
|
|
|
2015-04-08 20:46:01 +00:00
|
|
|
if [[ ! -d subsurface_$VERSION ]]; then
|
|
|
|
mkdir subsurface_$VERSION
|
|
|
|
echo "copying sources"
|
2020-04-18 21:50:53 +00:00
|
|
|
|
|
|
|
(cd ../subsurface ; tar cf - . ) | (cd subsurface_$VERSION ; tar xf - )
|
2015-04-08 20:46:01 +00:00
|
|
|
cd subsurface_$VERSION;
|
2020-04-18 21:50:53 +00:00
|
|
|
cp -a ../../googlemaps .
|
2023-12-04 01:44:55 +00:00
|
|
|
|
|
|
|
rm -rf .git libdivecomputer/.git googlemaps/.git build build-mobile libdivecomputer/build googlemaps/build
|
2015-04-08 20:46:01 +00:00
|
|
|
echo $GITVERSION > .gitversion
|
2018-09-20 13:12:51 +00:00
|
|
|
echo $GITDATE > .gitdate
|
2015-04-08 20:46:01 +00:00
|
|
|
echo $LIBDCREVISION > libdivecomputer/revision
|
2020-04-18 21:50:53 +00:00
|
|
|
|
2020-04-19 03:28:38 +00:00
|
|
|
echo "creating source tar file for Ubuntu PPA"
|
2020-04-18 21:50:53 +00:00
|
|
|
|
2015-04-08 20:46:01 +00:00
|
|
|
tar cf - . | xz > ../subsurface_$VERSION.orig.tar.xz
|
2015-01-23 22:13:22 +00:00
|
|
|
else
|
2015-04-08 20:46:01 +00:00
|
|
|
echo "using existing source tree"
|
|
|
|
cd subsurface_$VERSION
|
2015-01-23 22:13:22 +00:00
|
|
|
fi
|
2020-04-18 21:50:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2023-12-04 03:14:54 +00:00
|
|
|
test -z $DEBEMAIL && export DEBEMAIL=dirk@subsurface-divelog.org
|
2020-04-18 21:50:53 +00:00
|
|
|
|
|
|
|
# copy over the debian files and allow maintaining a release and daily changelog files
|
2015-04-08 20:46:01 +00:00
|
|
|
rm -rf debian
|
2014-12-15 16:24:51 +00:00
|
|
|
mkdir -p debian
|
2020-04-18 21:50:53 +00:00
|
|
|
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
|
2014-12-15 16:24:51 +00:00
|
|
|
|
2020-04-18 21:50:53 +00:00
|
|
|
# pick a new revision number
|
2015-01-15 21:49:52 +00:00
|
|
|
rev=0
|
|
|
|
while [ $rev -le "99" ]
|
|
|
|
do
|
|
|
|
rev=$(($rev+1))
|
|
|
|
if [[ ! $(grep $VERSION-$rev debian/changelog) ]] ; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2020-04-18 21:50:53 +00:00
|
|
|
|
2023-09-26 19:46:59 +00:00
|
|
|
# we need to do this for each Ubuntu release we support - right now the oldest is 20.04/Focal
|
2020-04-18 21:50:53 +00:00
|
|
|
if [[ "$GITREVISION" = "" ]] ; then
|
2023-09-26 19:46:59 +00:00
|
|
|
dch -v $VERSION-$rev~focal -D focal -M -m "Next release build - please check https://subsurface-divelog.org/category/news/ for details"
|
2018-04-29 22:48:43 +00:00
|
|
|
else
|
2023-09-26 19:46:59 +00:00
|
|
|
dch -v $VERSION-$rev~focal -D focal -M -m "next daily build"
|
2018-04-29 22:48:43 +00:00
|
|
|
fi
|
2020-04-18 21:50:53 +00:00
|
|
|
|
|
|
|
cp debian/changelog ../changelog$SUFFIX
|
2014-12-02 00:00:47 +00:00
|
|
|
|
2021-02-17 17:05:56 +00:00
|
|
|
debuild -S -d
|
2014-12-02 00:00:47 +00:00
|
|
|
|
2021-05-07 18:48:28 +00:00
|
|
|
# create builds for the newer Ubuntu releases that Launchpad supports
|
|
|
|
#
|
2023-09-26 15:34:46 +00:00
|
|
|
rel=focal
|
|
|
|
others="jammy lunar mantic"
|
2016-11-15 11:52:13 +00:00
|
|
|
for next in $others
|
|
|
|
do
|
|
|
|
sed -i "s/${rel}/${next}/g" debian/changelog
|
2021-02-17 17:05:56 +00:00
|
|
|
debuild -S -d
|
2016-11-15 11:52:13 +00:00
|
|
|
rel=$next
|
|
|
|
done
|
2021-05-07 18:48:28 +00:00
|
|
|
if [ -f debian/control.bak ] ; then
|
|
|
|
mv debian/control.bak debian/control
|
|
|
|
fi
|
2016-11-12 05:06:35 +00:00
|
|
|
|
2014-12-23 04:26:09 +00:00
|
|
|
cd ..
|
|
|
|
|
2020-04-18 21:50:53 +00:00
|
|
|
if [[ "$1" = "post" ]] ; then
|
|
|
|
# daily vs. release
|
|
|
|
if [[ "$GITREVISION" == "" ]] ; then
|
|
|
|
# this is a release
|
|
|
|
dput ppa:subsurface/subsurface subsurface_$VERSION-$rev~*.changes
|
2015-01-23 22:13:22 +00:00
|
|
|
else
|
|
|
|
dput ppa:subsurface/subsurface-daily subsurface_$VERSION-$rev~*.changes
|
|
|
|
fi
|
2014-12-23 04:26:09 +00:00
|
|
|
fi
|