Package Dependencies

When packaging a new program for the first time one of the big headaches is figuring out where all your dependencies are.  This difficulty is greatly mitigated on openSUSE by a little tool called webpin.  It’s available in the openSUSE:Tools repository.

When you first build out your basic spec file you have little or no idea what goes in BuildRequires.  For a few projects you don’t need anything there at all so I like to just go ahead and run osc build and see what happens. If you’re not using OBS to build your software then I’m very sorry for you. Usually the configure script will stop somewhere saying that it couldn’t find something it needs, usually a header file or a pkg-config (.pc) file. This is where webpin comes in.

Suppose you get a line that says:

No package 'avahi-sharp' found

This means that configure is looking for a pkg-config file called avahi-sharp.pc. So with webpin installed we type webpin avahi-sharp.pc and we get a result that looks something like this:

1 results (1 packages) found for "avahi-sharp.pc" in openSUSE_110
* avahi-mono: Mono Bindings for avahi, the D-BUS Service for Zeroconf and Bonjour
   - 0.6.22 [suse-oss]
     >> /usr/lib/pkgconfig/avahi-sharp.pc

Now we know to add avahi-mono to our BuildRequires.

Later we might get an error that looks like this:

session-glue.c:5:26: error: X11/SM/SMlib.h: No such file or directory

Unfortunately for us this kind of error comes from gcc and is harder to see in all the gcc error: gobbledygook. If the upstream maintainer had been more careful we would have seen a configure error instead. But no matter! we just type webpin X11/SM/SMlib.h to find that this header file is found in xorg-x11-libSM-devel.

My new package packaging time is as much as cut in half thanks to this excellent tool. Many thanks to those responsible. There is also a web interface for webpin (I’m pretty sure it started out that way, hence the name).

Side note: RPM really needs to have automatic provides for pkg-config files so that we can use BuildRequires: pc(avahi-sharp) >= 0.6 instead of explicit package names. pkg-config is one of the best things to happen to software in a long time IMHO and RPM should be taking full advantage of it.

The package used for this example was Tangerine, a very nice little DAAP server written by James Willcox.

5 thoughts on “Package Dependencies

  1. Glad to hear that you like the webpin CLI. It’s just a pretty simple CLI frontend for the webpin webservice though, and kudos for the really hard work goes to Benjamin Weber [1] for implementing the engine+webservices+webinterface behind/on webpin [2].

    [1] http://benjiweber.co.uk/blog/
    [2] http://packages.opensuse-community.org/

    And btw, writing a findreqprov script for rpmbuild to automatically add Provides: based on .pc files would be pretty trivial. As an experiment, I wrote one for Java that adds Provides: for Java packages contained in the packaged .jar files (using jdepend), compiled with gcj. Pretty simple to do, actually.

  2. So SUSE finally has apt-file, then?

    jms@osc-franzibald:~$ apt-file search avahi-sharp.pc
    libavahi1.0-cil: /usr/lib/pkgconfig/avahi-sharp.pc
    jms@osc-franzibald:~$ apt-file search X11/SM/SMlib.h
    libsm-dev: /usr/include/X11/SM/SMlib.h

  3. Looks like Suse is reinventing something Mandriva has for years, urpmf can be used to search in the repositories. Also, the pkg-config deps are real in Mandriva’s packages:

    # rpm -q –provides avahi-sharp
    pkgconfig(avahi-sharp) = 0.6.23
    pkgconfig(avahi-ui-sharp) = 0.6.23
    mono(avahi-sharp) = 1.0.0.0
    mono(avahi-ui-sharp) = 0.0.0.0
    avahi-sharp = 0.6.23-1mdv2009.0

  4. I was aware of the various kinds of urpm* sweetness. I was not aware that Mandriva did pkgconfig provides — that is awesome.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>