[Reproducible-commits] [doxygen] 03/03: Honour $SOURCE_DATE_EPOCH
Maria Valentina Marin Rodrigues
akira-guest at moszumanska.debian.org
Sun Jul 5 21:24:18 UTC 2015
This is an automated email from the git hooks/post-receive script.
akira-guest pushed a commit to branch pu/reproducible_builds
in repository doxygen.
commit 42f837efca1f7b0b04244af674b818cef26c61d0
Author: akira <marivalenm at gmail.com>
Date: Sun Jul 5 22:06:00 2015 +0200
Honour $SOURCE_DATE_EPOCH
---
...CE_DATE_EPOCH-environment-variable-for-re.patch | 67 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 68 insertions(+)
diff --git a/debian/patches/0001-Honour-SOURCE_DATE_EPOCH-environment-variable-for-re.patch b/debian/patches/0001-Honour-SOURCE_DATE_EPOCH-environment-variable-for-re.patch
new file mode 100644
index 0000000..ba40c7d
--- /dev/null
+++ b/debian/patches/0001-Honour-SOURCE_DATE_EPOCH-environment-variable-for-re.patch
@@ -0,0 +1,67 @@
+From 8002a0b3cfa6380378417cda6485c165b911deac Mon Sep 17 00:00:00 2001
+From: akira <marivalenm at gmail.com>
+Date: Sat, 4 Jul 2015 21:15:31 +0200
+Subject: [PATCH] Honour SOURCE_DATE_EPOCH environment variable for
+ reproducible output
+
+If the environment variable SOURCE_DATE_EPOCH is set then the HTML, LaTeX and Man page output will contain the timestamp from the variable instead of the current date. The content of this variable is the unix epoch. This is useful for the Debian reproducible builds project [1] because it will cause packages to become reproducible while allowing them to have a timestamp.
+
+[1] https://wiki.debian.org/ReproducibleBuilds
+---
+ src/util.cpp | 38 +++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 37 insertions(+), 1 deletion(-)
+
+--- a/src/util.cpp
++++ b/src/util.cpp
+@@ -18,6 +18,7 @@
+ #include <ctype.h>
+ #include <errno.h>
+ #include <math.h>
++#include <limits.h>
+
+ #include "md5.h"
+
+@@ -2460,7 +2461,42 @@ QCString fileToString(const char *name,b
+
+ QCString dateToString(bool includeTime)
+ {
+- QDateTime current = QDateTime::currentDateTime();
++ char *source_date_epoch;
++ unsigned long long epoch;
++ char *endptr;
++ QDateTime current;
++ source_date_epoch = getenv("SOURCE_DATE_EPOCH");
++ if (source_date_epoch)
++ {
++ errno = 0;
++ epoch = strtoull(source_date_epoch, &endptr, 10);
++ if ((errno == ERANGE && (epoch == ULLONG_MAX || epoch == 0))
++ || (errno != 0 && epoch == 0))
++ {
++ err("Environment variable $SOURCE_DATE_EPOCH: strtoull: %s\n", strerror(errno));
++ exit(EXIT_FAILURE);
++ }
++ if (endptr == source_date_epoch)
++ {
++ err("Environment variable $SOURCE_DATE_EPOCH: No digits were found: %s\n", endptr);
++ exit(EXIT_FAILURE);
++ }
++ if (*endptr != '\0')
++ {
++ err("Environment variable $SOURCE_DATE_EPOCH: Trailing garbage: %s\n", endptr);
++ exit(EXIT_FAILURE);
++ }
++ if (epoch > UINT_MAX)
++ {
++ err("Environment variable $SOURCE_DATE_EPOCH: value must be smaller than or equal to: %u but was found to be: %llu \n", UINT_MAX ,epoch);
++ exit(EXIT_FAILURE);
++ }
++ current.setTime_t(epoch);
++ }
++ else
++ {
++ current = QDateTime::currentDateTime();
++ }
+ return theTranslator->trDateTime(current.date().year(),
+ current.date().month(),
+ current.date().day(),
diff --git a/debian/patches/series b/debian/patches/series
index 91b64ab..86dcd2e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,4 @@ sqlite3-configure.diff
issue742427.diff
no-timestamps.diff
default-no-timestamp.diff
+0001-Honour-SOURCE_DATE_EPOCH-environment-variable-for-re.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/doxygen.git
More information about the Reproducible-commits
mailing list