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
|
2014-12-02 19:04:37 +00:00
|
|
|
|
2024-05-11 05:33:54 +00:00
|
|
|
GITVERSION=$(bash scripts/get-version.sh 4)
|
2024-01-06 19:41:52 +00:00
|
|
|
GITDATE=$(git log -1 --format="%at" | xargs -I{} date -d @{} +%Y-%m-%d)
|
|
|
|
LIBDCREVISION=$(cd libdivecomputer ; git rev-parse --verify HEAD)
|
|
|
|
FOLDER="subsurface_$GITVERSION"
|
|
|
|
|
|
|
|
# hardcode to 1 to mark that this is a test build, not a full release
|
|
|
|
GITREVISION=1
|
|
|
|
|
|
|
|
cd -
|
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
|
|
|
|
|
2024-01-06 19:41:52 +00:00
|
|
|
echo "building Subsurface $GITVERSION 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
|
|
|
|
|
2024-01-06 19:41:52 +00:00
|
|
|
if [[ ! -d $FOLDER ]]; then
|
|
|
|
mkdir "$FOLDER"
|
2015-04-08 20:46:01 +00:00
|
|
|
echo "copying sources"
|
2020-04-18 21:50:53 +00:00
|
|
|
|
2024-01-06 19:41:52 +00:00
|
|
|
(cd ../subsurface ; tar cf - . ) | (cd "$FOLDER" ; tar xf - )
|
|
|
|
cd "$FOLDER";
|
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
|
2024-01-06 19:41:52 +00:00
|
|
|
echo "$GITVERSION" > .gitversion
|
|
|
|
echo "$GITDATE" > .gitdate
|
|
|
|
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
|
|
|
|
2024-01-06 19:41:52 +00:00
|
|
|
tar cf - . | xz > ../"$FOLDER.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"
|
2024-01-06 19:41:52 +00:00
|
|
|
cd "$FOLDER"
|
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
|
2024-01-06 19:41:52 +00:00
|
|
|
[[ -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
|
2024-01-06 19:41:52 +00:00
|
|
|
[[ -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
|
2024-01-06 19:41:52 +00:00
|
|
|
rev=$((rev+1))
|
|
|
|
if ! grep -q "$GITVERSION-$rev" debian/changelog ; then
|
2015-01-15 21:49:52 +00:00
|
|
|
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
|
2024-01-06 19:41:52 +00:00
|
|
|
dch -v "$GITVERSION-$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
|
2024-01-06 19:41:52 +00:00
|
|
|
dch -v "$GITVERSION-$rev~focal" -D focal -M -m "next rolling CICD release 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
|
2024-06-05 15:25:57 +00:00
|
|
|
others="jammy mantic noble"
|
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 ..
|
|
|
|
|
2024-01-28 00:28:15 +00:00
|
|
|
if [[ "$1" = "current" ]] ; then
|
|
|
|
# this is a current release
|
|
|
|
dput ppa:subsurface/subsurface "$FOLDER-$rev"~*.changes
|
|
|
|
else
|
|
|
|
dput ppa:subsurface/subsurface-daily "$FOLDER-$rev"~*.changes
|
2014-12-23 04:26:09 +00:00
|
|
|
fi
|