On 08/05/2015 06:03 PM, Dhole wrote: > Source: qt4-x11 > Version: 4:4.8.7+dfsg-2 > Severity: wishlist > Tags: patch > User: reproducible-builds@lists.alioth.debian.org > Usertags: toolchain timestamps > X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org > > Hi, > > While working on the "reproducible builds" effort [1], we have noticed > that the qhelpgenerator tool from qt4-x11 embeds timestamps on the > creation of qch files. > > For the Reproducible Builds effort we are proposing an environment > variable (SOURCE_DATE_EPOCH) [2] that will contain a deterministic epoch > timestamp (based on the latest debian/changelog entry) that could be > used, which should be automatically exported by debhelper in the future [3]. > > The attached patch proposes a way to use this variable to get > reproducible timestamps in the qch files generated by qhelpgenerator, if > the variable has been set (if not, it falls back to the old behavior). > With the attached patch packages using qhelpgenerator would then > automatically embed reproducible timestamps in qch files. > > > [1]: https://wiki.debian.org/ReproducibleBuilds > [2]: https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal > [3]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=791815 > > Regards, > > > > _______________________________________________ > Reproducible-builds mailing list > Reproducible-builds@lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds >
Hi I'm attaching an update of the submitted patch targeting the latest qt4-x11 version from Debian: 4:4.8.7+dfsg-3 Regards, -- Dhole
diff -Nru qt4-x11-4.8.7+dfsg/debian/changelog qt4-x11-4.8.7+dfsg/debian/changelog --- qt4-x11-4.8.7+dfsg/debian/changelog 2015-08-04 23:13:58.000000000 +0200 +++ qt4-x11-4.8.7+dfsg/debian/changelog 2015-08-10 19:35:51.000000000 +0200 @@ -1,3 +1,11 @@ +qt4-x11 (4:4.8.7+dfsg-3.0~reproducible1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Add support for reproducible builds by using $SOURCE_DATE_EPOCH as the + embedded timestamps in qch files generated with qhelpgenerator. + + -- Eduard Sanou <dh...@openmailbox.org> Mon, 10 Aug 2015 19:35:09 +0200 + qt4-x11 (4:4.8.7+dfsg-3) unstable; urgency=medium * Update symbols files with buildds' logs. diff -Nru qt4-x11-4.8.7+dfsg/debian/patches/Replace_timestamp_with_SOURCE_DATE_EPOCH_in_qhelpgenerator.patch qt4-x11-4.8.7+dfsg/debian/patches/Replace_timestamp_with_SOURCE_DATE_EPOCH_in_qhelpgenerator.patch --- qt4-x11-4.8.7+dfsg/debian/patches/Replace_timestamp_with_SOURCE_DATE_EPOCH_in_qhelpgenerator.patch 1970-01-01 01:00:00.000000000 +0100 +++ qt4-x11-4.8.7+dfsg/debian/patches/Replace_timestamp_with_SOURCE_DATE_EPOCH_in_qhelpgenerator.patch 2015-08-10 19:39:59.000000000 +0200 @@ -0,0 +1,102 @@ +Description: Allow the timestamps from qhelpgenerator to be externally set + In order to make qhelpgenerator output reproducible, we need a way to + set the embedded timestamps to other values than the current time. + We define a new method for QDateTime (reproducibleDateTime) that returns + a deterministic datetime object when the SOURCE_DATE_EPOCH environment + variable is set with a unix epoch timestamp, containing the datetime + defined by SOURCE_DATE_EPOCH in UTC. We replace some instances of + QDateTime::currentDateTime() by QDateTime::reproducibleDateTime() in the + sources of qhelpgenerator to make the output reproducible. +Author: Eduard Sanou <dh...@openmailbox.org> + +--- qt4-x11-4.8.7+dfsg.orig/src/corelib/tools/qdatetime.cpp ++++ qt4-x11-4.8.7+dfsg/src/corelib/tools/qdatetime.cpp +@@ -2892,6 +2892,15 @@ bool QDateTime::operator<(const QDateTim + */ + + /*! ++ \fn QDateTime QDateTime::reproducibleDateTime() ++ If the environment variable SOURCE_DATE_EPOCH containing a unix epoch date ++ is set, returns the datetime in SOURCE_DATE_EPOCH, in UTC. ++ If SOURCE_DATE_EPOCH is not set, behaves as QDateTime::currentDateTime(). ++ ++ \sa currentDateTimeUtc(), QDate::currentDate(), QTime::currentTime(), toTimeSpec() ++*/ ++ ++/*! + \fn QDateTime QDateTime::currentDateTimeUtc() + \since 4.7 + Returns the current datetime, as reported by the system clock, in +@@ -3120,6 +3129,29 @@ QDateTime QDateTime::currentDateTime() + return dt; + } + ++QDateTime QDateTime::reproducibleDateTime() ++{ ++ QByteArray env_date; ++ QDateTime date; ++ bool env_date_ok; ++ long timestamp; ++ ++ env_date = qgetenv("SOURCE_DATE_EPOCH"); ++ if (env_date.length() != 0) { ++ timestamp = env_date.toLong(&env_date_ok, 10); ++ if (!env_date_ok) { ++ // "SOURCE_DATE_EPOCH is not a number! ++ timestamp = 0; ++ } ++ date = QDateTime::fromTime_t(timestamp).toUTC(); ++ } else { ++ date = QDateTime::currentDateTime(); ++ } ++ ++ return date; ++} ++ ++ + QDateTime QDateTime::currentDateTimeUtc() + { + // posix compliant system +--- qt4-x11-4.8.7+dfsg.orig/src/corelib/tools/qdatetime.h ++++ qt4-x11-4.8.7+dfsg/src/corelib/tools/qdatetime.h +@@ -264,6 +264,7 @@ public: + int utcOffset() const; + + static QDateTime currentDateTime(); ++ static QDateTime reproducibleDateTime(); + static QDateTime currentDateTimeUtc(); + #ifndef QT_NO_DATESTRING + static QDateTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); +--- qt4-x11-4.8.7+dfsg.orig/tools/assistant/lib/qhelpgenerator.cpp ++++ qt4-x11-4.8.7+dfsg/tools/assistant/lib/qhelpgenerator.cpp +@@ -381,7 +381,7 @@ bool QHelpGenerator::createTables() + d->query->exec(QLatin1String("INSERT INTO MetaDataTable VALUES('qchVersion', '1.0')")); + + d->query->prepare(QLatin1String("INSERT INTO MetaDataTable VALUES('CreationDate', ?)")); +- d->query->bindValue(0, QDateTime::currentDateTime().toString(Qt::ISODate)); ++ d->query->bindValue(0, QDateTime::reproducibleDateTime().toString(Qt::ISODate)); + d->query->exec(); + + return true; +--- qt4-x11-4.8.7+dfsg.orig/tools/assistant/tools/qcollectiongenerator/main.cpp ++++ qt4-x11-4.8.7+dfsg/tools/assistant/tools/qcollectiongenerator/main.cpp +@@ -521,7 +521,7 @@ int main(int argc, char *argv[]) + CollectionConfiguration::setAddressBarVisible(helpEngine, + !config.hideAddressBar()); + CollectionConfiguration::setCreationTime(helpEngine, +- QDateTime::currentDateTime().toTime_t()); ++ QDateTime::reproducibleDateTime().toTime_t()); + CollectionConfiguration::setFullTextSearchFallbackEnabled(helpEngine, + config.fullTextSearchFallbackEnabled()); + +--- qt4-x11-4.8.7+dfsg.orig/tools/assistant/tools/shared/collectionconfiguration.cpp ++++ qt4-x11-4.8.7+dfsg/tools/assistant/tools/shared/collectionconfiguration.cpp +@@ -282,7 +282,7 @@ const QDateTime CollectionConfiguration: + + void CollectionConfiguration::updateLastRegisterTime(QHelpEngineCore &helpEngine) + { +- helpEngine.setCustomValue(LastRegisterTime, QDateTime::currentDateTime()); ++ helpEngine.setCustomValue(LastRegisterTime, QDateTime::reproducibleDateTime()); + } + + bool CollectionConfiguration::isNewer(const QHelpEngineCore &newer, diff -Nru qt4-x11-4.8.7+dfsg/debian/patches/series qt4-x11-4.8.7+dfsg/debian/patches/series --- qt4-x11-4.8.7+dfsg/debian/patches/series 2015-08-02 20:14:37.000000000 +0200 +++ qt4-x11-4.8.7+dfsg/debian/patches/series 2015-08-10 19:38:30.000000000 +0200 @@ -55,3 +55,4 @@ parisc-atomic.patch QtScript_x32_config.diff x32.diff +Replace_timestamp_with_SOURCE_DATE_EPOCH_in_qhelpgenerator.patch
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Reproducible-builds mailing list Reproducible-builds@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds