use new interface to Locator

This commit is contained in:
espie 2005-09-13 20:48:41 +00:00
parent 35eec0722f
commit 388edd407a
3 changed files with 26 additions and 20 deletions

View File

@ -1,5 +1,5 @@
#! /usr/bin/perl #! /usr/bin/perl
# $OpenBSD: check-manpages,v 1.4 2004/11/13 11:49:48 espie Exp $ # $OpenBSD: check-manpages,v 1.5 2005/09/13 20:48:41 espie Exp $
# #
# Copyright (c) 2004 Marc Espie <espie@openbsd.org> # Copyright (c) 2004 Marc Espie <espie@openbsd.org>
# #
@ -56,6 +56,8 @@ for my $pkgname (@ARGV) {
} }
} }
$true_package->close(); $true_package->close();
$true_package->wipe_info();
$plist->forget();
} }
print STDERR "Running makewhatis in ", join(' ', keys(%mandirs)), "\n"; print STDERR "Running makewhatis in ", join(' ', keys(%mandirs)), "\n";

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl #!/usr/bin/perl
# $OpenBSD: check-newlib-depends,v 1.10 2005/09/10 09:48:54 espie Exp $ # $OpenBSD: check-newlib-depends,v 1.11 2005/09/13 20:48:41 espie Exp $
# Copyright (c) 2004 Marc Espie <espie@openbsd.org> # Copyright (c) 2004 Marc Espie <espie@openbsd.org>
# #
# Permission to use, copy, modify, and distribute this software for any # Permission to use, copy, modify, and distribute this software for any
@ -254,7 +254,7 @@ sub do_pkg
my $plist = OpenBSD::PackingList->fromfile($dir.CONTENTS); my $plist = OpenBSD::PackingList->fromfile($dir.CONTENTS);
analyze($plist, $db, $true_package); analyze($plist, $db, $true_package);
$true_package->close(); $true_package->close();
rmtree($dir); $true_package->wipe_info();
$plist->forget(); $plist->forget();
return 1; return 1;
} }

View File

@ -1,6 +1,6 @@
#! /usr/bin/perl #! /usr/bin/perl
# $OpenBSD: find-plist-issues,v 1.2 2005/09/05 14:39:57 espie Exp $ # $OpenBSD: find-plist-issues,v 1.3 2005/09/13 20:48:41 espie Exp $
# Copyright (c) 2000-2005 # Copyright (c) 2000-2005
# Marc Espie. All rights reserved. # Marc Espie. All rights reserved.
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@ -302,16 +302,10 @@ my $db = {};
my $mtree = {}; my $mtree = {};
our ($opt_d, $opt_v, $opt_C, $opt_D); our ($opt_d, $opt_v, $opt_C, $opt_D);
sub handle_plist
sub handle_file
{ {
my $filename = shift; my $plist = shift;
my $plist = OpenBSD::PackingList->fromfile($filename); print $plist->pkgname(), "\n" if $opt_v;
if (!defined $plist) {
print STDERR "Error reading $filename\n";
return;
}
print "$filename -> ", $plist->pkgname(), "\n" if $opt_v;
$plist->forget(); $plist->forget();
if ($opt_C) { if ($opt_C) {
$conflicts->{$plist->pkgname()} = $conflicts->{$plist->pkgname()} =
@ -323,6 +317,18 @@ sub handle_file
} }
} }
sub handle_file
{
my $filename = shift;
my $plist = OpenBSD::PackingList->fromfile($filename);
if (!defined $plist) {
print STDERR "Error reading $filename\n";
return;
}
handle_plist($plist);
}
set_usage('find-all-conflicts [-vCD] [-d plist_dir] [pkgname ...]'); set_usage('find-all-conflicts [-vCD] [-d plist_dir] [pkgname ...]');
try { try {
getopts('d:vCD'); getopts('d:vCD');
@ -360,16 +366,14 @@ if ($opt_d) {
@ARGV=(<*.tgz>); @ARGV=(<*.tgz>);
} }
push(@available, map { s,.*/,,; s/\.tgz$//; } @ARGV); my @pkgs = @ARGV;
push(@available, map { s,.*/,,; s/\.tgz$//; } @pkgs);
for my $pkgname (@ARGV) { for my $pkgname (@ARGV) {
print STDERR "$pkgname\n"; print STDERR "$pkgname\n";
my $true_package = OpenBSD::PackageLocator->find($pkgname); my $plist = OpenBSD::PackageLocator->grabPlist($pkgname);
next unless $true_package; next unless $plist;
my $dir = $true_package->info(); handle_plist($plist);
$true_package->close();
handle_file($dir.CONTENTS);
rmtree($dir);
} }
print "File problems:\n"; print "File problems:\n";