Peter Jeremy wrote:
[I was also dismayed when I saw the bump].

On 2009-Aug-01 18:33:43 +0100, Matthew Seaman <m.sea...@infracaninophile.co.uk> 
wrote:
You could, for instance, run ldd(1) against each of the files a port installs
and then record in /var/db/pkg/portname-1.2.3/+SHLIBS or equivalently in the
.tbz package tarball a sorted and uniq'd list of all the shared libraries
linked against.

Unfortunately, this isn't sufficient because a non-trivial number of
ports dlopen() libraries rather than directly linking against them.
(The Xorg server is probably the most widely used culprit here).

Yes.  There's also a problem with ports like firefox and openoffice that
dynamically link against shared libraries not on the usual LD_LIBRARY_PATH.
Still, what I wrote is still useful as a tool for providing a starting point
on recording shared library dependencies.

 Or you could resolve the shlib filenames back to the ports
that supply them, and create a 'SHLIB_PORTS_NEEDED' variable in the port
Makefiles.

A third approach is to more carefully recurse through the dependency
tree: Given A depends on B depends on C, B only needs bumping if it
LIB_DEPENDS on A and C only needs bumping if it LIB_DEPENDS on B and
B was bumped.

I considered this, but didn't think it would be as complete as using ldd(1).
Maybe I was wrong there -- but I've still a nagging feeling that this will miss
out some cases.  Also, LIB_DEPENDS only covers the first generation dependencies
-- if your shared library itself depends on another shared library, that data
would have to be accounted for by recursing through the dependency tree. (Your
case (2) below)

This is all doable: INDEX generation does virtually the same thing with
BUILD_DEPENDS and RUN_DEPENDS.  In fact, adding another field to the INDEX
showing shlib dependencies would be a handy way of making the data accessible.

In this specific case, p5-RT-* depends on www/rt38 depends on
graphics/p5-GD depends on graphics/gd depends on graphics/jpeg.  When
jpeg is bumped, gd needs to be bumped because it LIB_DEPENDS on jpeg.
p5-GD then needs to be bumped because it LIB_DEPENDS on gd.  rt38 does
not need to be bumped because it has no LIB_DEPENDS on p5-GD.  p5-RT-*
does not need to be bumped because rt38 is not bumped.

This is slighly more complex than
  cd /usr/ports && \
  for i in */*; do [ -d "$i" ] && cd "$i" && make all-depends-list ; done | \
  grep jpeg
because you need to actually follow the dependency tree, but is not
impractical.  The only issues I can see with this approach are:
1) Mapping the shared library reported by 'make lib-depends' back to the
   port than installs it.
2) You are relying on LIB_DEPENDS being correct:  In my general example
   above, if A is missing a LIB_DEPENDS on C, this may not be detected
   in the build process because of the implicit dependency on C via B.

No sample script because I'm not sure of the correct approach to 1) off
the top of my head.

Doing (1) using my p5-FreeBSD-Portindex code is pretty easy.  It's about
time I released an update anyhow -- I'll code up a little app that processes
the LIB_DEPENDS linkages already stored in the cache and lists each port
that has a LIB_DEPENDS, together with all the ports it depends on cumulatively.

        Cheers,

        Matthew

--
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                 Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                 Kent, CT11 9PW

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to