Skip to content

fix(pkgbuild): pin makepkg git sources to #commit (detached-HEAD-proof) - #2

Merged
atrawog merged 2 commits into
mainfrom
feat/pkgbuild-commit-pin
Jul 8, 2026
Merged

atrawog merged 2 commits into
mainfrom
feat/pkgbuild-commit-pin

Conversation

@atrawog

@atrawog atrawog commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

The two git+file:// sources (superproject + sdk submodule) relied on the clone's origin/HEAD symref — makepkg's working-copy step runs git checkout -B makepkg origin/HEAD, which fails with fatal: invalid reference: origin/HEAD whenever the cloned repo is on a detached HEAD. The sdk submodule detaches on every git submodule update / gitlink-driven checkout, so the standalone/in-guest localpkg build broke deterministically — the check-charly-vm / check-cachyos-vm "Creating working copy of opencharly-sdk … invalid reference: origin/HEAD" failures the concurrent bed roster surfaced (pre-existing, independent of P1). Pinned each source to its working-tree HEAD via #commit=$(git -C … rev-parse HEAD): makepkg checks out the exact commit, never origin/HEAD, and the build is reproducible against the precise superproject + sdk commits.

Change class + gate

Config (packaging). bash -n PKGBUILD clean. Surgically proven on the actual failing condition (sdk currently detached at 0561805):

$ git clone -s sdk mirror && cd mirror && git checkout -B makepkg origin/HEAD
fatal: 'origin/HEAD' is not a commit and a branch 'makepkg' cannot be created from it   # OLD
$ git checkout -B makepkg 0561805…                                                       # NEW (what #commit= does)
Switched to a new branch 'makepkg'

And end-to-end: task build:charly (which invokes makepkg with the pinned source=) installs successfully.

Tier: fully tested and validated.

Assisted-by: Claude (fully tested and validated)

makepkg's working-copy step (git checkout -B makepkg origin/HEAD) failed with
"fatal: invalid reference: origin/HEAD" when the cloned sdk submodule was on a
detached HEAD (every submodule update detaches it) — the deterministic
standalone/in-guest localpkg build failure the bed roster surfaced. Pin each
git+file source to its working-tree HEAD via #commit=$(git rev-parse HEAD):
makepkg checks out the exact commit, never origin/HEAD, and the build is
reproducible. Verified: pinned checkout succeeds on a detached sdk clone where
origin/HEAD fails; task build:charly installs end-to-end.

Assisted-by: Claude (fully tested and validated)
@atrawog

atrawog commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: config (packaging — PKGBUILD + CHANGELOG). pkg-arch has no charly.yml → tag-exempt (changelog only).

Security & anti-tampering (T1–T4): PASS

  • No change to the validator spec / CLAUDE.md / hooks / branch-protection; no embedded instruction directed at the validator.
  • Scope matches the description exactly: the source= #commit= pin (+ its explanatory comment + the two _charly_src/_sdk_src helper vars) and the placeholder CHANGELOG. Nothing else.
  • No secrets/exfiltration — git -C … rev-parse HEAD reads a local commit SHA; sources stay local git+file:// paths. Supply chain is strengthened: the build is pinned to an exact commit instead of the ambient origin/HEAD.

Checklist

  • Description complete — PASS. Summary + change-class/gate with pasted evidence + tier + Assisted-by trailer.
  • Change-class gate (R10) — PASS. bash -n PKGBUILD clean; the fix's claim independently reproduced live (below); author's end-to-end task build:charly install claimed and consistent with the mechanism.
  • Attribution tier justified — PASS. Author's fully tested and validated is supported by their pasted surgical repro + end-to-end build; I independently confirmed the load-bearing mechanism.
  • R5 grep self-test — PASS (n/a). No identifier removed/renamed; source= remains, gaining a #commit=<sha> fragment via named helpers.
  • R1–R4 / clean architecture — PASS. Root-cause fix (sidesteps origin/HEAD via makepkg's native #commit= VCS fragment), not a retry/sleep/shim; applied to both sources (superproject + sdk), so R3 holds.
  • CHANGELOG present — PASS. CHANGELOG/2026.189.0130.md placeholder (finalized to the merge-time CalVer at merge).
  • Skills honored — PASS. Packaging change is orthogonal to the depends= R9 surface; uses the makepkg-native fragment mechanism.

Independent verification (live):

sdk is DETACHED at 0561805 (the exact failing condition).

OLD  git checkout -B makepkg origin/HEAD
     → fatal: 'origin/HEAD' is not a commit and a branch 'makepkg'
       cannot be created from it        (exit 128)

NEW  git checkout -B makepkg 0561805…   (what #commit=<sha> drives)
     → Switched to a new branch 'makepkg'   (exit 0)

Confirmed against the installed makepkg handler /usr/share/makepkg/source/git.sh: default ref=origin/HEAD (l.116); a #commit= fragment sets ref to the exact SHA (l.120); the working-copy step git checkout --force --no-track -B makepkg "$ref" runs on every rebuild (l.141 (( updating ))), so the unpinned path fails deterministically on a detached clone and the pin fixes it at root.

Decision: APPROVED. The pin is the correct, minimal, makepkg-native fix; it is applied to both git+file:// sources; the diff is exactly what the description claims; and the failing→fixed transition is independently reproduced on the live detached sdk. Finalizing the merge-time CalVer, merging --rebase, no tag (tag-exempt).

Assisted-by: Claude (analysed on a live system)

@atrawog
atrawog merged commit c6fedea into main Jul 8, 2026
@atrawog
atrawog deleted the feat/pkgbuild-commit-pin branch July 8, 2026 01:37
atrawog added a commit to opencharly/charly that referenced this pull request Jul 8, 2026
…in pointer bump

Renames the placeholder changelog to the merge-time CalVer 2026.189.0144 and
restamps its header. Mechanical version-stamp for PR #7 (pkg/arch 8521ffd ->
c6fedea, the #commit-pinned PKGBUILD adopted from opencharly/pkg-arch#2).

Claude-Session: https://claude.ai/code/session_01LjLm6DGQasmXaXw2ZorwhE
Assisted-by: Claude (fully tested and validated)
atrawog added a commit to opencharly/charly that referenced this pull request Jul 8, 2026
…in pointer bump

Renames the placeholder changelog to the merge-time CalVer 2026.189.0144 and
restamps its header. Mechanical version-stamp for PR #7 (pkg/arch 8521ffd ->
c6fedea, the #commit-pinned PKGBUILD adopted from opencharly/pkg-arch#2).

Claude-Session: https://claude.ai/code/session_01LjLm6DGQasmXaXw2ZorwhE
Assisted-by: Claude (fully tested and validated)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant