Deb pkg fixes (#288)

Various Debian packaging fixes and improvements: (note: depends on a fork of cargo deb as some cargo deb PRs are still pending)
  - Fix: Krill will now be restarted when the package is upgraded (also when upgrading from v0.7.0/v0.7.1/v0.7.2/v0.7.3 packages) (fixes #280).
  - Fix: systemd warning after apt remove (fixes #275).
  - Fix: Lintian error "manpage-not-compressed" (via cargo deb PR 133).
  - Fix: Lintian error "debian-changelog-file-missing" (via cargo deb PR 137). Note: the changelog is only a minimal pointer to the GitHub release notes, attributed to the user doing the pull requestor or merge to master.
  - Fix: Lintian error "copyright-without-copyright-notice".
  - Fix: Cargo Deb "warning: extended-description field missing" (via cargo deb PR 138).
  - Fix: Incorrect systemd unit "vendor preset: enabled" (via PR 276).
  - Fix: Remove unused /etc/krill directory created by the "ConfigurationDirectory" systemd unit key.
Also:
  - Use debhelper dh_installsystemd style support for systemd unit installation (based on official Debian debhelper dh_installsystemd autoscripts & logic) instead of incomplete/erroneous hand crafted maintainer scripts (via cargo deb PR 135).
  - Uses systemd unit masking on package removal as recommended (see PR 276).
  - Enables bash echo output for pkg workflow run steps.
  - Verfies built deb packages with Lintian.
  - Less repetition in Cargo.toml.
This commit is contained in:
ximon18
2020-07-30 09:25:03 +02:00
committed by GitHub
parent b2ded8873f
commit e40131aaea
12 changed files with 66 additions and 70 deletions
+25 -6
View File
@@ -45,6 +45,11 @@ on:
- 'README.md'
- 'tests/e2e/**'
defaults:
run:
# see: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
shell: bash --noprofile --norc -eo pipefail -x {0}
jobs:
# Use the cargo-deb Rust create to build a Debian package for installing
# Krill. See: https://github.com/mmstick/cargo-deb
@@ -59,7 +64,7 @@ jobs:
"debian:10",
]
env:
CARGO_DEB_VER: 1.23.1
CARGO_DEB_VER: 05545d4
# A Krill version of the form 'x.y.z-plus' denotes a dev build that is
# newer than the released x.y.z version but is not yet a new release.
NEXT_VER_LABEL: plus
@@ -99,7 +104,7 @@ jobs:
- name: Install compilation and other dependencies
run: |
apt-get install -y build-essential jq libssl-dev lintian pkg-config
apt-get install -y build-essential jq libssl-dev lintian pkg-config
env:
DEBIAN_FRONTEND: noninteractive
@@ -127,7 +132,7 @@ jobs:
- name: Install Cargo Deb
if: steps.cache-cargo-deb.outputs.cache-hit != 'true'
run: |
cargo install cargo-deb --version=$CARGO_DEB_VER
cargo install --git https://github.com/ximon18/cargo-deb.git --branch dh_installsystemd_and_changelog_fix --rev $CARGO_DEB_VER cargo-deb
# Instruct cargo-deb to build the Debian package using the config section
# in Cargo.toml for the specified "variant".
@@ -160,7 +165,7 @@ jobs:
# to. In this case we do NOT want dash '-' to become '~' because `-`
# is treated as higher and tilda is treated as lower.
KRILL_VER=$(cargo read-manifest | jq -r '.version' | tr '-' '~')
KRILL_VER=$(echo $KRILL_VER | sed -e "s/~$NEXT_VER_LABEL/-$NEXT_VER_LABEL/")
DEB_KRILL_VER=$(echo $KRILL_VER | sed -e "s/~$NEXT_VER_LABEL/-$NEXT_VER_LABEL/")
case ${MATRIX_IMAGE} in
ubuntu:16.04) OS_REL=xenial ;;
ubuntu:18.04) OS_REL=bionic ;;
@@ -169,7 +174,20 @@ jobs:
debian:10) OS_REL=buster ;;
*) echo 2>&1 "ERROR: Unexpected matrix image"; exit 1 ;;
esac
DEB_VER="${KRILL_VER}-1${OS_REL}"
case ${{ github.event_name }} in
pull_request) MAINTAINER="${{ github.actor }} <unknown@email.address>" ;;
push) MAINTAINER="${{ github.event.pusher.name }} <${{ github.event.pusher.email }}>" ;;
*) echo 2>&1 "ERROR: Unexpected GitHub Actions event"; exit 1 ;;
esac
# Generate the changelog file that Debian packages are required to have.
# See: https://www.debian.org/doc/manuals/maint-guide/dreq.en.html#changelog
echo "krill (${DEB_KRILL_VER}) unstable; urgency=medium" >debian/changelog
echo " * See: https://github.com/NLnetLabs/krill/releases/tag/v${KRILL_VER}" >>debian/changelog
echo " -- maintainer ${MAINTAINER} $(date --rfc-email)" >>debian/changelog
DEB_VER="${DEB_KRILL_VER}-1${OS_REL}"
cargo deb --variant $DEB_NAME --deb-version $DEB_VER -v
env:
MATRIX_IMAGE: ${{ matrix.image }}
@@ -179,7 +197,7 @@ jobs:
# Policy) say they should be compressed.
- name: Verify the DEB package
run: |
lintian -v target/debian/*.deb || true
lintian -v target/debian/*.deb
# Upload the produced DEB package. The artifact will be available
# via the GH Actions job summary and build log pages, but only to
@@ -253,6 +271,7 @@ jobs:
- name: Launch LXC container
run: |
# security.nesting=true is needed to avoid error "Failed to set up mount
# namespacing: Permission denied" in a Debian 10 container.
sg lxd -c "lxc launch $LXC_IMAGE -c security.nesting=true testcon"