Logcheck dependency hell
Mel
fbsd.questions at rachie.is-a-geek.net
Mon Feb 16 12:19:03 PST 2009
On Thursday 12 February 2009 03:22:04 n j wrote:
> Hello,
>
> could anyone help me what command should I use to find out which
> logcheck-required port _exactly_ is trying to install half of the X
> libraries?
>
> The logcheck port lists the following build depends (output of
> pretty-print-build-depends-list):
# finddep.php security/logcheck x11/xorg-libraries
/usr/ports/textproc/docbook-to-man: /usr/local/libdata/xorg/libraries
=> /usr/ports/x11/xorg-libraries
Script below sig.
--
Mel
#!/usr/local/bin/php -q
<?php
// vim: ts=4 sw=4 nobackup noet
//define('DEBUG', 1);
function usage()
{
$me = $argv[0];
echo("Usage: $me <origin> <dep>\n");
echo("\tFind which dependancy lists dep in origin\n");
exit(1);
}
function chkdep($val, $check)
{
if( !is_dir($val) )
{
fprintf(STDERR, "No such dir: %s/%s\n", $GLOBALS['PORTSDIR'],
$val
);
return;
}
chdir($val);
$_deps = preg_split('/\s/',
shell_exec("/usr/bin/make -V LIB_DEPENDS -V RUN_DEPENDS -V BUILD_DEPENDS")
);
foreach($_deps AS $_dep)
{
list($pkgname, $origin) = explode(':', $_dep);
if( preg_match('/^\s*$/', $origin) )
continue;
if( in_array($origin, $GLOBALS['CHECKED']) )
continue;
if( $origin == $GLOBALS['PORTSDIR'] . '/' . $check )
echo("$val: $pkgname => $origin\n");
else
{
if( defined('DEBUG') )
{
fprintf(STDERR, "%s != %s/%s\n", $origin, $GLOBALS['PORTSDIR'],
$check
);
}
$GLOBALS['CHECKED'][] = $origin;
chkdep($origin, $check);
}
}
}
if( $argc < 3 )
usage();
$PORTSDIR=('' != getenv('PORTSDIR') ) ? getenv('PORTSDIR') : '/usr/ports';
$pkg = $argv[1];
$dep = $argv[2];
if(!file_exists("$PORTSDIR/$pkg/Makefile") )
{
fprintf(STDERR, "Orphaned port: $pkg\n");
exit(2);
}
$CHECKED=array();
chkdep($PORTSDIR . '/' . $pkg, $dep);
?>
More information about the freebsd-questions
mailing list