SHA256
1
0
forked from pool/mxml

Accepting request 490884 from home:bmwiedemann:branches:devel:libraries:c_c++

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
This commit is contained in:
Adam Majer 2017-04-26 14:43:59 +00:00 committed by Git OBS Bridge
parent 6ff6fa6a73
commit 4de7b70f29
3 changed files with 49 additions and 0 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Apr 25 04:45:36 UTC 2017 - bwiedemann@suse.com
- Add reproducible.patch to make build reproducible
-------------------------------------------------------------------
Fri Nov 11 14:50:28 UTC 2016 - mrueckert@suse.de

View File

@ -27,6 +27,8 @@ Group: Development/Libraries/C and C++
Source: http://www.msweet.org/files/project3/%{name}-%{version}.tar.gz
Source1: baselibs.conf
Patch: mxml-2.3-nobinstrip.patch
# PATCH-FIX-UPSTREAM -- https://github.com/michaelrsweet/mxml/commit/b79d3e0f07495b4a113f1ad95ae08c19664ea5ac
Patch1: reproducible.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: pkgconfig
@ -69,6 +71,7 @@ This package holds the development files for mxml.
%prep
%setup
%patch
%patch1 -p1
%build
%configure --enable-shared --with-docdir=%{_docdir}/%{name}

41
reproducible.patch Normal file
View File

@ -0,0 +1,41 @@
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);