Source: qt4-x11
Version: 4:4.8.7+dfsg-5
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

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.

Some months ago I sent a patch to fix this issue by enabling
qhelpgenerator to use the environment variable SOURCE_DATE_EPOCH when
embedding timestamps [1]. 

Sune Vuorela suggested that it would be better to backport the solution
he implemented for qt5 to solve this same issue, which consists in
replacing the embedded timestamp by a fixed one [2] and which is already
upstream.

The attached patch solves the reproducible timestamps issue in the same
way as it is solved in qt5 upstream.  With the attached patch packages
using qhelpgenerator would then automatically embed reproducible
timestamps in qch files.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=794681
[2] https://codereview.qt-project.org/#/c/106296/

Cheers
-- 
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-11-30 20:13:35.000000000 +0100
+++ qt4-x11-4.8.7+dfsg/debian/changelog 2016-02-09 18:43:42.000000000 +0100
@@ -1,3 +1,12 @@
+qt4-x11 (4:4.8.7+dfsg-5.0~reproducible0) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Backport patch from qttools5 [1] to make qch files reproducible by
+    replacing the current time by a fixed date.  
+    [1] https://codereview.qt-project.org/#/c/106296/
+
+ -- Eduard Sanou <dh...@openmailbox.org>  Tue, 09 Feb 2016 13:34:21 +0100
+
 qt4-x11 (4:4.8.7+dfsg-5) unstable; urgency=medium
 
   * Add no-ssl3.patch to avoid calling SSLv3 functions as they have been 
removed
diff -Nru 
qt4-x11-4.8.7+dfsg/debian/patches/replace_timestamps_with_fixed_date_in_qhelpgenerator.patch
 
qt4-x11-4.8.7+dfsg/debian/patches/replace_timestamps_with_fixed_date_in_qhelpgenerator.patch
--- 
qt4-x11-4.8.7+dfsg/debian/patches/replace_timestamps_with_fixed_date_in_qhelpgenerator.patch
        1970-01-01 01:00:00.000000000 +0100
+++ 
qt4-x11-4.8.7+dfsg/debian/patches/replace_timestamps_with_fixed_date_in_qhelpgenerator.patch
        2016-02-09 18:49:02.000000000 +0100
@@ -0,0 +1,51 @@
+Description: Replace timestamps from qhelpgenerator by a fixed date 
+ In order to make qhelpgenerator output reproducible, we need a way to get
+ deterministic embedded timestaps.  Backport the patch from qttools5 [1] to
+ make qch files reproducible by replacing the current time by a fixed date.  
+
+ [1] https://codereview.qt-project.org/#/c/106296/
+Author: Eduard Sanou <dh...@openmailbox.org>
+
+---
+
+Index: qt4-x11-4.8.7+dfsg/tools/assistant/lib/qhelpgenerator.cpp
+===================================================================
+--- qt4-x11-4.8.7+dfsg.orig/tools/assistant/lib/qhelpgenerator.cpp
++++ qt4-x11-4.8.7+dfsg/tools/assistant/lib/qhelpgenerator.cpp
+@@ -380,9 +380,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->exec();
++    d->query->exec(QLatin1String("INSERT INTO MetaDataTable 
VALUES('CreationDate', '2012-12-20T12:00:00Z')"));
+ 
+     return true;
+ }
+Index: qt4-x11-4.8.7+dfsg/tools/assistant/tools/qcollectiongenerator/main.cpp
+===================================================================
+--- 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::fromString("2012-12-20T12:00:00Z", 
Qt::ISODate).toUTC().toTime_t());
+     CollectionConfiguration::setFullTextSearchFallbackEnabled(helpEngine,
+         config.fullTextSearchFallbackEnabled());
+ 
+Index: 
qt4-x11-4.8.7+dfsg/tools/assistant/tools/shared/collectionconfiguration.cpp
+===================================================================
+--- 
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::fromString("2012-12-20T12:00:00Z", Qt::ISODate).toUTC());
+ }
+ 
+ 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-11-30 19:12:17.000000000 
+0100
+++ qt4-x11-4.8.7+dfsg/debian/patches/series    2016-02-09 13:43:11.000000000 
+0100
@@ -56,3 +56,4 @@
 QtScript_x32_config.diff
 x32.diff
 no-ssl3.patch
+replace_timestamps_with_fixed_date_in_qhelpgenerator.patch

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to