earbuds: disable updateScript (#374592)
[NixPkgs.git] / pkgs / development / libraries / libphonenumber / build-reproducibility.patch
blob137c9045c77daf79ea9f78f2edff2c7936897f8d
1 --- a/tools/cpp/src/cpp-build/generate_geocoding_data.cc.orig 1970-01-01 01:00:01.000000000 +0100
2 +++ b/tools/cpp/src/cpp-build/generate_geocoding_data.cc 2024-01-16 19:03:45.409089423 +0100
3 @@ -94,7 +94,8 @@
4 DirEntryKinds kind_;
5 };
7 -// Lists directory entries in path. "." and ".." are excluded. Returns true on
8 +// Lists directory entries in path. "." and ".." are excluded. Entries are
9 +// returned in a consistent order to ensure reproducibility. Returns true on
10 // success.
11 bool ListDirectory(const string& path, vector<DirEntry>* entries) {
12 entries->clear();
13 @@ -114,8 +115,14 @@
14 // http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html
15 errno = 0;
16 entry = readdir(dir);
17 + if (errno != 0) {
18 + return false;
19 + }
20 if (entry == NULL) {
21 - return errno == 0;
22 + std::sort(
23 + entries->begin(), entries->end(),
24 + [](const DirEntry& a, const DirEntry& b) { return a.name() < b.name(); });
25 + return true;
27 if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) {
28 continue;