Source: ibus-table
Version: 1.9.1-3
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: toolchain randomness
X-Debbugs-Cc: [email protected]
Hi,
While working on the "reproducible builds" effort [0], we have noticed
that ibus-table-createdb creates output with non-determinstic output
due to Python dict ordering.
The attached patch removes this randomness from the build system. Once
applied, packages using ibus-table can be built reproducibly in our
reproducible toolchain.
[0] https://wiki.debian.org/ReproducibleBuilds
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
diff --git a/engine/tabsqlitedb.py b/engine/tabsqlitedb.py
index 258c838..b8a858a 100644
--- a/engine/tabsqlitedb.py
+++ b/engine/tabsqlitedb.py
@@ -566,7 +566,7 @@ class tabsqlitedb:
VALUES (:tabkeys, :phrase, :freq, :user_freq);
''' %{'database': database}
insert_sqlargs = []
- for (tabkeys, phrase, freq, user_freq) in phrases:
+ for (tabkeys, phrase, freq, user_freq) in sorted(phrases):
insert_sqlargs.append({'tabkeys': tabkeys, 'phrase': phrase,
'freq': freq, 'user_freq': user_freq})
self.db.executemany(insert_sqlstr, insert_sqlargs)
self.db.commit()