Package: opengl-4-html-doc
Version: 1.0~svn31251-1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: randomness

Hi!

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.

Cheers,

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

 [1]: https://wiki.debian.org/ReproducibleBuilds
 [2]: 
https://tests.reproducible-builds.org/rb-pkg/unstable/amd64/khronos-opengl-man4.html
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 <danie...@apache.org>
+Forwarded: no
+Last-Update: 2016-05-03 
+Bug-Debian: https://bugs.debian.org/-1
+
+--- khronos-opengl-man4-1.0~svn31251.orig/html/makeindex.py
++++ khronos-opengl-man4-1.0~svn31251/html/makeindex.py
+@@ -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 @@
 addingmanpages.patch
 db5.patch
 use_local_mathjax.patch
+reproducible.patch
_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to