Skip to content

Fix COPR spec + point release-prepare at sync-manual-channels#22

Merged
johnpmitsch merged 2 commits into
mainfrom
fix/copr-spec-no-percent-in-comments
Jun 11, 2026
Merged

Fix COPR spec + point release-prepare at sync-manual-channels#22
johnpmitsch merged 2 commits into
mainfrom
fix/copr-spec-no-percent-in-comments

Conversation

@johnpmitsch

@johnpmitsch johnpmitsch commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two small, related changes:

1. Fix COPR mock build. v0.1.6's custom-publish-copr got past the SRPM build (fixed in PR #20) and successfully dispatched to COPR — but COPR's mock builds failed across all 10 chroots with:

warning: Macro expanded in comment on line 5: %install lays
error: Name field must be present in package: (main package)

RPM specs don't treat # as escaping %. The macro processor runs before the comment processor, so a %macro token inside a comment gets expanded just like one in a directive. Two comments in packaging/qn-bin.spec mentioned %prep and %install. RPM expanded the %install in line 5's comment, corrupted the parser's preamble state, and by the time RPM reached Name: qn on line 15 it had lost context and emitted the misleading "Name field must be present" error.

(Credit to Log Detective for surfacing the warning + error pair from the mock log.)

Fix: strip all %-prefixed macro names from comments. Belt-and-suspenders: every comment line is now grep-clean of % entirely:

grep -nE '^#.*%' packaging/qn-bin.spec  # → no matches

2. Point release-prepare's tail at the next step. After release-prepare succeeds, the maintainer's next move is release-sync-manual-channels. The tail message used to stop at "inspect the release" — now it points at the sync command with the version baked in for a clean copy-paste.

Status

Forward-fix for COPR. v0.1.6 already shipped successfully to crates.io, GHCR, .deb, and the GitHub Release — only COPR was missed. v0.1.7 will exercise the corrected spec.

Test plan

  • dist plan exits 0.
  • grep -nE '^#.*%' packaging/qn-bin.spec returns no matches.
  • release-prepare's tail message renders cleanly (verified by reading the recipe; the new lines use the same {{version}} substitution the existing lines use).
  • After merge, cut v0.1.7 and confirm custom-publish-copr's mock builds succeed across all 10 chroots.

v0.1.6's COPR build failed in mock (all 10 chroots) with:

  warning: Macro expanded in comment on line 5: %install lays
  error: Name field must be present in package: (main package)

Root cause: RPM specs do NOT treat `#` as escaping `%`. The macro
processor runs before the comment processor, so a `%macro` token
inside a comment gets expanded just like one in a directive. Two
comments in packaging/qn-bin.spec mentioned `%prep` and `%install`
to describe what those sections do. When RPM hit the `%install` in
line 5's comment it expanded it, corrupting the parser's preamble
state, and by the time RPM reached `Name: qn` on line 15 it had
lost context and emitted the misleading "Name field must be
present" error.

Fix: remove all `%`-prefixed macro mentions from comments and add a
note (without a `%` symbol) reminding future editors that the
character is unsafe in spec comments.

Belt-and-suspenders: every comment line in the spec is now grep-clean
of `%` entirely (`grep -nE '^#.*%' qn-bin.spec` → no matches), so any
future edit that accidentally reintroduces `%foo` in a comment gets
caught by a one-line lint.

This fix is forward-only: v0.1.6 already shipped to crates.io, GHCR,
.deb, and the GitHub Release. v0.1.7 will exercise the corrected COPR
spec and backfill COPR for the recent versions.
After release-prepare's CI-wait succeeds, the maintainer's next move
is to sync the three manual channels (Homebrew tap, Scoop bucket,
AUR qn-bin). The tail message used to stop at "inspect the release" —
this adds a pointer to release-sync-manual-channels with the version
baked in for a clean copy-paste, plus a note that omitting the args
auto-detects the version from the latest tag.
@johnpmitsch johnpmitsch changed the title Fix COPR spec: strip percent-signs from comments Fix COPR spec + point release-prepare at sync-manual-channels Jun 11, 2026
@johnpmitsch johnpmitsch merged commit f6f6492 into main Jun 11, 2026
13 checks passed
johnpmitsch added a commit that referenced this pull request Jun 11, 2026
v0.1.7's COPR build dispatched cleanly to all 10 chroots (the
"Name field" bug from PR #22 is fixed), and EPEL 10's two chroots
*succeeded* — first time COPR has shipped a real qn build. But the
other 8 chroots failed with two distinct issues:

1. Older RPMs (EPEL 9, Fedora 42-44) didn't honor the source build's
   `--define qn_version=...`. When mock re-parsed the SRPM during the
   binary-build phase, it saw a literal `%{qn_version}` in Version:
   and the SRPM filename glob, leading to:

     warning: line 22: Possible unexpanded macro in: Version: %{qn_ver...
     error: File not found by glob: /builddir/build/originals/qn-%{qn_version}-1.el9.src.rpm

   EPEL 10's RPM is newer and handles the source-build define
   correctly, hence the partial success.

   Fix: sed the version literally into the spec file in the workflow
   before `rpmbuild -bs`. The SRPM gets the real version baked in
   everywhere, every downstream parse sees the same literal. `@@QN_VERSION@@`
   is the placeholder.

2. Fedora's strict "unpackaged files found" check killed the build with:

     error: Installed (but unpackaged) file(s) found: /usr/lib/debug/usr/bin/qn-*.debug

   Fedora's RPM auto-generates debug symbols via find-debuginfo and
   expects them packaged. Our spec only claims /usr/bin/qn + docs in
   the files section.

   Fix: `%global debug_package %{nil}` near the top of the spec. Our
   binary is already stripped by cargo-dist upstream; there's nothing
   for debuginfo to extract, and even if there were, we wouldn't want
   to ship a -debuginfo subpackage for a single-binary tool.

v0.1.7's EPEL 10 success means Phase 7 is partially shipped — anyone
on Fedora-10-derived distros can `dnf copr enable quicknode/qn && dnf
install qn` today. v0.1.8 (next release) should backfill Fedora
42-44 and EPEL 9.
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.

2 participants