monitoring socket support

juuso.alasuutari at tamperelainen.org juuso.alasuutari at tamperelainen.org
Tue Dec 5 06:33:30 PST 2006


DISCLAIMER: Text below includes a feature suggestion. If you have ammo and think
you see a target, please attempt to shoot holes in it. That way the suggestion
may or may not evolve into something viable.

Hi.

I'm a developer for a source-based distro called Source Mage GNU/Linux, and I
often wonder if cross-distro package dependency handling could be improved
somehow.

Pkg-config does a great job easing configuration and building of packages. It's
also already widely adopted as a standard build tool. This makes it a good
candidate for serving another purpose as well.

I routinely encounter sources with only sparse documentation about the various
dependencies. At worst I need to grep and look through the Makefiles, even
#include statements in the code itself, to get a clear idea of the
requirements. At best I can simply take a look at './configure --help' and be
pretty confident that I have all the info I need - except for one thing.

Even with good dependency documentation and use of pkg-config during configure,
there's still one barrier to cross. If I don't know what packages in my distro
of choice provide the listed dependencies (although I really, really _should_
if I am to call myself a developer :)), I'll again need to do some RTFM.
Pkg-config can tell ./configure whether my system has a package or not, but in
case of failure neither it nor pkg-config can tell me what exact package I need
to install.

This is where the contents of /usr/lib/pkgconfig/ comes to the rescue. If I have
access to an archive containing the file lists for my distro's packages, and if
I can see what pkg-config commands the configure script issues, I can rather
painlessly come up with package dependency information. If the failed command
in ./configure was 'pkg-config --exists foobar', I can do 'grep -lr
/usr/lib/pkgconfig/foobar.pc /my/distros/file/lists/' and will most probably
discover the needed package.

But then it's back to square one again: In order to use this technique for
listing package requirements, I'll have to manually go through the makefile to
see the pkg-config commands. Unless...

What if pkg-config had an option to send the options it's run with, as well as
its exit status, to a socket? It could check if an environment variable, e.g.
PKGCONFIG_MONITOR_SOCKET, for the socket address. If the variable is set, it
would send the data to the socket. (Having it act upon an environment variable
would allow backwards compatibility and wouldn't require any Makefile changes
in sources.) Distro developers could then write utilities for monitoring what
pkg-config commands ./configure issues, and use that information for different
purposes.

An example:

1) A monitor app is run, it opens a UDP socket /tmp/pkg_socket.
2) 'export PKGCONFIG_MONITOR_SOCKET=/tmp/pkg_socket'
3) './configure'
4) The monitor app gathers data sent to the socket, and can now see if some
pkg-config call returned != 0. If that happened it can check the distro's
database for a matching package, then tell the user what was missing.

As I said I'm happy if someone can point out obvious flaws in my idea. I'm sure
there are possibilities I haven't thought of, but all in all I'm hopeful that
this could indeed work. If there's a chance that this kind of thing might be
worth implementing, I'm willing to assist the best I can.

Thanks,
Juuso Alasuutari


----------------------------------------------------------------
This mail sent through L-secure: http://www.l-secure.net/



More information about the pkg-config mailing list