Fix rpmbuild -br not producing a src.rpm regression (#2078744)

This commit is contained in:
Panu Matilainen 2022-04-26 11:07:48 +03:00
parent 2742b0e272
commit 5e60ce8fd7
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From 1bbe9d449543916ae44834c323d1640f2c8486e7 Mon Sep 17 00:00:00 2001
Message-Id: <1bbe9d449543916ae44834c323d1640f2c8486e7.1650960341.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Tue, 26 Apr 2022 11:00:41 +0300
Subject: [PATCH] Fix rpmbuild -br not building .src.rpm regression
(RhBug:2078744)
Successful rpmbuild -br needs to produce an src.rpm, this was untested
in the testsuite and commit ad8b9bd2ca93cf4319680f056bb40bfc24661991
missed this twist in the logic. Fixing is an obvious one-liner now,
add a test to ensure it doesn't happen again.
---
rpmbuild.c | 2 ++
tests/rpmbuild.at | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/rpmbuild.c b/rpmbuild.c
index de78976ff..1e8c1ce09 100644
--- a/rpmbuild.c
+++ b/rpmbuild.c
@@ -667,6 +667,8 @@ int main(int argc, char *argv[])
break;
/* fallthrough */
case 'r':
+ ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
+ /* fallthrough */
case 'd':
ba->buildAmount |= RPMBUILD_BUILDREQUIRES;
ba->buildAmount |= RPMBUILD_DUMPBUILDREQUIRES;
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index b7bd0d7f0..8746fa501 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -1707,6 +1707,22 @@ runroot rpmbuild \
)
AT_CLEANUP
+# Test that -br creates an src.rpm on success
+AT_SETUP([rpmbuild -br success])
+AT_KEYWORDS([build])
+AT_CHECK([
+RPMDB_INIT
+
+runroot rpmbuild \
+ -br /data/SPECS/mini.spec
+],
+[0],
+[Wrote: /build/SRPMS/mini-1-1.src.rpm
+],
+[],
+)
+AT_CLEANUP
+
# ------------------------------
# Check dynamic build requires
AT_SETUP([rpmbuild -bd with errors])
--
2.35.1

View File

@ -30,7 +30,7 @@
%global rpmver 4.18.0
%global snapver alpha1
%global baserelease 1
%global baserelease 2
%global sover 9
%global srcver %{rpmver}%{?snapver:-%{snapver}}
@ -58,6 +58,7 @@ Patch3: rpm-4.9.90-no-man-dirs.patch
# Patches already upstream:
Patch100: 0001-Fix-OpenPGP-key-ID-parsing-regression.patch
Patch101: 0001-Revert-Fix-shared-colored-files-not-removed-on-erasu.patch
Patch102: 0001-Fix-rpmbuild-br-not-building-.src.rpm-regression-RhB.patch
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@ -612,6 +613,9 @@ fi
%doc docs/librpm/html/*
%changelog
* Tue Apr 26 2022 Panu Matilainen <pmatilai@redhat.com> - 4.18.0-0.alpha1.2
- Fix rpmbuild -br not producing a src.rpm regression (#2078744)
* Mon Apr 25 2022 Panu Matilainen <pmatilai@redhat.com> - 4.18.0-0.alpha1.1
- Rebase to 4.18.0 alpha (https://fedoraproject.org/wiki/Changes/RPM-4.18)
- Add patches for two late discovered regressions