Source: libphonennumber
Version: 7.1.0-3
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: fileordering
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that libphonennumber could not be built reproducibly.
While generating the file geocoding_data.cc, it iterates over files in
readdir order.

The attached patch fixes this by sorting the list after the files are
collected.

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds
diff --git a/debian/patches/0010-reproducible-build.patch b/debian/patches/0010-reproducible-build.patch
new file mode 100644
index 0000000..c417026
--- /dev/null
+++ b/debian/patches/0010-reproducible-build.patch
@@ -0,0 +1,18 @@
+--- a/tools/cpp/src/cpp-build/generate_geocoding_data.cc
++++ b/tools/cpp/src/cpp-build/generate_geocoding_data.cc
+@@ -86,6 +86,7 @@
+ 
+   const std::string& name() const { return name_; }
+   DirEntryKinds kind() const { return kind_; }
++  bool operator<(const DirEntry& d) { return name_ < d.name() || kind_ < d.kind(); }
+ 
+  private:
+   std::string name_;
+@@ -109,6 +110,7 @@
+       return false;
+     }
+     if (dir_result == NULL) {
++      std::sort(entries->begin(), entries->end());
+       return true;
+     }
+     if (strcmp(entry.d_name, ".") == 0 || strcmp(entry.d_name, "..") == 0) {
diff --git a/debian/patches/series b/debian/patches/series
index ab7cb9c..e73a41e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@
 0006-main-lib-jdk5.patch
 0008-tools-jdk5.patch
 0009-maven-tests-forkmode.patch
+0010-reproducible-build.patch

Attachment: signature.asc
Description: 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