Hello, On Tue, 29 Nov 2022, at 13:54, Helmut Grohne wrote: > I think this is none of dpkg's business. It's much like shared library > dependencies, python dependencies and lots of other kinds. The usual way > to do this is to have some tool that generates a substitution variables > and debian/control uses it. > > Let me sketch something realistic. > > The pkgconf binary package gains a new script dh_pkgconf. This should be > run after dh_auto_install and dh_install. It goes through all > per-package installation directories and collects all installed .pc > files from the usual paths (usr/lib/pkgconfig, > usr/lib/<triplet>/pkgconfig and usr/share/pkgconfig). Then it locates > all direct Requires and Requires.private and looks up the corresponding > .pc files in the directories mentioned above and looks up the owning > packages using dpkg -S. It then issues a per-package substitution > variable ${pkgconf:Depends} to debian/<package>.substvars containing the > located packages. For convenience, pkgconf also provides a debhelper > sequence and Provides: dh-sequence-pkgconf. To use this new > functionality, e.g. cryptsetup would have to add the build dependency on > the sequence and add ${pkgconf:Depends} to libcryptsetup-dev's Depends. > > Andrej, does that make sense to you? > > I was also briefly looking into implementing this. Iterating over the > packages and the .pc files is relatively simple, but figuring the direct > Requires and Requires.private seems non-trivial. pkgconf > --print-requires-private performs a recursive search and that's not what > we want here to allow dependencies to modify their Depends without > affecting us. So it seems like we'd have to write a .pc file parser. Is > that correct?
Sorry for taking so long to answer. Yes, this makes total sense. I’ve made a prototype using a pure-Perl pkg-config parser here: https://salsa.debian.org/debian/pkgconf/-/merge_requests/14/diffs What do you think? Thanks! -- Cheers, Andrej