From 0aedb84b3c6535b0befb2cc64912645d927b9dfd Mon Sep 17 00:00:00 2001
Message-Id: <0aedb84b3c6535b0befb2cc64912645d927b9dfd.1650986658.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Tue, 26 Apr 2022 18:08:14 +0300
Subject: [PATCH] Fix regressions on dynamic buildrequires cli switches
(RhBug:2078744)
This effectively reverts commits b8935fb23518e26aa7b9316d27f2565813d20291
and ad8b9bd2ca93cf4319680f056bb40bfc24661991 and separating -br and -bd
from the normal build flow: these are so different from regular builds
and in particular, have special semantics wrt --nodeps that trying to
cram them into the normal flow only makes it far harder to read and
understand.
---
rpmbuild.c | 22 +++++++++++++++-------
tests/rpmbuild.at | 32 ++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 7 deletions(-)
diff --git a/rpmbuild.c b/rpmbuild.c
index de78976ff..abe164e32 100644
--- a/rpmbuild.c
+++ b/rpmbuild.c
@@ -663,24 +663,32 @@ int main(int argc, char *argv[])
/* fallthrough */
case 'f':
ba->buildAmount |= RPMBUILD_CONF;
+ ba->buildAmount |= RPMBUILD_BUILDREQUIRES;
+ if (!noDeps) {
+ ba->buildAmount |= RPMBUILD_DUMPBUILDREQUIRES;
+ ba->buildAmount |= RPMBUILD_CHECKBUILDREQUIRES;
+ }
if ((buildChar == 'f') && shortCircuit)
break;
/* fallthrough */
+ case 'p':
+ ba->buildAmount |= RPMBUILD_PREP;
+ break;
+ case 'l':
+ ba->buildAmount |= RPMBUILD_FILECHECK;
+ break;
case 'r':
+ /* fallthrough */
case 'd':
+ if (!shortCircuit)
+ ba->buildAmount |= RPMBUILD_PREP;
ba->buildAmount |= RPMBUILD_BUILDREQUIRES;
ba->buildAmount |= RPMBUILD_DUMPBUILDREQUIRES;
if (!noDeps)
ba->buildAmount |= RPMBUILD_CHECKBUILDREQUIRES;
- if ((buildChar == 'r' || buildChar == 'd') && shortCircuit)
+ if (buildChar == 'd')
break;
/* fallthrough */
- case 'p':
- ba->buildAmount |= RPMBUILD_PREP;
- break;
- case 'l':
- ba->buildAmount |= RPMBUILD_FILECHECK;
- break;
case 's':
ba->buildAmount |= RPMBUILD_PACKAGESOURCE;
break;
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index b7bd0d7f0..6142bb1ae 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -1707,6 +1707,38 @@ 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
+
+# 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