From 9a6a7824a009e1fb1f97afd227181191bc10f0a6 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Mon, 22 Feb 2021 02:43:48 +0100 Subject: Fix `./test --deb`. The staging environment wasn't set properly for the Debian packages. --- test | 30 ++++++++++++++++++------------ tests/old-accountd | 3 ++- tests/old-lacme | 4 ++-- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/test b/test index dc80751..81d910c 100755 --- a/test +++ b/test @@ -75,21 +75,10 @@ if [ "$MODE" = "deb" ]; then DISTRIBUTION="$(dpkg-parsechangelog -S Distribution)" [ "$DISTRIBUTION" != "UNRELEASED" ] || DISTRIBUTION="sid" PKG_DESTDIR="${XDG_CACHE_HOME:-"$HOME/.cache"}/build-area" -elif [ "$MODE" = "dev" ]; then - make all -- \ - BUILDDIR="$BUILDDIR" \ - DESTDIR="" \ - exec_prefix="/usr" \ - datadir="/usr/share" \ - runstatedir="/run" \ - lacme_www_user=_lacme-www \ - lacme_www_group=nogroup \ - lacme_client_user=_lacme-client \ - lacme_client_group=nogroup \ - acmeapi_server="https://acme-staging-v02.api.letsencrypt.org/directory" fi ACCOUNT_KEY="$BUILDDIR/account.key" +mkdir -pv -- "$BUILDDIR" if [ ! -f "$ACCOUNT_KEY" ]; then # keep the account key (up to `make clean`) to avoid hitting # rate-liming -- currently 50 registrations per 3h per IP, see @@ -115,6 +104,20 @@ run() { exit 1 fi + # Don't need to rebuild for each test, but editing the code at the + # same time might cause `make install` to rebuild a wrong version + make all -- \ + BUILDDIR="$BUILDDIR" \ + DESTDIR="" \ + exec_prefix="/usr" \ + datadir="/usr/share" \ + runstatedir="/run" \ + lacme_www_user=_lacme-www \ + lacme_www_group=nogroup \ + lacme_client_user=_lacme-client \ + lacme_client_group=nogroup \ + acmeapi_server="https://acme-staging-v02.api.letsencrypt.org/directory" + CHROOT="$(schroot -c "$DISTRIBUTION-$ARCH-sbuild" -b)" rootdir="/run/schroot/mount/$CHROOT" @@ -163,6 +166,9 @@ run() { sudo install -oroot -groot -m0644 -vt "$rootdir/usr/share/lacme" certs-staging/*.pem sudo install -oroot -groot -m0644 -vT "$BUILDDIR/certs-staging/ca-certificates.crt" \ "$rootdir/usr/share/lacme/ca-certificates.crt" + sudo schroot -d"/" -c "$CHROOT" -r -- \ + sed -ri '0,/^#?server\s*=.*/ {s||server = https://acme-staging-v02.api.letsencrypt.org/directory|}' \ + /etc/lacme/lacme.conf # install account key and configure lacme accordingly sudo install -oroot -groot -m0600 -vT -- "$BUILDDIR/account.key" \ diff --git a/tests/old-accountd b/tests/old-accountd index e7ccc0a..b44f7ec 100644 --- a/tests/old-accountd +++ b/tests/old-accountd @@ -14,7 +14,8 @@ EOF echo "deb http://deb.debian.org/debian stretch main" >>/etc/apt/sources.list DEBIAN_FRONTEND="noninteractive" apt update -DEBIAN_FRONTEND="noninteractive" apt install -y --no-install-recommends --reinstall \ +DEBIAN_FRONTEND="noninteractive" apt install -y --no-install-recommends \ + --reinstall --allow-downgrades \ -oDPkg::Options::="--force-confdef" -oDPkg::Options::="--force-overwrite" \ lacme-accountd/stretch diff --git a/tests/old-lacme b/tests/old-lacme index 16a647d..fa7d827 100644 --- a/tests/old-lacme +++ b/tests/old-lacme @@ -16,12 +16,12 @@ EOF echo "deb http://deb.debian.org/debian buster main" >>/etc/apt/sources.list DEBIAN_FRONTEND="noninteractive" apt update -DEBIAN_FRONTEND="noninteractive" apt install -y --no-install-recommends --reinstall \ +DEBIAN_FRONTEND="noninteractive" apt install -y --no-install-recommends \ + --reinstall --allow-downgrades \ -oDPkg::Options::="--force-confdef" -oDPkg::Options::="--force-overwrite" \ lacme/buster # restore staging environment -sed -ri '0,\|^#?server\s*=.*| {s||server = https://acme-staging-v02.api.letsencrypt.org/directory|}' /etc/lacme/lacme.conf mv -f /usr/share/lacme/ca-certificates.crt.back /usr/share/lacme/ca-certificates.crt SOCKET=~lacme-account/S.lacme -- cgit v1.2.3