Source: cppreference-doc
Version: 20140827+dfsg0-1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: fileordering

Hi,

the package can currently not be build reproducibly, because
files are not read in a deterministic order.
The attached patch fixes this by sorting files/items before they
are used to produce output that will land in the package.

Regards,
 Reiner

diff --git a/debian/changelog b/debian/changelog
index fb2a400..e8708be 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+cppreference-doc (20140827+dfsg0-1.0~reproducible1) UNRELEASED; urgency=low
+
+  * Added patch 04-enable-deterministic-build.patch that makes building
+    the package deterministic/reproducible.
+
+ -- Reiner Herrmann <rei...@reiner-h.de>  Sun, 04 Jan 2015 02:32:33 +0100
+
 cppreference-doc (20140827+dfsg0-1) unstable; urgency=low
 
   * New upstream release.
diff --git a/debian/patches/04-enable-deterministic-build.patch b/debian/patches/04-enable-deterministic-build.patch
new file mode 100644
index 0000000..5dcbd6b
--- /dev/null
+++ b/debian/patches/04-enable-deterministic-build.patch
@@ -0,0 +1,83 @@
+Description: make build process deterministic by sorting files
+Author: Reiner Herrmann <rei...@reiner-h.de>
+
+index de7e21c..ba364df 100644
+--- a/Makefile
++++ b/Makefile
+@@ -172,7 +172,7 @@ output/qch-help-project-cpp.xml: output/cppreference-doc-en-cpp.devhelp2
+ 
+ 	pushd "output/reference" > /dev/null; \
+ 	find . -type f -not -iname "*.ttf" \
+-		-exec echo "<file>"'{}'"</file>" >> "../qch-files.xml" \; ; \
++		-exec echo "<file>"'{}'"</file>" \; | LC_ALL=C sort >> "../qch-files.xml" ; \
+ 	popd > /dev/null
+ 
+ 	echo "</files>" >> "output/qch-files.xml"
+index 8845e69..7d1fa4b 100755
+--- a/build_link_map.py
++++ b/build_link_map.py
+@@ -37,7 +37,7 @@ def build_link_map(directory):
+ 
+     link_map = LinkMap()
+ 
+-    for fn in html_files:
++    for fn in sorted(html_files):
+         f = open(fn, "r", encoding='utf-8')
+         text = f.read()
+         f.close()
+index 621e3f4..99de3ca 100755
+--- a/index2doxygen-tag.py
++++ b/index2doxygen-tag.py
+@@ -21,6 +21,7 @@
+ from index_transform import IndexTransform
+ from xml_utils import xml_escape
+ from link_map import LinkMap
++from functools import total_ordering
+ import sys
+ 
+ if len(sys.argv) != 4:
+@@ -51,6 +52,7 @@ class ItemKind:
+     TYPEDEF = 3,
+     NAMESPACE = 4
+ 
++@total_ordering
+ class Item:
+ 
+     def __init__(self):
+@@ -60,6 +62,12 @@ class Item:
+         self.link = ""
+         self.members = {}
+ 
++    def __eq__(self, other):
++        return self.full_name == other.full_name
++
++    def __lt__(self, other):
++        return self.full_name < other.full_name
++
+ ns_map = Item()
+ 
+ def add_to_map(full_name, full_link, item_kind):
+@@ -108,7 +116,7 @@ def add_to_map(full_name, full_link, item_kind):
+ 
+ def print_members(out_f, curr_item):
+     global link_map
+-    for item in curr_item.members.values():
++    for item in sorted(curr_item.members.values()):
+         if link_map:
+             link = link_map.get_dest(item.link)
+             if link == None and item.kind != ItemKind.NAMESPACE:
+@@ -151,12 +159,12 @@ def print_map_item(out_f, curr_item):
+     print_members(out_f, curr_item)
+     out_f.write('  </compound>\n')
+ 
+-    for item in curr_item.members.values():
++    for item in sorted(curr_item.members.values()):
+         if item.kind in [ ItemKind.NAMESPACE, ItemKind.CLASS ]:
+             print_map_item(out_f, item)
+ 
+ def print_map(out_f, ns_map):
+-    for item in ns_map.members.values():
++    for item in sorted(ns_map.members.values()):
+         if item.kind in [ ItemKind.NAMESPACE, ItemKind.CLASS ]:
+             print_map_item(out_f, item)
+         else:
diff --git a/debian/patches/series b/debian/patches/series
index 645f20d..bf8170e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 01-do-not-distribute-fonts.patch
 02-force-utf8-encoding.patch
 03-remove_extra_license_files.patch
+04-enable-deterministic-build.patch

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
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