Further dynamic buildrequires cli switch regression fixes (#2078744)

Third time's the charm, eh?
This commit is contained in:
Panu Matilainen 2022-04-26 18:23:50 +03:00
parent f384795ec8
commit 2f2f9ed291
4 changed files with 113 additions and 95 deletions

View File

@ -1,31 +0,0 @@
From d220e0063e836ba14806c7efb2a85d1be04cd673 Mon Sep 17 00:00:00 2001
Message-Id: <d220e0063e836ba14806c7efb2a85d1be04cd673.1650979848.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Tue, 26 Apr 2022 16:27:10 +0300
Subject: [PATCH] Fix regression on dynamic buildrequires with -ba --nodeps
(RhBug:2078744)
---
rpmbuild.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/rpmbuild.c b/rpmbuild.c
index da3810f75..377d672a7 100644
--- a/rpmbuild.c
+++ b/rpmbuild.c
@@ -673,9 +673,10 @@ int main(int argc, char *argv[])
/* fallthrough */
case 'd':
ba->buildAmount |= RPMBUILD_BUILDREQUIRES;
- ba->buildAmount |= RPMBUILD_DUMPBUILDREQUIRES;
- if (!noDeps)
+ if ((buildChar == 'd' || buildChar == 'r') || noDeps == 0) {
+ ba->buildAmount |= RPMBUILD_DUMPBUILDREQUIRES;
ba->buildAmount |= RPMBUILD_CHECKBUILDREQUIRES;
+ }
if ((buildChar == 'r' || buildChar == 'd') && shortCircuit)
break;
/* fallthrough */
--
2.35.1

View File

@ -0,0 +1,108 @@
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

View File

@ -1,61 +0,0 @@
From feeeca5148ceadba5fa0af13bfabda0b716566d5 Mon Sep 17 00:00:00 2001
Message-Id: <feeeca5148ceadba5fa0af13bfabda0b716566d5.1650961200.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 | 4 ++++
tests/rpmbuild.at | 16 ++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/rpmbuild.c b/rpmbuild.c
index de78976ff..da3810f75 100644
--- a/rpmbuild.c
+++ b/rpmbuild.c
@@ -667,6 +667,10 @@ int main(int argc, char *argv[])
break;
/* fallthrough */
case 'r':
+ /* build src.rpm only on explicit -br */
+ if (buildChar == '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 3
%global baserelease 4
%global sover 9
%global srcver %{rpmver}%{?snapver:-%{snapver}}
@ -58,8 +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
Patch103: 0001-Fix-regression-on-dynamic-buildrequires-with-ba-node.patch
Patch102: 0001-Fix-regressions-on-dynamic-buildrequires-cli-switche.patch
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@ -614,6 +613,9 @@ fi
%doc docs/librpm/html/*
%changelog
* Tue Apr 26 2022 Panu Matilainen <pmatilai@redhat.com> - 4.18.0-0.alpha1.4
- Further dynamic buildrequires cli switch regression fixes (#2078744)
* Tue Apr 26 2022 Panu Matilainen <pmatilai@redhat.com> - 4.18.0-0.alpha1.3
- Fix rpmbuild -ba --nodeps regression wrt dynamic buildrequires (#2078744)