Make the generated pkgconfig files reproducible.
Whilst working on the Reproducible Builds effort [0], we noticed
that meson creates non-reproducible pkgconfig files as it relies
on Python set ordering.
This was originally filed in Debian as [1].
[0]
[1]
@@ -124,11 +124,18 @@ class DependenciesHelper:
return processed_libs, processed_reqs, processed_cflags
def remove_dups(self):
- self.pub_libs = list(set(self.pub_libs))
- self.pub_reqs = list(set(self.pub_reqs))
- self.priv_libs = list(set(self.priv_libs))
- self.priv_reqs = list(set(self.priv_reqs))
- self.cflags = list(set(self.cflags))
+ def _fn(xs):
+ # Remove duplicates whilst preserving original order
+ result = []
+ for x in xs:
+ if x not in result:
+ result.append(x)
+ return result
+ self.pub_libs = _fn(self.pub_libs)
+ self.pub_reqs = _fn(self.pub_reqs)
+ self.priv_libs = _fn(self.priv_libs)
+ self.priv_reqs = _fn(self.priv_reqs)
+ self.cflags = _fn(self.cflags)
# Remove from private libs/reqs if they are in public already
self.priv_libs = [i for i in self.priv_libs if i not in self.pub_libs]
