The Linux half of the packaging trial, run on this machine and in Debian, Fedora and Arch containers, and the recipes it produced (docs/packaging.md holds the table and what it found): - mise.toml pins cargo-packager 0.11.8 and cargo-generate-rpm 0.21.1, now that `just package-linux` calls them. cargo-packager-updater is a library, not a tool, so it is not pinned (update.rs does the checking with minisign-verify, which is what the updater uses). - deploy/packaging/: packager.toml (.deb, AppImage, the pacman tarball and its PKGBUILD), the rpm table in crates/ledger-cli/Cargo.toml, the AUR's own PKGBUILD (repacks the release tarball), build-linux.sh, repo-indexes.sh (the apt and dnf indexes, unsigned until the signing step), local-release.sh (a throwaway-keyed feed to try `update`), test-linux-packages.sh (linux_packages_install_and_upgrade: install 0.1.0, open books as an ordinary user, upgrade to 0.1.1, check the host restarted onto the new file, the books' last journal line unchanged and `update` refuses; passes on Debian trixie, Fedora and Arch). A package marks itself package-managed with share/wanderbooks/install-method. - The icon is a placeholder square (the AppImage cannot be built without one). - .github/workflows/release.yml: on a version tag, build on ubuntu-24.04 (the oldest glibc the packages claim: a program linked on this machine needs GLIBC_2.43 and does not start on Debian 13), attach the packages to the release, and add them to the apt and dnf repositories on gh-pages. No signing and no macOS or Windows job yet. - The release profile strips symbols. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
52 lines
2.6 KiB
Bash
Executable File
52 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# The Linux packages (P11a step 3), from the release program already built
|
|
# at target/release/wanderbooks (`cargo build --release -p ledger-cli`).
|
|
#
|
|
# build-linux.sh [VERSION] [FORMATS]
|
|
#
|
|
# Puts into target/packages/VERSION/: the .deb, the AppImage and the
|
|
# pacman tarball with its PKGBUILD (cargo-packager), and the .rpm
|
|
# (cargo-generate-rpm). VERSION defaults to the program's own; a different
|
|
# one repackages the same program under that version, which is how the
|
|
# install-and-upgrade test gets its second release. FORMATS is
|
|
# cargo-packager's list (default deb,appimage,pacman); the .rpm is always
|
|
# built. Run from the repository root.
|
|
#
|
|
# The program is target/release/wanderbooks, or the file WB_PROGRAM names:
|
|
# a package must run on the oldest system it claims, and a program linked
|
|
# on a newer one (this machine's glibc) fails there with "GLIBC_2.43 not
|
|
# found". CI builds on ubuntu-24.04; `just test-linux-packages` builds in a
|
|
# Debian trixie container.
|
|
set -euo pipefail
|
|
own=$(sed -n 's/^version = "\(.*\)"/\1/p' crates/ledger-cli/Cargo.toml | head -n1)
|
|
version=${1:-$own}
|
|
formats=${2:-deb,appimage,pacman}
|
|
out="target/packages/$version"
|
|
program=${WB_PROGRAM:-target/release/wanderbooks}
|
|
test -x "$program" || { echo "build the release program first: cargo build --release -p ledger-cli" >&2; exit 1; }
|
|
rm -rf "$out"; mkdir -p "$out"
|
|
stage="target/packages/.stage-$version"
|
|
rm -rf "$stage"; mkdir -p "$stage"
|
|
cp "$program" "$stage/wanderbooks"
|
|
config=$(mktemp --suffix=.toml)
|
|
trap 'rm -f "$config"' EXIT
|
|
# cargo-packager reads paths relative to the config file, which is in /tmp
|
|
# here, so they are made absolute.
|
|
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\"#" \
|
|
deploy/packaging/packager.toml >"$config"
|
|
# The AppImage tools are themselves AppImages; run them without FUSE.
|
|
export APPIMAGE_EXTRACT_AND_RUN=1
|
|
cargo packager --config "$config" --formats "$formats" --release
|
|
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" },
|
|
]'
|
|
cargo generate-rpm -p crates/ledger-cli --set-metadata "version=\"$version\"" --set-metadata "$assets" -o "$out/"
|
|
rm -rf "$stage"
|
|
ls -l "$out"
|