Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Oct 2007 14:25:18 +0200
From:      Mel <fbsd.questions@rachie.is-a-geek.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: How to check applications vs. libraries
Message-ID:  <200710031425.20972.fbsd.questions@rachie.is-a-geek.net>
In-Reply-To: <20071002215320.13360851@gumby.homeunix.com.>
References:  <200710021923.29750.daniel.tourde@spray.se> <20071002215320.13360851@gumby.homeunix.com.>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 02 October 2007 22:53:20 RW wrote:
> On Tue, 2 Oct 2007 19:23:29 +0200
>
> Daniel Tourde <daniel.tourde@spray.se> wrote:
> > I am used to install FreeBSD applications by using the port
> > collection. I also update regularly (twice a month or something) the
> > apps, using 'portupgrade -a -N' on a refreshed port collection.
> >
> > Here are my questions:
> > - How can I check that the apps that have been build with certain
> > libraries still work when some of the libs have been updated?
> > - Is it possible then to rebuild the selected set of apps that have
> > been 'corrupted' by the library upgrade (classicaly from liba.1 to
> > liba.2)? If yes, how?
>
> Generally this doesn't cause a problem as when portupgrade upgrades a
> library through a major revision, it puts a copy of the old library
> into a compatibility directory.

True. /usr/local/lib/compat/pkg

> Applications that depend on updated libraries get version-bumped when
> the library major version gets changed

Not true. Only direct dependants get version bumped and not consistently 
either. To recompile all dependants against the latest version of a library, 
one has to find out which port the older version in /usr/local/lib/compat/pkg 
belongs to and forcibly upgrade all deps of that package, using 
`portupgrade -fr'.

I use the following little php script to identify programs/libraries still 
using old libs:
#!/usr/local/bin/php -q
<?php
// vim: ts=4 sw=4 noet ai tw=78
$localbase = getenv('LOCALBASE');
if(!$localbase)
    $localbase='/usr/local';
$cmd_fmt = '/usr/bin/ldd %s 2>/dev/null| grep compat/pkg';
$search_paths = array('bin', 'sbin', 'lib', 'libexec');
chdir($localbase);
foreach($search_paths AS $path)
{
    echo("==> $path\n");
    $files = glob("$path/*");
    foreach($files AS $file)
    {
        $check = shell_exec(sprintf($cmd_fmt, $file));
        if( empty($check) )
            continue;
        // pretty print reformat
        $check = preg_replace('/^.*?=>/m', "\t\t=>", $check);
        echo("\t$file depends on:\n$check");
    }
}
?>

Given time, I could probably come up with something fully automated, but in 
practice, it boils down to 2 or 3 libraries, usually of the sort gettext, 
expat, vorbis, xml/xslt.
It's not full-proof, because some paths aren't searched, for 
example /usr/local/openoffice, just adjust the search_paths array if you need 
to.
-- 
Mel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200710031425.20972.fbsd.questions>