[neon/forks/pyqt5/Neon/release] debian: Add a patch to make pyrcc5 generate reproducible output.
Dmitry Shachnev
null at kde.org
Mon Sep 2 12:05:42 BST 2024
Git commit b214dbe6f51228ffbc7be1e39a86350ef8a09f43 by Dmitry Shachnev.
Committed on 08/07/2023 at 17:07.
Pushed by jriddell into branch 'Neon/release'.
Add a patch to make pyrcc5 generate reproducible output.
Thanks Chris Lamb and Timo Röhling!
Closes: #1024114.
M +7 -0 debian/changelog
A +73 -0 debian/patches/reproducible_pyrcc5.patch
M +1 -0 debian/patches/series
https://invent.kde.org/neon/forks/pyqt5/-/commit/b214dbe6f51228ffbc7be1e39a86350ef8a09f43
diff --git a/debian/changelog b/debian/changelog
index 54b79224..b7df73e9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+pyqt5 (5.15.9+dfsg-2) UNRELEASED; urgency=medium
+
+ * Add a patch to make pyrcc5 generate reproducible output
+ (closes: #1024114). Thanks Chris Lamb and Timo Röhling!
+
+ -- Dmitry Shachnev <mitya57 at debian.org> Sat, 08 Jul 2023 20:01:32 +0300
+
pyqt5 (5.15.9+dfsg-1) unstable; urgency=medium
* New upstream release.
diff --git a/debian/patches/reproducible_pyrcc5.patch b/debian/patches/reproducible_pyrcc5.patch
new file mode 100644
index 00000000..99db1b77
--- /dev/null
+++ b/debian/patches/reproducible_pyrcc5.patch
@@ -0,0 +1,73 @@
+From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling at debian.org>
+Date: Fri, 7 Jul 2023 16:33:28 +0200
+Subject: Make pyrcc5 reproducible
+
+This patch applies the deterministic sorting with qt_hash
+to the actual data blobs, which makes the resulting _rc.py
+files bit-for-bit identical if the input data are the same.
+
+Bug-Debian: https://bugs.debian.org/1024114
+---
+ qpy/pyrcc/rcc.cpp | 28 +++++++++++++++++-----------
+ 1 file changed, 17 insertions(+), 11 deletions(-)
+
+diff --git a/qpy/pyrcc/rcc.cpp b/qpy/pyrcc/rcc.cpp
+index cb4a918..5426191 100644
+--- a/qpy/pyrcc/rcc.cpp
++++ b/qpy/pyrcc/rcc.cpp
+@@ -442,6 +442,11 @@ RCCResourceLibrary::writeHeader(FILE *out)
+ return true;
+ }
+
++static bool qt_rcc_compare_hash(const RCCFileInfo *left, const RCCFileInfo *right)
++{
++ return qt_hash(left->name) < qt_hash(right->name);
++}
++
+ bool
+ RCCResourceLibrary::writeDataBlobs(FILE *out)
+ {
+@@ -455,9 +460,12 @@ RCCResourceLibrary::writeDataBlobs(FILE *out)
+ qint64 offset = 0;
+ while(!pending.isEmpty()) {
+ RCCFileInfo *file = pending.pop();
+- for(QHash<QString, RCCFileInfo*>::iterator it = file->children.begin();
+- it != file->children.end(); ++it) {
+- RCCFileInfo *child = it.value();
++ //sort deterministically for reproducible builds
++ QList<RCCFileInfo*> children = file->children.values();
++ qSort(children.begin(), children.end(), qt_rcc_compare_hash);
++
++ for(int i = 0; i < children.size(); ++i) {
++ RCCFileInfo *child = children.at(i);
+ if(child->flags & RCCFileInfo::Directory)
+ pending.push(child);
+ else
+@@ -483,9 +491,12 @@ RCCResourceLibrary::writeDataNames(FILE *out)
+ qint64 offset = 0;
+ while(!pending.isEmpty()) {
+ RCCFileInfo *file = pending.pop();
+- for(QHash<QString, RCCFileInfo*>::iterator it = file->children.begin();
+- it != file->children.end(); ++it) {
+- RCCFileInfo *child = it.value();
++ //sort deterministically for reproducible builds
++ QList<RCCFileInfo*> children = file->children.values();
++ qSort(children.begin(), children.end(), qt_rcc_compare_hash);
++
++ for(int i = 0; i < children.size(); ++i) {
++ RCCFileInfo *child = children.at(i);
+ if(child->flags & RCCFileInfo::Directory)
+ pending.push(child);
+ if(names.contains(child->name)) {
+@@ -500,11 +511,6 @@ RCCResourceLibrary::writeDataNames(FILE *out)
+ return true;
+ }
+
+-static bool qt_rcc_compare_hash(const RCCFileInfo *left, const RCCFileInfo *right)
+-{
+- return qt_hash(left->name) < qt_hash(right->name);
+-}
+-
+ bool RCCResourceLibrary::writeDataStructure(FILE *out, int version)
+ {
+ fprintf(out, "qt_resource_struct_v%d = b\"\\\n", version);
diff --git a/debian/patches/series b/debian/patches/series
index 5aefe304..0911292d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
getdefaultlocale.patch
+reproducible_pyrcc5.patch
More information about the Neon-commits
mailing list