From b419b5cbcd459f9c6729678af06731198f341898 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 20 Jul 2019 18:30:29 +0200 Subject: [PATCH] Backport patch to not set RPMTAG_BUILDTIME to SOURCE_DATE_EPOCH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have enabled SOURCE_DATE_EPOCH, but it changed behavior of RPMTAG_BUILDTIME. We need to restore it… Signed-off-by: Igor Gnatenko --- ...G_BUILDTIME-to-SOURCE_DATE_EPOCH-whe.patch | 50 +++++++++++++++++++ rpm.spec | 7 ++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 0001-Do-not-set-RPMTAG_BUILDTIME-to-SOURCE_DATE_EPOCH-whe.patch 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 +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 - 4.15.0-0.beta.2 +- Backport patch to not set RPMTAG_BUILDTIME to SOURCE_DATE_EPOCH + * Thu Jun 27 2019 Panu Matilainen - 4.15.0-0.beta.1 - Rebase to 4.15.0 beta