From 4f4741cee53c6545cf27d1506c90c8b7505bc6aa Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Thu, 20 Aug 2026 22:26:35 +0200 Subject: [PATCH] fix(release): stamp the Arch package version, and ship the licence with it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pkgver sat at 0.0.18 while the tree was on 0.8.x, because the Arch package is built by makepkg rather than the tauri bundler and set-version.sh never touched it. makepkg produced a package whose version bore no relation to the source it was built from — the exact failure that script exists to prevent, in the one file it had missed. Dev versions are converted to a pkgver Arch accepts: a hyphen separates pkgver from pkgrel, so 0.9.0-3-gabc1234 becomes 0.9.0.r3.gabc1234. pkgrel resets to 1, since a new upstream version restarts its packaging revisions. Also installs LICENSE into /usr/share/licenses — MIT is not in Arch's common licences, so a package under it has to carry the text. Arch is not part of the automated release (build-release.yml covers linux, windows and android), so v0.9.0 is unaffected; this applies to anyone building the package by hand. --- packaging/arch/PKGBUILD | 7 ++++++- scripts/set-version.sh | 15 +++++++++++++++ scripts/set-version.test.ts | 30 ++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD index fd3d9d35..013af070 100644 --- a/packaging/arch/PKGBUILD +++ b/packaging/arch/PKGBUILD @@ -8,7 +8,7 @@ # tarball/VCS URL and drop the local-copy prepare() step. pkgname=jellytau -pkgver=0.0.18 +pkgver=0.9.0 pkgrel=1 pkgdesc="A cross-platform Jellyfin client" arch=('x86_64') @@ -42,6 +42,11 @@ package() { install -Dm644 "packaging/arch/jellytau.desktop" \ "$pkgdir/usr/share/applications/jellytau.desktop" + # MIT is not in /usr/share/licenses/common, so Arch packaging requires the + # licence text to ship with the package. + install -Dm644 "LICENSE" \ + "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + # Icons (hicolor) install -Dm644 "src-tauri/icons/32x32.png" \ "$pkgdir/usr/share/icons/hicolor/32x32/apps/jellytau.png" diff --git a/scripts/set-version.sh b/scripts/set-version.sh index 3f76843d..5f5d9419 100755 --- a/scripts/set-version.sh +++ b/scripts/set-version.sh @@ -72,6 +72,21 @@ if [ -f src-tauri/Cargo.lock ]; then perl -0pi -e 's/(name = "jellytau"\nversion = )"[^"]*"/$1"'"$VERSION"'"/' src-tauri/Cargo.lock fi +# PKGBUILD — the Arch package version. Easy to miss because Arch packaging is a +# separate path from the tauri bundler, and missing it is exactly the failure +# this script exists to prevent: pkgver sat at 0.0.18 while the rest of the tree +# had moved on, so `makepkg` produced a package whose version bore no relation +# to the source it was built from. `pkgrel` resets to 1 because a new upstream +# version starts its packaging revisions over. +if [ -f packaging/arch/PKGBUILD ]; then + # Arch pkgver may not contain a hyphen (it separates pkgver from pkgrel), so a + # dev version like 0.9.0-3-gabc1234 becomes 0.9.0.r3.gabc1234, per the VCS + # package guidelines. + ARCH_VERSION="$(echo "$VERSION" | sed 's/-\([0-9]*\)-g/.r\1.g/; s/-/_/g')" + perl -0pi -e 's/^pkgver=.*$/pkgver='"$ARCH_VERSION"'/m' packaging/arch/PKGBUILD + perl -0pi -e 's/^pkgrel=.*$/pkgrel=1/m' packaging/arch/PKGBUILD +fi + # --- Android versionCode ---------------------------------------------------- # Only when the generated Android project exists (i.e. after `tauri android # init`); on Linux/Windows jobs there is nothing to stamp. diff --git a/scripts/set-version.test.ts b/scripts/set-version.test.ts index 241979f6..22ce6d7b 100644 --- a/scripts/set-version.test.ts +++ b/scripts/set-version.test.ts @@ -54,6 +54,11 @@ function seed(dir: string) { path.join(dir, "src-tauri", "gen", "android", "app", "tauri.properties"), "tauri.android.versionCode=1\n" ); + fs.mkdirSync(path.join(dir, "packaging", "arch"), { recursive: true }); + fs.writeFileSync( + path.join(dir, "packaging", "arch", "PKGBUILD"), + ['pkgname=jellytau', 'pkgver=0.0.1', 'pkgrel=3', 'pkgdesc="x"', ''].join("\n") + ); } function run(version: string, dir = tmp) { @@ -178,4 +183,29 @@ describe("set-version.sh", () => { expect(JSON.parse(read("package.json")).version).not.toBe("0.0.1"); }); }); + + // The Arch package is built by makepkg, not the tauri bundler, so its version + // lives in a file the rest of the release path never touches. It sat at + // 0.0.18 while the tree was on 0.8.x — makepkg happily produced a package + // whose version bore no relation to the source it was built from, which is + // the exact failure this script was written to prevent. + describe("PKGBUILD", () => { + it("stamps pkgver and resets pkgrel", () => { + run("0.9.0"); + const pkgbuild = read("packaging/arch/PKGBUILD"); + expect(pkgbuild).toMatch(/^pkgver=0\.9\.0$/m); + // A new upstream version starts its packaging revisions over. + expect(pkgbuild).toMatch(/^pkgrel=1$/m); + }); + + it("converts a dev version into a pkgver Arch accepts", () => { + // pkgver may not contain a hyphen — it is the pkgver/pkgrel separator. + run("0.9.0-3-gabc1234"); + const pkgbuild = read("packaging/arch/PKGBUILD"); + const match = pkgbuild.match(/^pkgver=(.*)$/m); + expect(match).not.toBeNull(); + expect(match![1]).not.toContain("-"); + expect(match![1]).toBe("0.9.0.r3.gabc1234"); + }); + }); });