ALT Linux Bugzilla
– Attachment 7275 Details for
Bug 34200
Добавить поддержку SOURCE_DATE_EPOCH
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
SOURCE_DATE_EPOCH patch
0001-Add-support-for-SOURCE_DATE_EPOCH-environment-variab.patch (text/plain), 1.96 KB, created by
Vladimir D. Seleznev
on 2017-11-15 20:02:53 MSK
(
hide
)
Description:
SOURCE_DATE_EPOCH patch
Filename:
MIME Type:
Creator:
Vladimir D. Seleznev
Created:
2017-11-15 20:02:53 MSK
Size:
1.96 KB
patch
obsolete
>From db8bb73cd9ded427ab346b557b3c97ba425400d0 Mon Sep 17 00:00:00 2001 >From: "Vladimir D. Seleznev" <vseleznv@altlinux.org> >Date: Tue, 14 Nov 2017 22:01:15 +0300 >Subject: [PATCH 1/2] Add support for SOURCE_DATE_EPOCH environment variable > >This allows rpmbuild to override file timestamps. > >Based on rpm.org commit 8d84878. >--- > build/files.c | 27 ++++++++++++++++++++++++++- > 1 file changed, 26 insertions(+), 1 deletion(-) > >diff --git a/build/files.c b/build/files.c >index fd70c9d..990155f 100644 >--- a/build/files.c >+++ b/build/files.c >@@ -8,6 +8,7 @@ > > #define MYALLPERMS 07777 > >+#include <stdlib.h> > #include <regex.h> > #include <signal.h> /* getOutputFrom() */ > >@@ -997,7 +998,27 @@ static void genCpioListAndHeader(Spec spec, /*@partial@*/ FileList fl, > FileListRec flp; > char buf[BUFSIZ]; > int i; >- >+ int override_date = 0; >+ time_t source_date_epoch; >+ const char *srcdate = getenv("SOURCE_DATE_EPOCH"); >+ >+ /* Limit the maximum date to SOURCE_DATE_EPOCH if defined >+ * similar to the tar --clamp-mtime option >+ * https://reproducible-builds.org/specs/source-date-epoch/ >+ */ >+ if (srcdate && *srcdate) { >+ char *endptr; >+ errno = 0; >+ source_date_epoch = strtol(srcdate, &endptr, 10); >+ if (srcdate == endptr || *endptr >+ || ((source_date_epoch == LONG_MIN || source_date_epoch == LONG_MAX) >+ && errno != 0)) { >+ rpmlog(RPMLOG_ERR, _("unable to parse %s=%s\n"), "SOURCE_DATE_EPOCH", srcdate); >+ } else { >+ override_date = 1; >+ } >+ } >+ > /* Sort the big list */ > qsort(fl->fileList, fl->fileListRecsUsed, > sizeof(*(fl->fileList)), compareFileListRecs); >@@ -1068,6 +1089,10 @@ static void genCpioListAndHeader(Spec spec, /*@partial@*/ FileList fl, > continue; > } > >+ if (override_date && flp->fl_mtime > source_date_epoch) { >+ flp->fl_mtime = source_date_epoch; >+ } >+ > /* Omit '/' and/or URL prefix, leave room for "./" prefix */ > apathlen += (strlen(flp->fileURL) - skipLen + (_addDotSlash ? 3 : 1)); > >-- >2.10.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 34200
: 7275