diff options
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageLocator.pm | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm index 1c7673748eb..2f26d5fd9f4 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageLocator.pm,v 1.63 2007/05/12 15:00:30 espie Exp $ +# $OpenBSD: PackageLocator.pm,v 1.64 2007/05/13 10:16:06 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -119,18 +119,22 @@ my @avail; sub match_spec { - my ($class, $spec) = @_; + my ($class, $spec, $filter) = @_; if (!@avail) { @avail = available(); } - return $spec->match_ref(\@avail); + if (defined $filter) { + return &$filter($spec->match_ref(\@avail)); + } else { + return $spec->match_ref(\@avail); + } } my $stemlist; sub findstem { - my ($class, $stem) = @_; + my ($class, $stem, $filter) = @_; if (!@avail) { @avail = available(); } @@ -138,12 +142,16 @@ sub findstem if (!$stemlist) { $stemlist = OpenBSD::PackageName::avail2stems(@avail); } - return $stemlist->findstem($stem); + if (defined $filter) { + return &$filter($stemlist->findstem($stem)); + } else { + return $stemlist->findstem($stem); + } } sub find_partialstem { - my ($class, $partial) = @_; + my ($class, $partial, $filter) = @_; if (!@avail) { @avail = available(); } @@ -151,7 +159,11 @@ sub find_partialstem if (!$stemlist) { $stemlist = OpenBSD::PackageName::avail2stems(@avail); } - return $stemlist->find_partialstem($partial); + if (defined $filter) { + return &$filter($stemlist->find_partialstem($partial)); + } else { + return $stemlist->find_partialstem($partial); + } } 1; |