[Reproducible-commits] [doxygen] 01/01: Make doxygen produce reproducible output

Maria Valentina Marin Rodrigues akira-guest at moszumanska.debian.org
Wed Aug 5 08:40:27 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 21ea8c9c61c18561c7bc55077f2d6744c8a2c045
Author: akira <marivalenm at gmail.com>
Date:   Sun Jul 5 22:06:00 2015 +0200

    Make doxygen produce reproducible output
    
     - Honour $SOURCE_DATE_EPOCH
     - Modified function to produce timezone independent timestamps using UTC
---
 debian/changelog                                   |  11 ++
 ...CE_DATE_EPOCH-environment-variable-for-re.patch | 150 +++++++++++++++++++++
 ...tion-to-produce-timezone-independent-timestamps |  13 ++
 debian/patches/series                              |   2 +
 4 files changed, 176 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 32c7cc6..d82c369 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+doxygen (1.8.9.1-4.0~reproducible1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Applied upstream commit
+    https://github.com/doxygen/doxygen/commit/b31266c1076c6284116f17241d9e8aa048f88e60
+    which honours $SOURCE_DATE_EPOCH
+  * Modified function QDateTime::setTime_t to produce timezone independent
+    timestamps by using UTC
+
+ -- akira <marivalenm at gmail.com>  Wed, 05 Aug 2015 10:31:44 +0200
+
 doxygen (1.8.9.1-4) unstable; urgency=high
 
   * Rebuild for GCC 5 / xapian-core.
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..ce64aed
--- /dev/null
+++ b/debian/patches/0001-Honour-SOURCE_DATE_EPOCH-environment-variable-for-re.patch
@@ -0,0 +1,150 @@
+commit b31266c1076c6284116f17241d9e8aa048f88e60
+Author: Dimitri van Heesch <dimitri at stack.nl>
+Date:   Sun Jul 19 12:12:39 2015 +0200
+
+    Bug 751984 - PATCH: Honour SOURCE_DATE_EPOCH environment variable for reproducible output
+
+--- a/qtools/qcstring.cpp
++++ b/qtools/qcstring.cpp
+@@ -460,6 +460,12 @@ ulong QCString::toULong(bool *ok) const
+   return s.toULong(ok);
+ }
+ 
++uint64 QCString::toUInt64(bool *ok) const
++{
++  QString s(data());
++  return s.toUInt64(ok);
++}
++
+ QCString &QCString::setNum(short n)
+ {
+   return setNum((long)n);
+--- a/qtools/qcstring.h
++++ b/qtools/qcstring.h
+@@ -288,6 +288,7 @@ public:
+     uint toUInt( bool *ok=0 ) const;
+     long toLong( bool *ok=0 ) const;
+     ulong toULong( bool *ok=0 )	const;
++    uint64 toUInt64( bool *ok=0 ) const;
+     QCString &setNum(short n);
+     QCString &setNum(ushort n);
+     QCString &setNum(int n);
+--- a/qtools/qstring.cpp
++++ b/qtools/qstring.cpp
+@@ -13935,6 +13935,60 @@ bye:
+ }
+ 
+ /*!
++  Returns the string converted to an <code>unsigned long</code>
++  value.
++
++  If \a ok is non-null, \a *ok is set to TRUE if there are no
++  conceivable errors, and FALSE if the string is not a number at all,
++  or if it has trailing garbage.
++*/
++
++uint64 QString::toUInt64( bool *ok, int base ) const
++{
++    const QChar *p = unicode();
++    uint64 val=0;
++    int l = length();
++    const uint64 max_mult = 1844674407370955161ULL;  // ULLONG_MAX/10, rounded down
++    bool is_ok = FALSE;
++    if ( !p )
++	goto bye;
++    while ( l && p->isSpace() )			// skip leading space
++	l--,p++;
++    if ( *p == '+' )
++	l--,p++;
++
++    // NOTE: toULong() code is similar
++    if ( !l || !ok_in_base(*p,base) )
++	goto bye;
++    while ( l && ok_in_base(*p,base) ) {
++	l--;
++	uint dv;
++	if ( p->isDigit() ) {
++	    dv = p->digitValue();
++	} else {
++	    if ( *p >= 'a' && *p <= 'z' )
++		dv = *p - 'a' + 10;
++	    else
++		dv = *p - 'A' + 10;
++	}
++	if ( val > max_mult || (val == max_mult && dv > (ULLONG_MAX%base)) )
++	    goto bye;
++	val = base*val + dv;
++	p++;
++    }
++
++    while ( l && p->isSpace() )			// skip trailing space
++	l--,p++;
++    if ( !l )
++	is_ok = TRUE;
++bye:
++    if ( ok )
++	*ok = is_ok;
++    return is_ok ? val : 0;
++}
++
++
++/*!
+   Returns the string converted to a <code>short</code> value.
+ 
+   If \a ok is non-null, \a *ok is set to TRUE if there are no
+--- a/qtools/qstring.h
++++ b/qtools/qstring.h
+@@ -463,6 +463,7 @@ public:
+     uint	toUInt( bool *ok=0, int base=10 )	const;
+     long	toLong( bool *ok=0, int base=10 )	const;
+     ulong	toULong( bool *ok=0, int base=10 )	const;
++    uint64	toUInt64( bool *ok=0, int base=10 )	const;
+     float	toFloat( bool *ok=0 )	const;
+     double	toDouble( bool *ok=0 )	const;
+ 
+--- 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"
+ 
+@@ -2461,6 +2462,35 @@ QCString fileToString(const char *name,b
+ QCString dateToString(bool includeTime)
+ {
+   QDateTime current = QDateTime::currentDateTime();
++  QCString sourceDateEpoch = portable_getenv("SOURCE_DATE_EPOCH");
++  if (!sourceDateEpoch.isEmpty())
++  {
++    bool ok;
++    uint64 epoch = sourceDateEpoch.toUInt64(&ok);
++    if (!ok)
++    {
++      static bool warnedOnce=FALSE;
++      if (!warnedOnce)
++      {
++        warn_uncond("Environment variable SOURCE_DATE_EPOCH does not contain a valid number; value is '%s'\n",
++            sourceDateEpoch.data());
++        warnedOnce=TRUE;
++      }
++    }
++    else if (epoch>UINT_MAX)
++    {
++      static bool warnedOnce=FALSE;
++      if (!warnedOnce)
++      {
++        warn_uncond("Environment variable SOURCE_DATA_EPOCH must have a value smaller than or equal to %llu; actual value %llu\n",UINT_MAX,epoch);
++        warnedOnce=TRUE;
++      }
++    }
++    else // all ok, replace current time with epoch value
++    {
++      current.setTime_t((ulong)epoch); // TODO: add support for 64bit epoch value
++    }
++  }
+   return theTranslator->trDateTime(current.date().year(),
+                                    current.date().month(),
+                                    current.date().day(),
diff --git a/debian/patches/Modified-function-to-produce-timezone-independent-timestamps b/debian/patches/Modified-function-to-produce-timezone-independent-timestamps
new file mode 100644
index 0000000..e36c01f
--- /dev/null
+++ b/debian/patches/Modified-function-to-produce-timezone-independent-timestamps
@@ -0,0 +1,13 @@
+Description: Modified function QDateTime::setTime_t to produce timezone independent timestamps by using UTC
+
+--- doxygen-1.8.9.1.orig/qtools/qdatetime.cpp
++++ doxygen-1.8.9.1/qtools/qdatetime.cpp
+@@ -1142,7 +1142,7 @@ QDateTime::QDateTime( const QDate &date,
+ void QDateTime::setTime_t( uint secsSince1Jan1970UTC )
+ {
+     time_t tmp = (time_t) secsSince1Jan1970UTC;
+-    tm *tM = localtime( &tmp );
++    tm *tM = gmtime( &tmp );
+     if ( !tM ) {
+ 	tM = gmtime( &tmp );
+ 	if ( !tM ) {
diff --git a/debian/patches/series b/debian/patches/series
index 91b64ab..ab83593 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,5 @@ sqlite3-configure.diff
 issue742427.diff
 no-timestamps.diff
 default-no-timestamp.diff
+0001-Honour-SOURCE_DATE_EPOCH-environment-variable-for-re.patch
+Modified-function-to-produce-timezone-independent-timestamps

-- 
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