Package: opengl-4-html-doc
Version: 1.0~svn31251-1
Severity: wishlist
Tags: patch
Usertags: randomness


While working on the “reproducible builds” effort [1], we have noticed
that opengl-4-html-doc could not be built reproducibly [2].

Specifically, the incumbent index sorting emits the glMemoryBarrier and
memoryBarrier entries in random order, determined by readdir() and dict
iteration order.  The attached patch makes the index sorting
deterministic, such that those two entries are always emitted in the
same order.


(thanks to boyska on #debian-reproducible for correcting an earlier
draft of the patch)

diff --git a/debian/patches/reproducible.patch b/debian/patches/reproducible.patch
new file mode 100644
index 0000000..0ab9dcf
--- /dev/null
+++ b/debian/patches/reproducible.patch
@@ -0,0 +1,20 @@
+Description: Make the build reproducible: make index order independent of dict keys iteration order
+Author: Daniel Shahaf <>
+Forwarded: no
+Last-Update: 2016-05-03 
+--- khronos-opengl-man4-1.0~svn31251.orig/html/
++++ khronos-opengl-man4-1.0~svn31251/html/
+@@ -238,7 +238,10 @@ def sortedKeys(dict, whichKeys):
+             (whichKeys == 'api' and dict[key].apiCommand) or
+             (whichKeys == 'glsl' and not dict[key].apiCommand)):
+             list.append(key)
+-    list.sort(key=str.lower)
++    # Sort case-insensitively; the second tuple element is a tie breaker,
++    # making the order deterministic/reproducible.
++    keyFunc = lambda dictkey: (str.lower(dictkey), dictkey)
++    list.sort(key=keyFunc)
+     return list
+ # Generate accordion menu for this dictionary, titled as specified.
diff --git a/debian/patches/series b/debian/patches/series
index e686169..ff66dbf 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
Reproducible-builds mailing list

Reply via email to