From 3bbef05cb7890191e77b7d89c43b67ba3d669422 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Mon, 9 Nov 2026 22:00:44 -0700 Subject: [PATCH] build(packaging): the Linux packages carry the third-party notices as a file The .deb, the .rpm and the Arch tarball install THIRD-PARTY-NOTICES.txt under /usr/share/doc/wanderbooks/, where a distribution's reader looks for it; the program prints the same text (`wanderbooks licenses`), and the package test compares the two after the upgrade. The AppImage, the .dmg and the Windows program carry the text compiled in. Not checked by a package build: the first `just package-linux` and `test-linux-packages.sh` run does that. Co-Authored-By: Claude --- crates/ledger-cli/Cargo.toml | 1 + deploy/packaging/aur/PKGBUILD | 3 ++- deploy/packaging/build-linux.sh | 4 +++- deploy/packaging/packager.toml | 4 ++++ deploy/packaging/test-linux-packages.sh | 4 ++++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/crates/ledger-cli/Cargo.toml b/crates/ledger-cli/Cargo.toml index d62ee4c8..a51a1126 100644 --- a/crates/ledger-cli/Cargo.toml +++ b/crates/ledger-cli/Cargo.toml @@ -62,4 +62,5 @@ assets = [ { source = "target/release/wanderbooks", dest = "/usr/bin/wanderbooks", mode = "0755" }, { source = "deploy/packaging/install-method-rpm", dest = "/usr/share/wanderbooks/install-method", mode = "0644" }, { source = "deploy/packaging/wanderbooks-static.desktop", dest = "/usr/share/applications/wanderbooks.desktop", mode = "0644" }, + { source = "THIRD-PARTY-NOTICES.txt", dest = "/usr/share/doc/wanderbooks/THIRD-PARTY-NOTICES.txt", mode = "0644" }, ] diff --git a/deploy/packaging/aur/PKGBUILD b/deploy/packaging/aur/PKGBUILD index 5a4ae404..020b382c 100644 --- a/deploy/packaging/aur/PKGBUILD +++ b/deploy/packaging/aur/PKGBUILD @@ -13,7 +13,8 @@ depends=('gcc-libs' 'glibc') provides=('wanderbooks') conflicts=('wanderbooks') options=('!lto' '!strip') -# The tarball holds usr/bin/wanderbooks, usr/share/applications/ and +# The tarball holds usr/bin/wanderbooks, usr/share/applications/, +# usr/share/doc/wanderbooks/THIRD-PARTY-NOTICES.txt and # usr/share/wanderbooks/install-method (which makes `wanderbooks update` # refuse and send the owner to pacman). source=("wanderbooks_${pkgver}_x86_64.tar.gz::https://github.com/swaits/wanderbooks/releases/download/v${pkgver}/wanderbooks_${pkgver}_x86_64.tar.gz") diff --git a/deploy/packaging/build-linux.sh b/deploy/packaging/build-linux.sh index 26cce1b8..ea84b556 100755 --- a/deploy/packaging/build-linux.sh +++ b/deploy/packaging/build-linux.sh @@ -36,7 +36,8 @@ sed "s/^version = \".*\"/version = \"$version\"/ s#^out-dir = .*#out-dir = \"$PWD/$out\"# s#\"target/release\"#\"$PWD/$stage\"# s#\"deploy/packaging/#\"$PWD/deploy/packaging/# - s#\"LICENSE-MIT\"#\"$PWD/LICENSE-MIT\"#" \ + s#\"LICENSE-MIT\"#\"$PWD/LICENSE-MIT\"# + s#^\"THIRD-PARTY-NOTICES.txt\"#\"$PWD/THIRD-PARTY-NOTICES.txt\"#" \ deploy/packaging/packager.toml >"$config" # The AppImage tools are themselves AppImages; run them without FUSE. export APPIMAGE_EXTRACT_AND_RUN=1 @@ -45,6 +46,7 @@ assets='assets = [ { source = "'$PWD/$stage'/wanderbooks", dest = "/usr/bin/wanderbooks", mode = "0755" }, { source = "deploy/packaging/install-method-rpm", dest = "/usr/share/wanderbooks/install-method", mode = "0644" }, { source = "deploy/packaging/wanderbooks-static.desktop", dest = "/usr/share/applications/wanderbooks.desktop", mode = "0644" }, + { source = "THIRD-PARTY-NOTICES.txt", dest = "/usr/share/doc/wanderbooks/THIRD-PARTY-NOTICES.txt", mode = "0644" }, ]' cargo generate-rpm -p crates/ledger-cli --set-metadata "version=\"$version\"" --set-metadata "$assets" -o "$out/" rm -rf "$stage" diff --git a/deploy/packaging/packager.toml b/deploy/packaging/packager.toml index be918bae..0974f661 100644 --- a/deploy/packaging/packager.toml +++ b/deploy/packaging/packager.toml @@ -28,9 +28,13 @@ depends = ["libc6", "libgcc-s1"] [deb.files] "deploy/packaging/install-method-deb" = "usr/share/wanderbooks/install-method" +# The notices the third-party licences ask to travel with the program +# (`just notices`); `wanderbooks licenses` prints the same text. +"THIRD-PARTY-NOTICES.txt" = "usr/share/doc/wanderbooks/THIRD-PARTY-NOTICES.txt" [pacman] depends = ["gcc-libs", "glibc"] [pacman.files] "deploy/packaging/install-method-aur" = "usr/share/wanderbooks/install-method" +"THIRD-PARTY-NOTICES.txt" = "usr/share/doc/wanderbooks/THIRD-PARTY-NOTICES.txt" diff --git a/deploy/packaging/test-linux-packages.sh b/deploy/packaging/test-linux-packages.sh index 431b24d8..27b6daf0 100755 --- a/deploy/packaging/test-linux-packages.sh +++ b/deploy/packaging/test-linux-packages.sh @@ -51,6 +51,10 @@ test "$before" = "$after" test "$head_before" = "$(head_of)" if as_tester 'wanderbooks update' >/tmp/update.out 2>&1; then echo "update did not refuse" >&2; exit 1; fi grep -q 'package manager' /tmp/update.out +# The new package carries the third-party notices, as a file and in the +# program, and the two are the same text. +test -s /usr/share/doc/wanderbooks/THIRD-PARTY-NOTICES.txt +as_tester 'wanderbooks licenses' | tail -n +3 | cmp -s - /usr/share/doc/wanderbooks/THIRD-PARTY-NOTICES.txt as_tester 'wanderbooks close' >/dev/null 2>&1 || true echo "OK" INNER