From 66fb5b278a5d5dec57258334c330e38a5af89810 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Mon, 8 Feb 2021 20:39:20 -0500 Subject: [PATCH] move debsign to release not build --- MANIFEST.in | 2 ++ bin/build_deb.sh | 13 +------------ bin/release_deb.sh | 31 ++++++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index c9ae1535..f33f160f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,3 +2,5 @@ graft archivebox global-exclude .DS_Store global-exclude __pycache__ global-exclude *.pyc + +prune tests/ diff --git a/bin/build_deb.sh b/bin/build_deb.sh index b9279369..3365a4e2 100755 --- a/bin/build_deb.sh +++ b/bin/build_deb.sh @@ -28,28 +28,17 @@ fi VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")" DEBIAN_VERSION="1" -PGP_KEY_ID="7D5695D3B618872647861D51C38137A7C1675988" -# make sure you have this in ~/.dput.cf: -# [archivebox-ppa] -# fqdn: ppa.launchpad.net -# method: ftp -# incoming: ~archivebox/ubuntu/archivebox/ -# login: anonymous -# allow_unsigned_uploads: 0 +# make sure the stdeb.cfg file is up-to-date with all the dependencies # cleanup build artifacts rm -Rf build deb_dist dist archivebox-*.tar.gz -# make sure the stdeb.cfg file is up-to-date with all the dependencies # build source and binary packages python3 setup.py --command-packages=stdeb.command \ sdist_dsc --debian-version=$DEBIAN_VERSION \ bdist_deb -# sign the build with your PGP key ID -debsign -k "$PGP_KEY_ID" "deb_dist/archivebox_${VERSION}-${DEBIAN_VERSION}_source.changes" - # push the build to launchpad ppa # dput archivebox "deb_dist/archivebox_${VERSION}-${DEBIAN_VERSION}_source.changes" diff --git a/bin/release_deb.sh b/bin/release_deb.sh index dc1bff35..37c7bd98 100755 --- a/bin/release_deb.sh +++ b/bin/release_deb.sh @@ -10,11 +10,40 @@ set -o nounset set -o pipefail IFS=$'\n' +PGP_KEY_ID="${PGP_KEY_ID:-7D5695D3B618872647861D51C38137A7C1675988}" + + REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )" VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")" -SHORT_VERSION="$(echo "$VERSION" | perl -pe 's/(\d+)\.(\d+)\.(\d+)/$1.$2/g')" cd "$REPO_DIR" +CURRENT_PLAFORM="$(uname)" +REQUIRED_PLATFORM="Linux" +if [[ "$CURRENT_PLAFORM" != "$REQUIRED_PLATFORM" ]]; then + echo "[!] Skipping the Debian package build on $CURRENT_PLAFORM (it can only be run on $REQUIRED_PLATFORM)." + exit 0 +fi + + +[[ "$PGP_PUBLIC_KEY" ]] && echo "$PGP_PUBLIC_KEY" > /tmp/archivebox_gpg.key.pub +[[ "$PGP_PRIVATE_KEY" ]] && echo "$PGP_PRIVATE_KEY" > /tmp/archivebox_gpg.key + +echo "[+] Loading PGP keys from env vars and filesystem..." +gpg --import /tmp/archivebox_gpg.key.pub || true +gpg --import --allow-secret-key-import /tmp/archivebox_gpg.key || true + + +echo "[*] Signing build and changelog with PGP..." +debsign -k "$PGP_KEY_ID" "deb_dist/archivebox_${VERSION}-${DEBIAN_VERSION}_source.changes" + +# make sure you have this in ~/.dput.cf: +# [archivebox-ppa] +# fqdn: ppa.launchpad.net +# method: ftp +# incoming: ~archivebox/ubuntu/archivebox/ +# login: anonymous +# allow_unsigned_uploads: 0 + echo "[^] Uploading to launchpad.net" dput archivebox "deb_dist/archivebox_${VERSION}-1_source.changes"