Subject: checkpkgsdeps.pl
To: None <tech-pkg@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-pkg
Date: 02/08/2000 15:10:06
--FkmkrVfFsRoUs1wW
Content-Type: text/plain; charset=us-ascii
Hi,
here is a small perl script I just wrote to help me managing binary
packages. it prints duplicates packages (same package with 2 different
version), missing package required by another package, which packages
requires a package. Can be usefull for those of us who burn custom CDs ...
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--
--FkmkrVfFsRoUs1wW
Content-Type: application/x-perl
Content-Disposition: attachment; filename="checkpkgsdeps.pl"
#! /usr/pkg/bin/perl
opendir(DOT, ".") or die "can't open .: $!";
while ($f = readdir(DOT)) {
if ($f =~ m|^(.+)-[0-9].*\.tgz|) {
if ($file{$1}) {
printf("duplicate packages $file{$1}, $f\n");
}
$file{$1} = $f;
$dep{$f} = " ";
}
}
foreach (keys %dep) {
$file = $_;
open(CONTENTS, "tar --fast-read --to-stdout -xzf $file +CONTENTS|") or
printf STDERR "can't expand $file: $!";
while (<CONTENTS>) {
if (m|^\@pkgdep (.*)$|) {
$deppkg = $1;
if ($deppkg =~ m|^(.+)-[0-9].*|) {
$deppkgfile = "$deppkg".".tgz";
if (! defined($dep{$deppkgfile})) {
printf("missing $deppkg for $file");
if ($file{$1}) {
printf(" (we have $file{$1})");
}
printf("\n");
} else {
$dep{$deppkgfile} = $dep{$deppkgfile}." $file";
}
}
# should handle wilcard deps here !
}
}
close CONTENTS;
if ($? != 0) {
printf STDERR "tar failed ($?)\n";
}
}
foreach (keys %dep) {
$file = $_;
if ($dep{$_} ne " ") {
printf "$file required by:$dep{$file}\n";
}
}
--FkmkrVfFsRoUs1wW--