Add reproducible.patch to make build reproducible OBS-URL: https://build.opensuse.org/request/show/490884 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/mxml?expand=0&rev=17
42 lines
1.4 KiB
Diff
42 lines
1.4 KiB
Diff
From b79d3e0f07495b4a113f1ad95ae08c19664ea5ac Mon Sep 17 00:00:00 2001
|
|
From: Michael Sweet <michael.r.sweet@gmail.com>
|
|
Date: Sun, 23 Apr 2017 12:49:40 -0400
|
|
Subject: [PATCH] Add support for SOURCE_DATE_EPOCH environment variable (Issue
|
|
#193)
|
|
|
|
---
|
|
CHANGES.md | 2 ++
|
|
doc/mxml.man | 2 +-
|
|
mxmldoc.c | 9 ++++++++-
|
|
3 files changed, 11 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/mxmldoc.c b/mxmldoc.c
|
|
index 7f475ef..4abe707 100644
|
|
--- a/mxmldoc.c
|
|
+++ b/mxmldoc.c
|
|
@@ -5604,6 +5604,7 @@ write_man(const char *man_name, /* I - Name of manpage */
|
|
*parent; /* Parent class */
|
|
int inscope; /* Variable/method scope */
|
|
char prefix; /* Prefix character */
|
|
+ const char *source_date_epoch; /* SOURCE_DATE_EPOCH environment variable */
|
|
time_t curtime; /* Current time */
|
|
struct tm *curdate; /* Current date */
|
|
char buffer[1024]; /* String buffer */
|
|
@@ -5617,9 +5618,15 @@ write_man(const char *man_name, /* I - Name of manpage */
|
|
|
|
/*
|
|
* Standard man page...
|
|
+ *
|
|
+ * Get the current date, using the SOURCE_DATE_EPOCH environment variable, if
|
|
+ * present, for the number of seconds since the epoch - this enables
|
|
+ * reproducible builds (Issue #193).
|
|
*/
|
|
|
|
- curtime = time(NULL);
|
|
+ if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")) == NULL || (curtime = (time_t)strtol(source_date_epoch, NULL, 10)) <= 0)
|
|
+ curtime = time(NULL);
|
|
+
|
|
curdate = localtime(&curtime);
|
|
strftime(buffer, sizeof(buffer), "%x", curdate);
|
|
|