openbsd-ports/infrastructure/package/check-dependencies

48 lines
908 B
Plaintext
Raw Normal View History

#!/usr/bin/perl
$cache=1;
print "Dependency list\n";
print "---------------\n";
for $file (<*.tgz>)
{
$name = $file;
$name =~ s/\.tgz$//;
unless ($cache && -f "t/CONTENTS.$name")
{
1999-10-26 11:37:42 -04:00
system("tar zxqf $file +CONTENTS");
rename("+CONTENTS", "t/CONTENTS.$name");
}
open(FILE, "t/CONTENTS.$name") or die "No contents";
$deps{$name}=[];
while (<FILE>)
{
chomp;
if (m/^\@pkgdep\s+/)
{
push(@{$deps{$name}}, $');
}
}
close(FILE);
print $name, ": ", join(',', @{$deps{$name}}), "\n";
}
print "Checking topological order\n";
print "--------------------------\n";
# check recursive brokeness
while (($key, $value) = each %deps)
{
%pulled=();
for $np (@$value)
{
for $rec (@{$deps{$np}})
{
unless (defined $pulled{$rec})
{
print "Error: $key depends on $np which depends on $rec\n";
print "(", join(",", @$value), ")\n";
}
}
$pulled{$np} = 1;
}
}