Subject: Re: checkpkgsdeps.pl
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: David Brownlee <abs@netbsd.org>
List: tech-pkg
Date: 02/08/2000 21:58:32
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

--FkmkrVfFsRoUs1wW
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.NEB.4.21.0002082158182.512@oblivion.mono.org>

	Anyone interested in turning this into a package? :)

		David/absolute

On Tue, 8 Feb 2000, Manuel Bouyer wrote:

> 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; CHARSET=US-ASCII
Content-ID: <Pine.NEB.4.21.0002082158183.512@oblivion.mono.org>
Content-Description: 
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--