File rpm-no_store_expanded_spec.patch of Package rpm
From fe7296a49bac31ae1255aeac6d490e2617ac20fc Mon Sep 17 00:00:00 2001
From: "Bernhard M. Wiedemann" <bernhard+gitcommit lsmod.de>
Date: Mon, 13 Nov 2023 16:11:41 +0100
Subject: [PATCH] Add option to not store expanded spec
because some usages of macros are hard to make reproducible
Fixes #2343
This patch was done while working on reproducible builds for openSUSE.
---
build/pack.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/build/pack.c b/build/pack.c
index eb9c7b3..36e53df 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -804,7 +804,8 @@ rpmRC packageSources(rpmSpec spec, char **cookie)
headerPutUint32(sourcePkg->header, RPMTAG_BUILDTIME, &(spec->buildTime), 1);
/* Include spec in parsed and expanded form */
- headerPutString(sourcePkg->header, RPMTAG_SPEC,
+ if (!rpmExpandNumeric("%{?no_store_expanded_spec}"))
+ headerPutString(sourcePkg->header, RPMTAG_SPEC,
rpmSpecGetSection(spec, RPMBUILD_NONE));
if (rpmSpecGetSection(spec, RPMBUILD_BUILDREQUIRES)) {