Created attachment 1102524 [details] [PATCH] Allow SOURCE_DATE_EPOCH to override RPMTAG_BUILDTIME SOURCE_DATE_EPOCH environment variable is a distribution-agnostic standard for build systems to exchange a timestamp. SOURCE_DATE_EPOCH specification is available at: https://reproducible-builds.org/specs/source-date-epoch ... This patch helps in making reproducible builds for Fedora more possible than before. https://reproducible-builds.org/docs/ https://github.com/kholia/ReproducibleBuilds
In case packaging-team-maint is to lazy to download the patch file: From 8af7f08fd3308b61edbf4dfd20a656c2909a673f Mon Sep 17 00:00:00 2001 From: Nicolas Vigier <boklm> Date: Thu, 3 Dec 2015 12:57:22 +0100 Subject: [PATCH] Allow SOURCE_DATE_EPOCH to override RPMTAG_BUILDTIME SOURCE_DATE_EPOCH environment variable is a distribution-agnostic standard for build systems to exchange a timestamp. SOURCE_DATE_EPOCH specification is available at: https://reproducible-builds.org/specs/source-date-epoch Signed-off-by: Dhiru Kholia <dhiru> --- build/pack.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/build/pack.c b/build/pack.c index bfb4c73..f9fb3a0 100644 --- a/build/pack.c +++ b/build/pack.c @@ -154,9 +154,23 @@ exit: static rpm_time_t * getBuildTime(void) { static rpm_time_t buildTime[1]; + char *srcdate; + time_t epoch; + char *endptr; + + if (buildTime[0] == 0) { + srcdate = getenv("SOURCE_DATE_EPOCH"); + if (srcdate) { + errno = 0; + epoch = strtol(srcdate, &endptr, 10); + if (srcdate == endptr || *endptr || errno != 0) + rpmlog(RPMLOG_ERR, _("unable to parse SOURCE_DATE_EPOCH\n")); + else + buildTime[0] = (int32_t) epoch; + } else + buildTime[0] = (int32_t) time(NULL); + } - if (buildTime[0] == 0) - buildTime[0] = (int32_t) time(NULL); return buildTime; } -- 2.6.3
I meant too busy. Sorry.
I think that overriding RPMTAG_BUILDTIME is not enough for reproducible builds. You need to override also RPMTAG_FILEMTIMES and probably also RPMTAG_BUILDHOST.
Right. I have a very hacky patch for handling RPMTAG_FILEMTIMES values. I can improve it a bit, and post it in another Bugzilla request. Thanks for taking a look :-)
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle. Changing version to '24'. More information and reason for this action is here: https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase
Added upstream as b8a54d6a1e9bb6140b6b47e23dc707e4b967537e. As there are still parts missing I am not pushing this into the Fedora package right now. Feel free to bug me for inclusion in Fedora as soon as all parts are done and upstream.
Also feel free to post the patch for the file time stamps early. I just started a thread about reproducible builds on rpm-ecosystem.org. That would be one of the appropriate places to post it and ask for a review
I posted a patch for the file time stamps in the thread: http://lists.rpm.org/pipermail/rpm-ecosystem/2016-March/000322.html