Merge pull request #231893 from delroth/libphonenumber-repro

libphonenumber: patch code generation tool for build reproducibility

authored by

Pierre Bourdon and committed by
GitHub
19dba7e4 e2bde0d4

+29
+24
pkgs/development/libraries/libphonenumber/build-reproducibility.patch
···
··· 1 + diff --git a/tools/cpp/src/cpp-build/generate_geocoding_data.cc b/tools/cpp/src/cpp-build/generate_geocoding_data.cc 2 + index 205947e831..1e628e2cd2 100644 3 + --- a/tools/cpp/src/cpp-build/generate_geocoding_data.cc 4 + +++ b/tools/cpp/src/cpp-build/generate_geocoding_data.cc 5 + @@ -97,7 +97,8 @@ class DirEntry { 6 + DirEntryKinds kind_; 7 + }; 8 + 9 + -// Lists directory entries in path. "." and ".." are excluded. Returns true on 10 + +// Lists directory entries in path. "." and ".." are excluded. Entries are 11 + +// returned in a consistent order to ensure reproducibility. Returns true on 12 + // success. 13 + bool ListDirectory(const string& path, vector<DirEntry>* entries) { 14 + entries->clear(); 15 + @@ -135,6 +136,9 @@ bool ListDirectory(const string& path, vector<DirEntry>* entries) { 16 + } 17 + entries->push_back(DirEntry(entry->d_name, kind)); 18 + } 19 + + std::sort( 20 + + entries->begin(), entries->end(), 21 + + [](const DirEntry& a, const DirEntry& b) { return a.name() < b.name(); }); 22 + } 23 + 24 + // Returns true if s ends with suffix.
+5
pkgs/development/libraries/libphonenumber/default.nix
··· 11 sha256 = "sha256-xLxadSxVY3DjFDQrqj3BuOvdMaKdFSLjocfzovJCBB0="; 12 }; 13 14 nativeBuildInputs = [ 15 cmake 16 pkg-config
··· 11 sha256 = "sha256-xLxadSxVY3DjFDQrqj3BuOvdMaKdFSLjocfzovJCBB0="; 12 }; 13 14 + patches = [ 15 + # Submitted upstream: https://github.com/google/libphonenumber/pull/2921 16 + ./build-reproducibility.patch 17 + ]; 18 + 19 nativeBuildInputs = [ 20 cmake 21 pkg-config