QOwnNotes/ubuntu-launchpad/build-for-launchpad.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

118 lines
2.9 KiB
Bash
Raw Normal View History

2016-01-01 11:59:48 +01:00
#!/usr/bin/env bash
2016-01-01 07:38:07 +01:00
#
# This is the build script for Ubuntu Launchpad
# https://launchpad.net/~pbek/+archive/ubuntu/qownnotes
#
# We will need some packages to execute this locally:
# sudo apt-get install build-essential autoconf automake autotools-dev dh-make debhelper devscripts fakeroot xutils lintian pbuilder cdbs gnupg
2016-01-01 07:38:07 +01:00
#
2016-01-01 11:59:48 +01:00
# Also a ~/.dput.cf has to be in place
2016-01-01 07:38:07 +01:00
#
2015-12-30 13:09:58 +01:00
2015-12-31 09:58:46 +01:00
# uncomment this if you want to force a version
#QOWNNOTES_VERSION=23.3.0.1
2015-12-31 09:58:46 +01:00
BRANCH=main
#BRANCH=release
2020-11-08 09:20:00 +01:00
# https://wiki.ubuntu.com/Releases
UBUNTU_RELEASES=("bionic" "focal" "jammy" "noble" "oracular")
2015-12-30 13:09:58 +01:00
DATE=$(LC_ALL=C date +'%a, %d %b %Y %T %z')
2015-12-31 09:58:46 +01:00
PROJECT_PATH="/tmp/QOwnNotes-$$"
2015-12-30 13:09:58 +01:00
UPLOAD="true"
DEBUILD_ARGS=""
2020-08-13 18:42:35 +02:00
SIGNING_EMAIL=patrizio@bekerle.com
2015-12-30 13:09:58 +01:00
export DEBFULLNAME="Patrizio Bekerle"
export DEBEMAIL="patrizio@bekerle.com"
while test $# -gt 0; do
case "$1" in
--no-upload)
UPLOAD="false"
;;
--no-orig-tar-upload)
DEBUILD_ARGS="-sd"
;;
esac
shift
2015-12-30 13:09:58 +01:00
done
echo "Started the debian source packaging process, using latest '$BRANCH' git tree"
2015-12-31 09:58:46 +01:00
if [ -d $PROJECT_PATH ]; then
rm -rf $PROJECT_PATH
2015-12-30 13:09:58 +01:00
fi
# checkout the source code
git clone --depth=1 git@github.com:pbek/QOwnNotes.git $PROJECT_PATH -b $BRANCH
2020-06-04 18:27:40 +02:00
cd $PROJECT_PATH || exit 1
2015-12-31 09:58:46 +01:00
2016-01-12 20:03:22 +01:00
# checkout submodules
2016-01-30 11:06:53 +01:00
git submodule update --init
2016-01-12 20:03:22 +01:00
# build binary translation files
lrelease src/QOwnNotes.pro
2015-12-31 09:58:46 +01:00
if [ -z $QOWNNOTES_VERSION ]; then
# get version from version.h
QOWNNOTES_VERSION=$(cat src/version.h | sed "s/[^0-9,.]//g")
2015-12-31 09:58:46 +01:00
else
# set new version if we want to override it
echo "#define VERSION \"$QOWNNOTES_VERSION\"" >src/version.h
2015-12-31 09:58:46 +01:00
fi
2015-12-30 13:09:58 +01:00
2016-01-02 10:48:43 +01:00
# set release string to disable the update check
echo '#define RELEASE "Launchpad PPA"' >src/release.h
2016-01-02 10:48:43 +01:00
2016-01-31 16:54:43 +01:00
changelogText="Released version $QOWNNOTES_VERSION"
2015-12-31 12:00:26 +01:00
2016-01-01 11:59:48 +01:00
echo "Using version $QOWNNOTES_VERSION..."
2015-12-30 13:09:58 +01:00
2016-01-02 10:48:43 +01:00
qownnotesSrcDir="qownnotes_${QOWNNOTES_VERSION}"
# copy the src directory
cp -R src $qownnotesSrcDir
# archive the source code
tar -czf $qownnotesSrcDir.orig.tar.gz $qownnotesSrcDir
changelogPath=debian/changelog
2024-02-08 19:51:45 +01:00
# check if the signing key is available
gpg --list-secret-keys
2016-01-02 10:48:43 +01:00
2016-01-01 11:59:48 +01:00
# build for every Ubuntu release
for ubuntuRelease in "${UBUNTU_RELEASES[@]}"; do
:
echo "Building for $ubuntuRelease..."
cd $qownnotesSrcDir || exit 1
versionPart="$QOWNNOTES_VERSION-1ubuntu3ppa1~${ubuntuRelease}1"
# update the changelog file
#dch -v $versionPart $changelogText
#dch -r $changelogText
# create the changelog file
echo "qownnotes ($versionPart) $ubuntuRelease; urgency=low" >$changelogPath
echo "" >>$changelogPath
echo " * $changelogText" >>$changelogPath
echo "" >>$changelogPath
echo " -- $DEBFULLNAME <$DEBEMAIL> $DATE" >>$changelogPath
# launch debuild
debuild -S -sa -k$SIGNING_EMAIL $DEBUILD_ARGS
cd ..
# send to launchpad
if [ "$UPLOAD" = "true" ]; then
dput ppa:pbek/qownnotes qownnotes_${versionPart}_source.changes
fi
2016-01-01 11:59:48 +01:00
done
2015-12-30 13:09:58 +01:00
2016-01-01 07:42:14 +01:00
# remove everything after we are done
2016-01-02 10:48:43 +01:00
if [ -d $PROJECT_PATH ]; then
rm -rf $PROJECT_PATH
2016-01-02 10:48:43 +01:00
fi