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 5e60ce
From 1bbe9d449543916ae44834c323d1640f2c8486e7 Mon Sep 17 00:00:00 2001
Panu Matilainen 5e60ce
Message-Id: <1bbe9d449543916ae44834c323d1640f2c8486e7.1650960341.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 5e60ce
 rpmbuild.c        |  2 ++
Panu Matilainen 5e60ce
 tests/rpmbuild.at | 16 ++++++++++++++++
Panu Matilainen 5e60ce
 2 files changed, 18 insertions(+)
Panu Matilainen 5e60ce
Panu Matilainen 5e60ce
diff --git a/rpmbuild.c b/rpmbuild.c
Panu Matilainen 5e60ce
index de78976ff..1e8c1ce09 100644
Panu Matilainen 5e60ce
--- a/rpmbuild.c
Panu Matilainen 5e60ce
+++ b/rpmbuild.c
Panu Matilainen 5e60ce
@@ -667,6 +667,8 @@ int main(int argc, char *argv[])
Panu Matilainen 5e60ce
 	    break;
Panu Matilainen 5e60ce
 	/* fallthrough */
Panu Matilainen 5e60ce
     case 'r':
Panu Matilainen 5e60ce
+	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