Re: How to check applications vs. libraries

2007-10-03 Thread Mel
On Tuesday 02 October 2007 22:53:20 RW wrote:
 On Tue, 2 Oct 2007 19:23:29 +0200

 Daniel Tourde [EMAIL PROTECTED] 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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to check applications vs. libraries

2007-10-03 Thread RW
On Wed, 3 Oct 2007 14:25:18 +0200
Mel [EMAIL PROTECTED] wrote:

 On Tuesday 02 October 2007 22:53:20 RW wrote:
  On Tue, 2 Oct 2007 19:23:29 +0200
 
  Daniel Tourde [EMAIL PROTECTED] 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. 

It only matters where there is a direct library dependency. And even
then it doesn't matter all that much because of the back-up libraries.
If you follow the UPDATING instructions for when to do   `portupgrade
-fr' and keep you ports up to date, you shouldn't need to worry. Any
residual paranoia beyond that is better satisfied by running
portmanager in pristine mode IMO.

 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'.
 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to check applications vs. libraries

2007-10-03 Thread Warren Block

On Wed, 3 Oct 2007, Mel wrote:


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);
   }
}
?


Interesting.  Here's a Ruby version, which shows either I have no 
old dependencies or that I just didn't translate it correctly:


#!/usr/local/bin/ruby
localbase = ENV[LOCALBASE] || '/usr/local'
Dir.chdir(localbase)
%w( bin sbin lib libexec ).each do |path|
  puts path
  Dir.glob(path + '/*').each do |file|
check = `/usr/bin/ldd #{file} 2/dev/null | grep compat/pkg`
next if check.empty?
check.sub!(/^.*?=/m, \t\t=)
puts \t#{file} depends on:\n#{check}
  end
end

-Warren Block * Rapid City, South Dakota USA
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to check applications vs. libraries

2007-10-03 Thread Mel
On Wednesday 03 October 2007 14:49:41 RW wrote:
 On Wed, 3 Oct 2007 14:25:18 +0200

 Mel [EMAIL PROTECTED] wrote:
  On Tuesday 02 October 2007 22:53:20 RW wrote:
   On Tue, 2 Oct 2007 19:23:29 +0200
  
   Daniel Tourde [EMAIL PROTECTED] 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.

 It only matters where there is a direct library dependency. And even
 then it doesn't matter all that much because of the back-up libraries.

It matters when a build machine links with a stale version, but packages it 
with the current version dep in +CONTENTS. This will not happen with direct 
dependant, but will happen if the dependency is further down the chain.

 If you follow the UPDATING instructions for when to do   `portupgrade
 -fr' and keep you ports up to date, you shouldn't need to worry.

Except that portupgrade -fr ignores HOLD_PKGS and I'll risk getting a 
non-working Xorg installation.
Also, I think with the introduction of UPDATING the need to not break things 
got less important and at the same time more people started to automate 
upgrading ports, because we got spoiled with a stable almost never breaking 
ports tree and multi-core machines. This now bites eachother.

 Any 
 residual paranoia beyond that is better satisfied by running
 portmanager in pristine mode IMO.

Yeah, I'm slowly coming to realize that recompiling all dependants isn't such 
a bad idea in distributed environments (build machine and slaves).


-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


How to check applications vs. libraries

2007-10-02 Thread Daniel Tourde
Hello,

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?

or in other words, is there an equivalent to the Gentoo Linux 'revdep-rebuild' 
function?

Daniel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to check applications vs. libraries

2007-10-02 Thread RW
On Tue, 2 Oct 2007 19:23:29 +0200
Daniel Tourde [EMAIL PROTECTED] 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. 

Applications that depend on updated libraries get version-bumped when
the library major version gets changed, so just keeping your ports
up-to-date is all you normally need to make sure everything is using
the latest libraries.  
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]