Skip to content

Commit

Permalink
Allow to override resource file date
Browse files Browse the repository at this point in the history
because some packages create resource input files at build time
and thus get the build date embedded in binaries,
so that they differ for each build.

See https://reproducible-builds.org/ for why this matters
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

Task-number: QTBUG-62511
Change-Id: I8908ac6182fab066e6ea398df2567f6d050c77e7
Reviewed-by: hjk <hjk@qt.io>
  • Loading branch information
bmwiedemann authored and hjk committed Nov 13, 2017
1 parent 3e4d320 commit 38271e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tools/rcc/rcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)
if (lib.formatVersion() >= 2) {
// last modified time stamp
const QDateTime lastModified = m_fileInfo.lastModified();
lib.writeNumber8(quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0));
quint64 lastmod = quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0);
static const quint64 sourceDate = 1000 * qgetenv("QT_RCC_SOURCE_DATE_OVERRIDE").toULongLong();
if (sourceDate != 0)
lastmod = sourceDate;
lib.writeNumber8(lastmod);
if (text || pass1)
lib.writeChar('\n');
}
Expand Down

5 comments on commit 38271e9

@daym
Copy link

@daym daym commented on 38271e9 Jan 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you not call this variable SOURCE_DATE_EPOCH like the standard says? What a missed opportunity for simplicity.

@bmwiedemann
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daym: There was a policy to prefix variables with QT_ and I did not want to discuss more with the reviewer.
But later, this was merged:
https://codereview.qt-project.org/#/c/243636/4/src/tools/rcc/rcc.cpp,unified

@daym
Copy link

@daym daym commented on 38271e9 Jan 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It's good to have that link here because distributors like us have to find out how make the builds reproducible somehow. So eventually just SOURCE_DATE_EPOCH alone will work, too. Cool!

For the record, qtbase-everywhere-src-5.11.2 doesn't contain the latter patch.

@bmwiedemann
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5.12 does not either, so maybe 5.13 will. We added the linked patch on top of our openSUSE qt packages, though.

@bmwiedemann
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To learn about these things faster, you can read our blog posts or search the git repo for "qtbase" to find info on updates

Please sign in to comment.