summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-07 14:12:44 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-07 14:12:44 +0000
commitdb7df20deb748f5ca480b61a4e29aca11d2b783c (patch)
tree95899bc189a1cbd37ca8d64b2612807fc5f78edb /usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
parent62caeed99c136e6c767c728e1af4de73df3d9f76 (diff)
remove dependency on available_stems(), make it go thru PackageLocator
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackageLocator.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocator.pm29
1 files changed, 28 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
index f4e95de293b..8772793c980 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.58 2007/05/07 13:27:28 espie Exp $
+# $OpenBSD: PackageLocator.pm,v 1.59 2007/05/07 14:12:43 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -128,5 +128,32 @@ sub match_spec
return OpenBSD::PkgSpec::match($spec);
}
+my $stemlist;
+
+sub findstem
+{
+ my ($class, $stem) = @_;
+ if (!@avail) {
+ @avail = available();
+ }
+ require OpenBSD::PackageName;
+ if (!$stemlist) {
+ $stemlist = OpenBSD::PackageName::avail2stems(@avail);
+ }
+ return $stemlist->findstem($stem);
+}
+
+sub find_partialstem
+{
+ my ($class, $partial) = @_;
+ if (!@avail) {
+ @avail = available();
+ }
+ require OpenBSD::PackageName;
+ if (!$stemlist) {
+ $stemlist = OpenBSD::PackageName::avail2stems(@avail);
+ }
+ return $stemlist->find_partialstem($partial);
+}
1;