diff options
author | Chris Lamb <lamby@debian.org> | 2023-11-20 09:53:01 +0000 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2023-11-22 22:08:35 +0200 |
commit | 2ed94ccb47b597990b63207b272a5b3dea4a4877 (patch) | |
tree | 00e4cbf79c9365127741b8080b0eb164982e9964 /mesonbuild/modules/pkgconfig.py | |
parent | dfd8cfbd8d9ce03473cb17a722400cb4a8d1b67e (diff) | |
download | meson-2ed94ccb47b597990b63207b272a5b3dea4a4877.zip meson-2ed94ccb47b597990b63207b272a5b3dea4a4877.tar.gz meson-2ed94ccb47b597990b63207b272a5b3dea4a4877.tar.bz2 |
Make the Requires.private line in generated .pkgconfig files reproducible
Whilst working on the Reproducible Builds effort, we noticed that
meson was generates .pkgconfig files that are not reproducible.
For example, here is neatvnc's pkgconfig file when built with HEAD^1:
Name: neatvnc
Description: A Neat VNC server library
Version: 0.7.0
-Requires.private: pixman-1, aml < 0.4.0, aml >= 0.3.0, zlib, libdrm, libturbojpeg, gnutls, nettle, hogweed, gmp, gbm, libavcodec, libavfilter, libavutil
+Requires.private: pixman-1, aml >= 0.3.0, aml < 0.4.0, zlib, libdrm, libturbojpeg, gnutls, nettle, hogweed, gmp, gbm, libavcodec, libavfilter, libavutil
Libs: -L${libdir} -lneatvnc
Libs.private: -lm
Cflags: -I${includedir}
This is, ultimately, due to iterating over the contents of a set within a
DefaultDict and can thus be fixed by sorting the output immediately prior to
generating the Requires.private string.
An alternative solution would be to place the sorted(…) call a few lines
down:
return ', '.join(sorted(result))
However, this changes the expected ordering of the entire line, and many users
may be unhappy with that (alternative) change as a result. By contrast, this
commit will only enforce an ordering when there are multiple version
requirements (eg. a lower and a higher version requirement, ie. a version
range). It will, additionally, order them with the lower part of the range
first.
This was originally filed (with a slightly different patch) by myself in
the the Debian bug tracker <https://bugs.debian.org/1056117>.
Signed-off-by: Chris Lamb <lamby@debian.org>
Diffstat (limited to 'mesonbuild/modules/pkgconfig.py')
-rw-r--r-- | mesonbuild/modules/pkgconfig.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py index ee12293..fa543fd 100644 --- a/mesonbuild/modules/pkgconfig.py +++ b/mesonbuild/modules/pkgconfig.py @@ -307,7 +307,7 @@ class DependenciesHelper: for name in reqs: vreqs = self.version_reqs.get(name, None) if vreqs: - result += [name + ' ' + self.format_vreq(vreq) for vreq in vreqs] + result += [name + ' ' + self.format_vreq(vreq) for vreq in sorted(vreqs)] else: result += [name] return ', '.join(result) |