summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-07 13:27:29 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-07 13:27:29 +0000
commit9313dc3e2216f22add9cac2242585afdea1f3d62 (patch)
treeb7dc2f81088c2b16c250cac82b5f592284876c0a
parent0102a5ae783546c862671149a1d4bca1feb2186a (diff)
we want to no longer expose PackageLocator::available(), lift interfaces
up there, starting with match_spec.
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Dependencies.pm15
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocator.pm14
2 files changed, 15 insertions, 14 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
index 9950978c2f0..67010327c6d 100644
--- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Dependencies.pm,v 1.18 2007/05/07 13:12:11 espie Exp $
+# $OpenBSD: Dependencies.pm,v 1.19 2007/05/07 13:27:28 espie Exp $
#
# Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org>
#
@@ -27,15 +27,6 @@ use OpenBSD::SharedLibs;
use OpenBSD::Error;
use OpenBSD::Interactive;
-my @avail;
-sub available
-{
- if (!@avail) {
- @avail = OpenBSD::PackageLocator::available();
- }
- return @avail;
-}
-
sub find_candidate
{
my $dep = shift;
@@ -90,8 +81,10 @@ sub solve
next;
}
}
+ require OpenBSD::PackageLocator;
+
# try with list of available packages
- my @candidates = OpenBSD::PkgSpec::match($dep->{pattern}, available());
+ my @candidates = OpenBSD::PackageLocator->match_spec($dep->{pattern});
if (!$state->{forced}->{allversions}) {
@candidates = OpenBSD::PackageName::keep_most_recent(@candidates);
}
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
index 0d98c4e2a0c..f4e95de293b 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.57 2007/05/02 15:05:30 espie Exp $
+# $OpenBSD: PackageLocator.pm,v 1.58 2007/05/07 13:27:28 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -115,10 +115,18 @@ sub cleanup
$pkgpath->cleanup;
}
+my @avail;
+
sub match_spec
{
- my $self = shift;
- return $pkgpath->match_spec(@_);
+ my ($class, $spec) = @_;
+ if (!@avail) {
+ @avail = available();
+ }
+ require OpenBSD::PkgSpec;
+
+ return OpenBSD::PkgSpec::match($spec);
}
+
1;