From owner-freebsd-questions@FreeBSD.ORG Wed Oct 3 22:01:52 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAFB516A468 for ; Wed, 3 Oct 2007 22:01:52 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 4B81913C468 for ; Wed, 3 Oct 2007 22:01:52 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.1/8.14.1) with ESMTP id l93M1pVZ046760; Wed, 3 Oct 2007 16:01:51 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.1/8.14.1/Submit) with ESMTP id l93M1oxV046757; Wed, 3 Oct 2007 16:01:50 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Wed, 3 Oct 2007 16:01:50 -0600 (MDT) From: Warren Block To: Mel In-Reply-To: <200710031425.20972.fbsd.questions@rachie.is-a-geek.net> Message-ID: <20071003154416.J45443@wonkity.com> References: <200710021923.29750.daniel.tourde@spray.se> <20071002215320.13360851@gumby.homeunix.com.> <200710031425.20972.fbsd.questions@rachie.is-a-geek.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (wonkity.com [127.0.0.1]); Wed, 03 Oct 2007 16:01:51 -0600 (MDT) Cc: freebsd-questions@freebsd.org Subject: Re: How to check applications vs. libraries X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Oct 2007 22:01:52 -0000 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 > // 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