From 45287252e1c442c67210fac52ed6e5086c2f277d Mon Sep 17 00:00:00 2001 From: John Mitsch Date: Thu, 11 Jun 2026 13:03:04 -0400 Subject: [PATCH] Fix COPR mock builds: skip debuginfo + sed version into spec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .github/workflows/publish-copr.yml | 12 ++++++++++-- packaging/qn-bin.spec | 21 +++++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-copr.yml b/.github/workflows/publish-copr.yml index a305404..ecdce2d 100644 --- a/.github/workflows/publish-copr.yml +++ b/.github/workflows/publish-copr.yml @@ -55,7 +55,16 @@ jobs: run: | # Set up the rpmbuild tree. mkdir -p "$HOME/rpmbuild"/{SOURCES,SPECS,SRPMS} - cp packaging/qn-bin.spec "$HOME/rpmbuild/SPECS/qn-bin.spec" + + # sed the version literally into the spec rather than passing + # --define qn_version=... to rpmbuild. COPR's older chroots + # (EPEL 9, Fedora 42-44) re-parse the SRPM's spec during the + # binary-build phase without inheriting the source build's + # --define, leaving "%{qn_version}" unexpanded and breaking + # the build. Burning the version in at SRPM-build time means + # every downstream parse sees the same literal. + sed "s/@@QN_VERSION@@/$QN_VERSION/g" packaging/qn-bin.spec \ + > "$HOME/rpmbuild/SPECS/qn-bin.spec" # Pre-download both arch tarballs into SOURCES/ — rpmbuild -bs # needs the actual files present locally to embed them in the @@ -74,7 +83,6 @@ jobs: # the runner; COPR's mock chroot handles that for the real build. rpmbuild -bs "$HOME/rpmbuild/SPECS/qn-bin.spec" \ --define "_topdir $HOME/rpmbuild" \ - --define "qn_version $QN_VERSION" \ --nodeps ls -la "$HOME/rpmbuild/SRPMS/" diff --git a/packaging/qn-bin.spec b/packaging/qn-bin.spec index d07d3f4..f1e8abf 100644 --- a/packaging/qn-bin.spec +++ b/packaging/qn-bin.spec @@ -13,13 +13,26 @@ # the parser state and causes downstream "Name field must be present" # errors that look unrelated. # +# The version is substituted by .github/workflows/publish-copr.yml via +# sed before rpmbuild -bs: every @@QN_VERSION@@ becomes the actual +# release version (0.1.4 etc.). We don't use a spec macro because COPR's +# older chroots (EPEL 9, Fedora 42-44) re-parse the spec during the +# binary-build phase without inheriting our --define from the source +# build, leading to a literal unexpanded macro in error messages. +# # Built by .github/workflows/publish-copr.yml on each release. That # workflow pre-downloads both arch tarballs into ~/rpmbuild/SOURCES/ -# before invoking `rpmbuild -bs`, so the resulting SRPM carries the -# sources and COPR's mock can build with --enable-net=off if desired. +# before invoking rpmbuild -bs, so the resulting SRPM carries the +# sources and COPR's mock can build without network access. + +# Skip the auto-generated debuginfo subpackage. Our binary is already +# stripped by cargo-dist upstream, and we don't claim the resulting +# /usr/lib/debug/... file in the files section, so without this Fedora's +# strict "unpackaged files found" check fails the build. +%global debug_package %{nil} Name: qn -Version: %{qn_version} +Version: @@QN_VERSION@@ Release: 1%{?dist} Summary: Command-line interface for the Quicknode SDK License: MIT @@ -63,5 +76,5 @@ install -Dm644 README.md %{buildroot}%{_docdir}/%{name}/README.md %doc README.md %changelog -* Thu Jun 11 2026 Quicknode - %{version}-1 +* Thu Jun 11 2026 Quicknode - @@QN_VERSION@@-1 - Automated build from the GitHub Release upstream.