adjust Launchpad package make script to new version logic

Also address some shellcheck issues.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2024-01-06 11:41:52 -08:00
parent 5075e7f127
commit c4cb913426

View file

@ -19,13 +19,16 @@ fi
cd subsurface
git submodule init
git submodule update
cd -
GITVERSION=$(cd subsurface ; git describe --match "v[0-9]*" --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)
GITVERSION=$(bash scripts/get-version 4)
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 -
export DEBSIGN_PROGRAM="gpg --passphrase-file passphrase_file.txt --batch --no-use-agent"
export DEBSIGN_KEYID="F58109E3"
@ -36,31 +39,31 @@ else
SUFFIX=".daily"
fi
echo "building Subsurface" $VERSION "with libdivecomputer" $LIBDCREVISION
echo "building Subsurface $GITVERSION 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 [[ ! -d $FOLDER ]]; then
mkdir "$FOLDER"
echo "copying sources"
(cd ../subsurface ; tar cf - . ) | (cd subsurface_$VERSION ; tar xf - )
cd subsurface_$VERSION;
(cd ../subsurface ; tar cf - . ) | (cd "$FOLDER" ; tar xf - )
cd "$FOLDER";
cp -a ../../googlemaps .
rm -rf .git libdivecomputer/.git googlemaps/.git build build-mobile libdivecomputer/build googlemaps/build
echo $GITVERSION > .gitversion
echo $GITDATE > .gitdate
echo $LIBDCREVISION > libdivecomputer/revision
echo "$GITVERSION" > .gitversion
echo "$GITDATE" > .gitdate
echo "$LIBDCREVISION" > libdivecomputer/revision
echo "creating source tar file for Ubuntu PPA"
tar cf - . | xz > ../subsurface_$VERSION.orig.tar.xz
tar cf - . | xz > ../"$FOLDER.orig.tar.xz"
else
echo "using existing source tree"
cd subsurface_$VERSION
cd "$FOLDER"
fi
@ -68,7 +71,7 @@ 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@subsurface-divelog.org
[[ -z $DEBEMAIL ]] && export DEBEMAIL=dirk@subsurface-divelog.org
# copy over the debian files and allow maintaining a release and daily changelog files
rm -rf debian
@ -76,23 +79,23 @@ 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
[[ -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
rev=$((rev+1))
if ! grep -q "$GITVERSION-$rev" debian/changelog ; then
break
fi
done
# we need to do this for each Ubuntu release we support - right now the oldest is 20.04/Focal
if [[ "$GITREVISION" = "" ]] ; then
dch -v $VERSION-$rev~focal -D focal -M -m "Next release build - please check https://subsurface-divelog.org/category/news/ for details"
dch -v "$GITVERSION-$rev~focal" -D focal -M -m "Next release build - please check https://subsurface-divelog.org/category/news/ for details"
else
dch -v $VERSION-$rev~focal -D focal -M -m "next daily build"
dch -v "$GITVERSION-$rev~focal" -D focal -M -m "next rolling CICD release build"
fi
cp debian/changelog ../changelog$SUFFIX
@ -119,8 +122,8 @@ if [[ "$1" = "post" ]] ; then
# daily vs. release
if [[ "$GITREVISION" == "" ]] ; then
# this is a release
dput ppa:subsurface/subsurface subsurface_$VERSION-$rev~*.changes
dput ppa:subsurface/subsurface "$FOLDER-$rev~*.changes"
else
dput ppa:subsurface/subsurface-daily subsurface_$VERSION-$rev~*.changes
dput ppa:subsurface/subsurface-daily "$FOLDER-$rev~*.changes"
fi
fi