[Reproducible-commits] [qt4-x11] 01/01: Added patch to honour SOURCE_DATE_EPOCH in files generated by qhelpgenerator
Eduard Sanou
dhole-guest at moszumanska.debian.org
Wed Aug 5 14:18:57 UTC 2015
This is an automated email from the git hooks/post-receive script.
dhole-guest pushed a commit to branch pu/reproducible_builds
in repository qt4-x11.
commit ee300f6185ce82eb932dbe1b2dca2113b88afb56
Author: Eduard Sanou <dhole at openmailbox.com>
Date: Wed Aug 5 16:18:36 2015 +0200
Added patch to honour SOURCE_DATE_EPOCH in files generated by qhelpgenerator
---
debian/changelog | 8 ++
..._with_SOURCE_DATE_EPOCH_in_qhelpgenerator.patch | 102 +++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 111 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 1082576..e4f3430 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+qt4-x11 (4:4.8.7+dfsg-2.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 <dhole at openmailbox.org> Tue, 04 Aug 2015 15:17:35 +0200
+
qt4-x11 (4:4.8.7+dfsg-2) experimental; urgency=medium
* Add Daniel Schepler's QtScript_x32_config.diff and x32.diff to let Qt4
diff --git a/debian/patches/Replace_timestamp_with_SOURCE_DATE_EPOCH_in_qhelpgenerator.patch b/debian/patches/Replace_timestamp_with_SOURCE_DATE_EPOCH_in_qhelpgenerator.patch
new file mode 100644
index 0000000..1b054ed
--- /dev/null
+++ b/debian/patches/Replace_timestamp_with_SOURCE_DATE_EPOCH_in_qhelpgenerator.patch
@@ -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 <dhole at 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 --git a/debian/patches/series b/debian/patches/series
index 01417d6..2c25a38 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -55,3 +55,4 @@ remove_addsense.patch
parisc-atomic.patch
QtScript_x32_config.diff
x32.diff
+Replace_timestamp_with_SOURCE_DATE_EPOCH_in_qhelpgenerator.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/qt4-x11.git
More information about the Reproducible-commits
mailing list