diff options
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/pkg_mklocatedb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/pkg_mklocatedb b/usr.sbin/pkg_add/pkg_mklocatedb index 3e69a1ebbab..b7c295fdeb0 100644 --- a/usr.sbin/pkg_add/pkg_mklocatedb +++ b/usr.sbin/pkg_add/pkg_mklocatedb @@ -1,6 +1,6 @@ #! /usr/bin/perl # Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org> -# $OpenBSD: pkg_mklocatedb,v 1.37 2012/05/26 10:27:06 espie Exp $ +# $OpenBSD: pkg_mklocatedb,v 1.38 2012/05/28 10:14:33 espie Exp $ # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -206,6 +206,14 @@ sub do_release closedir($dir); } +sub print_out +{ + my ($plist, $state) = @_; + + $plist->set_header($state); + $plist->print_name($state); +} + sub do_portsdir { my $state = shift; @@ -228,8 +236,7 @@ sub do_portsdir $done = 1; }); if (defined $plist && defined $plist->pkgname) { - $plist->set_header($state); - $plist->print_name($state); + print_out($plist, $state); } } close($in); @@ -248,7 +255,7 @@ sub do_pkgdir return unless -f $_; my $plist = $state->repo->grabPlist($File::Find::name); return unless defined $plist; - $plist->print_name($state); + print_out($plist, $state); }, $state->{pkgdir}); } @@ -279,7 +286,7 @@ if ($state->{portsdir}) { my $pkgname = shift; my $plist = OpenBSD::PackingList->from_installation($pkgname); return unless defined $plist; - $plist->print_name($state); + print_out($plist, $state); }); } else { $state->progress->for_list("Scanning packages", \@ARGV, @@ -287,6 +294,6 @@ if ($state->{portsdir}) { my $pkgname = shift; my $plist = $state->repo->grabPlist($pkgname); next unless $plist; - $plist->print_name($state); + print_out($plist, $state); }); } |