From 1f7813f262d662ae8b1b8d46d60d10ecd69b9f0b Mon Sep 17 00:00:00 2001 From: Philippe Matray Date: Sat, 5 Sep 2026 01:39:24 +0200 Subject: [PATCH] fix(ci): take pkgver from the tag instead of release-please's extra-files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Listing PKGBUILD under release-please's `extra-files` made it fail to build a release PR at all: ✔ Building candidate release pull request for path: . ❯ error message: Error: unexpected token '(' at 6:32, valid tokens [)] ✔ No user facing commits found since 8807472 - skipping The feat that added the packaging job merged and produced no release PR, so the package would never have been built — the same shape as the bug it was fixing, one layer out. The packaging job knows the tag, so it rewrites pkgver itself before makepkg and greps to confirm the rewrite landed. That is stricter than the config coupling was: the built package cannot carry a version the release does not. The value in the file is now just the fallback for a manual makepkg from a checkout. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01SYBhT1xfp3MQ1w3687F4Mp --- .github/workflows/release-please.yml | 7 +++++++ PKGBUILD | 7 ++++++- release-please-config.json | 5 +---- tests/test_pkgbuild.py | 14 +++++++++----- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 7196360..df13d2a 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -75,6 +75,8 @@ jobs: ref: ${{ needs.release-please.outputs.tag_name || inputs.package_tag }} - name: Build the package + env: + TAG: ${{ needs.release-please.outputs.tag_name || inputs.package_tag }} # -Syu, not -Sy: a partial upgrade can link the fresh python against a # glibc this image does not have, and it reads as a build bug. # github-cli because `gh` lives on the RUNNER, not inside the container. @@ -82,6 +84,11 @@ jobs: # --nodeps because `depends` is a runtime contract for the target machine. run: | pacman -Syu --noconfirm --needed git python github-cli + # The tag is the truth. Rewriting pkgver here means the package can + # never carry a version the release does not, and release-please needs + # no extra-files entry to keep them in step. + sed -i "s/^pkgver=.*/pkgver=${TAG#v}/" PKGBUILD + grep -q "^pkgver=${TAG#v}$" PKGBUILD useradd -m build && chown -R build:build . su build -c 'makepkg -f --nodeps --noconfirm' ls -l ./*.pkg.tar.* diff --git a/PKGBUILD b/PKGBUILD index 84728b7..16774a8 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -4,7 +4,12 @@ # are kept honest by tests/test_pkgbuild.py, which fails if either grows a file # the other does not carry. pkgname=macarchy-touchbar -pkgver=0.4.0 # x-release-please-version +# Rewritten from the tag by the packaging job before makepkg runs, so the built +# package can never disagree with the release it is attached to. The value here +# is the fallback for a manual `makepkg` from a checkout; release-please used to +# maintain it through extra-files, which made it fail to build a release PR at all +# ("unexpected token '(' at 6:32"). One less coupling. +pkgver=0.4.0 pkgrel=1 pkgdesc="A Touch Bar daemon for MacBooks on Linux — draws every pixel over DRM, follows the focused app, takes modules" arch=('any') diff --git a/release-please-config.json b/release-please-config.json index ae0c7cc..0a52ab3 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -7,10 +7,7 @@ "release-type": "simple", "package-name": "macarchy-touchbar", "include-component-in-tag": false, - "changelog-path": "CHANGELOG.md", - "extra-files": [ - "PKGBUILD" - ] + "changelog-path": "CHANGELOG.md" } } } diff --git a/tests/test_pkgbuild.py b/tests/test_pkgbuild.py index e0fe799..7b305fe 100644 --- a/tests/test_pkgbuild.py +++ b/tests/test_pkgbuild.py @@ -80,12 +80,16 @@ def test_the_package_is_arch_independent(): assert "arch=('any')" in PKG_CODE -def test_pkgver_is_maintained_by_release_please(): - # Without the marker, release-please stops bumping pkgver and a release - # ships a package whose version is the previous tag's — silently. - assert "x-release-please-version" in PKG_CODE +def test_pkgver_comes_from_the_tag_at_build_time(): + # release-please's extra-files updater could not parse this file and failed + # to build a release PR at all. The packaging job rewrites pkgver from the + # tag instead, which is stricter: the package cannot carry a version the + # release does not, and there is no config coupling left to break. + wf = (ROOT / ".github" / "workflows" / "release-please.yml").read_text() + assert 's/^pkgver=.*/pkgver=${TAG#v}/' in wf + assert 'grep -q "^pkgver=${TAG#v}$" PKGBUILD' in wf, "the rewrite must be checked, not hoped" cfg = json.loads((ROOT / "release-please-config.json").read_text()) - assert "PKGBUILD" in cfg["packages"]["."]["extra-files"] + assert "extra-files" not in cfg["packages"]["."] def test_the_codepoints_are_shipped_and_not_skipped():