spiegel-keyman/linux/scripts/launchpad.sh
Eberhard Beilharz 2c8f878f1d
chore(linux): add verification for source tarball and source package
This change adds a new GitHub action that verifies that Keyman can build
from the source package. Also check that source package used for Launchpad
and Debian/Ubuntu packaging doesn't produce lintian errors. Previously
lintian errors did go unnoticed because they didn't stop the build.

Also refactor `launchpad.sh` script to be a proper builder script, and add
some new parameters to allow skipping some steps in the script.

Build-bot: skip
Test-bot: skip
2026-05-06 19:03:12 +02:00

91 lines
2.9 KiB
Bash
Executable file

#!/usr/bin/env bash
# Build source packages from nightly builds and upload to PPA
## START STANDARD BUILD SCRIPT INCLUDE
# adjust relative paths as necessary
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
# shellcheck source=resources/build/builder-full.inc.sh
. "${THIS_SCRIPT%/*}/../../resources/build/builder-full.inc.sh"
## END STANDARD BUILD SCRIPT INCLUDE
# shellcheck source=linux/scripts/package-build.inc.sh
. "$(dirname "${THIS_SCRIPT}")/package-build.inc.sh"
builder_describe \
"Build source packages from nightly builds and upload to PPA" \
build \
"--no-download Don't download source. Assume keyman-<version> exists as subdirectory of current dir." \
"--upload Upload to launchpad. If omitted only simulate the upload." \
"--no-upload Don't upload to launchpad, don't even simulate it." \
"--no-lintian Don't run lintian while creating soure package." \
"--project=PROJECT Only upload this project. Default: keyman" \
"--dist=DIST Only upload this distribution. Default: upload all supported dists." \
"--packageversion=PACKAGEVERSION String to append to the package version. Default: '1~sil1'." \
"--outputdir=OUTPUTDIR Directory for resulting artifacts. Default: \$KEYMAN_ROOT/linux/launchpad."
builder_parse "$@"
cd "${KEYMAN_ROOT}/linux"
checkPrerequisites
if [[ -z "${OUTPUTDIR:-}" ]]; then
OUTPUTDIR="${KEYMAN_ROOT}/linux/launchpad"
fi
if builder_has_option --upload; then
SIM=""
else
SIM="-s"
fi
if builder_has_option --no-lintian; then
LINTIAN_OPTS="--no-lintian"
else
LINTIAN_OPTS=""
fi
if [[ "${KEYMAN_TIER}" == "stable" ]]; then
ppa="ppa:keymanapp/keyman"
elif [[ "${KEYMAN_TIER}" == "beta" ]]; then
ppa="ppa:keymanapp/keyman-beta"
else
ppa="ppa:keymanapp/keyman-alpha"
fi
echo "ppa: ${ppa}"
distributions="${DIST:-jammy noble questing resolute}"
packageversion="${PACKAGEVERSION:-1~sil1}"
if ! builder_has_option --no-download; then
rm -rf launchpad
mkdir -p launchpad
fi
for proj in ${projects:-}; do
if ! builder_has_option --no-download; then
downloadSource launchpad
else
version=$(cat "${KEYMAN_ROOT}/VERSION.md")
cd "${OUTPUTDIR}"
fi
cd "${proj}-${version:-}"
pwd
cp debian/changelog "../${proj}-changelog"
for dist in ${distributions}; do
cp "../${proj}-changelog" debian/changelog
dch -v "${version}-${packageversion}~${dist}" "source package for PPA"
dch -D "${dist}" -r ""
# shellcheck disable=SC2248 # no quotes for $LINTIAN_OPTS - might be empty string
debuild ${LINTIAN_OPTS} -d -S -sa -Zxz
done
if ! builder_has_option --no-upload; then
cd ..
for dist in ${distributions}; do
# shellcheck disable=SC2248 # no quotes for $SIM - it might not be set
dput ${SIM:-} "${ppa}" "${proj}_${version}-${packageversion}~${dist}_source.changes"
done
fi
cd "${KEYMAN_ROOT}/linux"
done