From 9a55ee4ce9b78c4e6d64b4c10f9c063fdd6bc45a Mon Sep 17 00:00:00 2001 From: Wisbendji Fimerlus Date: Sat, 14 Nov 2026 05:51:01 -0500 Subject: [PATCH] Carry the tag's pf number in the source package's spec A source package built from v6.8.2-pf4 failed in Copr. Copr rebuilds the source package from the spec it carries (rpmbuild -bs in mock, with no --define), and that spec still said pf 3, so it asked for kwin-v6.8.2-pf3.tar.gz, which the package does not have. The pf3 build worked only because 3 was the spec's default. build-fork-rpm.sh now builds from a copy of the spec with the tag's number written in as the default. Before building anything, it checks with rpmspec -P that the copy alone names the tag's archive. Tested in the fork's CI image. Before the change, the spec of the source package built from v6.8.2-pf4 parses alone to the pf3 archive. After it, the spec says pf 4 and parses to kwin-v6.8.2-pf4.tar.gz, and a rebuild from the source package alone (rpmbuild -bs, no --define) succeeds. Signed-off-by: Wisbendji Fimerlus --- packaging/fedora/build-fork-rpm.sh | 14 ++++++++++++++ packaging/fedora/kwin-fusion.spec | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packaging/fedora/build-fork-rpm.sh b/packaging/fedora/build-fork-rpm.sh index e7279c096a..427481974f 100755 --- a/packaging/fedora/build-fork-rpm.sh +++ b/packaging/fedora/build-fork-rpm.sh @@ -50,6 +50,20 @@ if [ ! -f "$OUT/SOURCES/macros.kwin.in" ]; then cp "$stock/macros.kwin.in" "$OUT/SOURCES/" fi +# The spec to build from: the tag's sequence number written in as its default. The source +# package carries this spec, and Copr rebuilds the source package from it alone (rpmbuild -bs +# in mock, with no --define): with the repository's default every source package named the pf3 +# archive, and a pf4 build failed for a missing kwin-v6.8.2-pf3.tar.gz. +built_spec="$OUT/SPECS/$(basename "$SPEC")" +sed "s/^%{!?pf:%global pf [0-9]*}\$/%{!?pf:%global pf ${pfn}}/" "$SPEC" > "$built_spec" +[ "$(grep -c -x "%{!?pf:%global pf ${pfn}}" "$built_spec")" = 1 ] || + { echo "the spec has no single pf default line to set" >&2; exit 1; } +# What a rebuild from the spec alone takes: the tag's own archive (the directory it unpacks is +# named by the same number). +grep -q -x "Source0: https://github.com/archledger/kwin/archive/${TAG}/kwin-${TAG}.tar.gz" <<<"$(rpmspec -P "$built_spec")" || + { echo "the spec does not name ${archive} on its own" >&2; exit 1; } +SPEC=$built_spec + # SRPM=1 builds the source package only (what Copr takes); otherwise the binary packages. if [ "${SRPM:-0}" = 1 ]; then rpmbuild -bs --define "_topdir $OUT" --define "pf ${pfn}" "$SPEC" diff --git a/packaging/fedora/kwin-fusion.spec b/packaging/fedora/kwin-fusion.spec index f66da4e78f..f0ea15783a 100644 --- a/packaging/fedora/kwin-fusion.spec +++ b/packaging/fedora/kwin-fusion.spec @@ -1,7 +1,8 @@ Name: kwin Version: 6.8.2 # The fork's sequence number on this upstream version: the source is the tag -# v%%{version}-pf%%{pf}. build-fork-rpm.sh passes the tag's own number. +# v%%{version}-pf%%{pf}. build-fork-rpm.sh writes the tag's own number here in the spec it +# builds from, so the source package names its own archive when it is rebuilt alone (Copr). %{!?pf:%global pf 3} Release: 3%{?dist}.pf%{pf} Summary: KDE Window manager (the Plasma Fusion fork)