teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame 0001-Fix-rpmbuild-br-not-building-.src.rpm-regression-RhB.patch

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