Source: libvirt-python
Version: 1.2.9-1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: randomness
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi,

While working on the "reproducible builds" effort [1], we have noticed
that libvirt-python could not be built reproducibly.

The attached patch removes randomess from the build system. Once
applied, libvirt-python can be built reproducibly in our reproducible
toolchain.

 [1]: https://wiki.debian.org/ReproducibleBuilds


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
diff -urNad 
libvirt-python.orig/libvirt-python-1.2.9/debian/patches/reproducible_build 
libvirt-python/libvirt-python-1.2.9/debian/patches/reproducible_build
--- libvirt-python.orig/libvirt-python-1.2.9/debian/patches/reproducible_build  
1970-01-01 01:00:00.000000000 +0100
+++ libvirt-python/libvirt-python-1.2.9/debian/patches/reproducible_build       
2015-03-03 22:40:36.200504422 +0000
@@ -0,0 +1,55 @@
+--- libvirt-python-1.2.9.orig/generator.py
++++ libvirt-python-1.2.9/generator.py
+@@ -1792,7 +1792,7 @@ def buildWrappers(module):
+             value = int(value)
+         except ValueError:
+             value = float('inf')
+-        return value
++        return value, data[0]
+ 
+     # Resolve only one level of reference
+     def resolveEnum(enum, data):
+@@ -1877,7 +1877,7 @@ def qemuBuildWrappers(module):
+     #
+     # Generate functions directly, no classes
+     #
+-    for name in list(qemu_functions.keys()):
++    for name in sorted(qemu_functions.keys()):
+         func = nameFixup(name, 'None', None, None)
+         (desc, ret, args, file, mod, cond) = qemu_functions[name]
+         fd.write("def %s(" % func)
+@@ -1927,10 +1927,10 @@ def qemuBuildWrappers(module):
+     #
+     # Generate enum constants
+     #
+-    for type,enum in list(qemu_enums.items()):
++    for type,enum in sorted(qemu_enums.items()):
+         fd.write("# %s\n" % type)
+         items = list(enum.items())
+-        items.sort(key=lambda i: int(i[1]))
++        items.sort(key=lambda i: (int(i[1]), i[0]))
+         for name,value in items:
+             fd.write("%s = %s\n" % (name,value))
+         fd.write("\n")
+@@ -1990,7 +1990,7 @@ def lxcBuildWrappers(module):
+     #
+     # Generate functions directly, no classes
+     #
+-    for name in list(lxc_functions.keys()):
++    for name in sorted(lxc_functions.keys()):
+         func = nameFixup(name, 'None', None, None)
+         (desc, ret, args, file, mod, cond) = lxc_functions[name]
+         fd.write("def %s(" % func)
+@@ -2040,10 +2040,10 @@ def lxcBuildWrappers(module):
+     #
+     # Generate enum constants
+     #
+-    for type,enum in list(lxc_enums.items()):
++    for type,enum in sorted(lxc_enums.items()):
+         fd.write("# %s\n" % type)
+         items = list(enum.items())
+-        items.sort(key=lambda i: int(i[1]))
++        items.sort(key=lambda i: (int(i[1]), i[0]))
+         for name,value in items:
+             fd.write("%s = %s\n" % (name,value))
+         fd.write("\n")
diff -urNad libvirt-python.orig/libvirt-python-1.2.9/debian/patches/series 
libvirt-python/libvirt-python-1.2.9/debian/patches/series
--- libvirt-python.orig/libvirt-python-1.2.9/debian/patches/series      
1970-01-01 01:00:00.000000000 +0100
+++ libvirt-python/libvirt-python-1.2.9/debian/patches/series   2015-03-03 
22:40:32.160324047 +0000
@@ -0,0 +1 @@
+reproducible_build
_______________________________________________
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