[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Making dependencies on xlibs-dev more fine-grained, semi-automatically

Hi all,

I plan to file wishlist bugs against a number of libdevel packages that
Depend upon xlibs-dev, asking them to change to finer-grained
dependencies, which I will provide.  (Filing bugs against plain lib
packages is unnecessary since they'll get the finer-grained X dependencies
via ${shlibs:Depends} first time they're recompiled against the split-up X
packages.)  This is in the interests of (eventually) not having dozens of
X libraries on my system that aren't actually needed.

In order to convert dependencies on xlibs-dev into finer-grained
dependencies semi-automatically, I've written a couple of scripts to check
dependencies of -dev packages.  One of them checks for header files
referenced by #include statements in the header files of the given
package.  The other checks for .so symlinks to shared libraries that
define symbols needed by the shared library (or symlink) in the given
package.  I provide them here (attached) in case anyone wants to do
something else with them or improve them.

Note that the first time it's run, the checkshlibdeps.sh script creates a 
several megabyte table of defined symbols in shared libraries, in the file 
$HOME/.shlibs-database.  If the libraries on your system change, you 
should delete this file so it can be recreated.

Output looks something like this for the header file dependency checker:

arcturus[88]:~% ./checkheaderdeps.sh libgtk2.0-dev

Searching for all headers referenced from files in package libgtk2.0-dev:
     => libxt-dev: /usr/X11R6/include/X11/Intrinsic.h
     => libc6-dev: /usr/include/stdlib.h

Header dependencies of libgtk2.0-dev:


*** Could not find the following headers in any package:


The shlib dependency checker output is very similar.


1) Different versions of the same library confuse both scripts; e.g.
running them on the libgtk2.0-dev package causes spurious output of the
libglib1.2-dev package as well as the correct libglib2.0-dev package.

2) The scripts can only check files on the computer where they are run.  
If a -dev package should depend on something but doesn't, and that
something isn't present, the scripts can only warn that a header file is
missing or a needed symbol is not defined anywhere.

3) The scripts are only small shell scripts, not anything smart; so they
are confused by #include statements inside inactive #ifdefs (causing the
warnings about gdkprivate-x11.h and gdkscreen-x11.h in the example above),
libfoo.so files that are actually ld scripts (e.g. /usr/lib/libc.so), etc.

For the purpose of converting an xlibs-dev dependency into finer-grained
dependencies, these limitations are not a problem.  There is however a
more subtle issue.  Suppose A depends on B, and B depends on xlibs-dev,
but really only uses libX11.so and libICE.so.  If A also needs libXt.so,
this currently works even if A does not depend upon xlibs-dev, due to the
	A -> B -> xlibs-dev -> libxt-dev.
But this will break when B is fixed to depend only upon libx11-dev and
libice-dev if A's requirement for libxt-dev is overlooked.  (As it may
well be, since A has no direct dependency on xlibs-dev to be noticed.)
I guess we will come across these bugs in time.


Kevin B. McCarty <kmccarty@princeton.edu>   Physics Department
WWW: http://www.princeton.edu/~kmccarty/    Princeton University
GPG: public key ID 4F83C751                 Princeton, NJ 08544

Attachment: checkheaderdeps.sh
Description: Bourne shell script

Attachment: checkshlibdeps.sh
Description: Bourne shell script

Reply to: