Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,20 @@ 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.
# makepkg refuses to run as root, so it gets a throwaway user.
# --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.*
Expand Down
7 changes: 6 additions & 1 deletion PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
5 changes: 1 addition & 4 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
14 changes: 9 additions & 5 deletions tests/test_pkgbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
Loading