public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpm] pmatilai-v6: Backport patch to not set RPMTAG_BUILDTIME to SOURCE_DATE_EPOCH
@ 2026-11-23  9:32 Igor Gnatenko
  0 siblings, 0 replies; only message in thread
From: Igor Gnatenko @ 2026-11-23  9:32 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/rpm
            Branch : pmatilai-v6
            Commit : b419b5cbcd459f9c6729678af06731198f341898
            Author : Igor Gnatenko <ignatenkobrain@fedoraproject.org>
            Date   : 2019-07-20T18:30:29+02:00
            Stats  : +56/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpm/c/b419b5cbcd459f9c6729678af06731198f341898?branch=pmatilai-v6

            Log:
            Backport patch to not set RPMTAG_BUILDTIME to SOURCE_DATE_EPOCH

We have enabled SOURCE_DATE_EPOCH, but it changed behavior of
RPMTAG_BUILDTIME. We need to restore it…

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>

---
diff --git a/0001-Do-not-set-RPMTAG_BUILDTIME-to-SOURCE_DATE_EPOCH-whe.patch b/0001-Do-not-set-RPMTAG_BUILDTIME-to-SOURCE_DATE_EPOCH-whe.patch
new file mode 100644
index 0000000..0e331a7
--- /dev/null
+++ b/0001-Do-not-set-RPMTAG_BUILDTIME-to-SOURCE_DATE_EPOCH-whe.patch
@@ -0,0 +1,50 @@
+From 4b15a9e48bd3d4bef96e8a8865044346be20d6dc Mon Sep 17 00:00:00 2001
+From: Neal Gompa <ngompa13@gmail.com>
+Date: Sun, 7 Jul 2019 04:21:23 -0400
+Subject: [PATCH] Do not set RPMTAG_BUILDTIME to SOURCE_DATE_EPOCH when defined
+ by default
+
+Since b8a54d6a1e9bb6140b6b47e23dc707e4b967537e, when SOURCE_DATE_EPOCH
+is set, RPMTAG_BUILDTIME winds up being set with that value. This is
+not always desirable, particularly if you are using the build time for
+filters and evaluation in certain types of package release pipelines.
+
+This is an adaptation of the downstream patch in SUSE's rpm package
+written by Michael Schroeder intended to address SuseBug:1087065.
+---
+ build/spec.c | 2 +-
+ macros.in    | 5 +++++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/build/spec.c b/build/spec.c
+index f7de3d1d1..81506b4e9 100644
+--- a/build/spec.c
++++ b/build/spec.c
+@@ -207,7 +207,7 @@ static rpm_time_t getBuildTime(void)
+     char *endptr;
+ 
+     srcdate = getenv("SOURCE_DATE_EPOCH");
+-    if (srcdate) {
++    if (srcdate && rpmExpandNumeric("%{?use_source_date_epoch_as_buildtime}")) {
+         errno = 0;
+         epoch = strtol(srcdate, &endptr, 10);
+         if (srcdate == endptr || *endptr || errno != 0)
+diff --git a/macros.in b/macros.in
+index 73586a75b..3cdcca385 100644
+--- a/macros.in
++++ b/macros.in
+@@ -238,6 +238,11 @@ package or when debugging this package.\
+ #	to the timestamp of the topmost changelog entry
+ %source_date_epoch_from_changelog 0
+ 
++#	If true, make sure that buildtime in built rpms
++#	is set to the value of SOURCE_DATE_EPOCH.
++#	Is ignored when SOURCE_DATE_EPOCH is not set.
++%use_source_date_epoch_as_buildtime 0
++
+ #	If true, make sure that timestamps in built rpms
+ #	are not later than the value of SOURCE_DATE_EPOCH.
+ #	Is ignored when SOURCE_DATE_EPOCH is not set.
+-- 
+2.22.0
+

diff --git a/rpm.spec b/rpm.spec
index 2764e38..614b153 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -21,7 +21,7 @@
 
 %global rpmver 4.15.0
 %global snapver beta
-%global rel 1
+%global rel 2
 
 %global srcver %{version}%{?snapver:-%{snapver}}
 %global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x}
@@ -51,6 +51,8 @@ Patch5: rpm-4.12.0-rpm2cpio-hack.patch
 Patch6: 0001-find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch
 
 # Patches already upstream:
+# https://github.com/rpm-software-management/rpm/commit/4b15a9e48bd3d4bef96e8a8865044346be20d6dc
+Patch101: 0001-Do-not-set-RPMTAG_BUILDTIME-to-SOURCE_DATE_EPOCH-whe.patch
 
 # These are not yet upstream
 Patch906: rpm-4.7.1-geode-i686.patch
@@ -537,6 +539,9 @@ make check || (cat tests/rpmtests.log; exit 0)
 %doc doc/librpm/html/*
 
 %changelog
+* Sat Jul 20 18:30:10 CEST 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 4.15.0-0.beta.2
+- Backport patch to not set RPMTAG_BUILDTIME to SOURCE_DATE_EPOCH
+
 * Thu Jun 27 2019 Panu Matilainen <pmatilai@redhat.com> - 4.15.0-0.beta.1
 - Rebase to 4.15.0 beta
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23  9:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23  9:32 [rpms/rpm] pmatilai-v6: Backport patch to not set RPMTAG_BUILDTIME to SOURCE_DATE_EPOCH Igor Gnatenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox