summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-13 13:12:22 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-13 13:12:22 +0000
commit1ce313db22a6e29e1eabd2521b919d96a10825af (patch)
treed1c0e89917dab59b4a9fdb548e32c66a838dbd84 /usr.sbin/pkg_add
parent6a5affe55843f23286e7d751d5e8e324b145dcb9 (diff)
also create PartialStem objects, and create a generic
PackageLocator->match($o), where $o can be a spec, a stem, a partialstem.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocator.pm8
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageName.pm23
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm8
3 files changed, 36 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
index 8a6d534f79f..63c43438b79 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.65 2007/05/13 12:34:32 espie Exp $
+# $OpenBSD: PackageLocator.pm,v 1.66 2007/05/13 13:12:21 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -133,4 +133,10 @@ sub find_partialstem
return $pkgpath->find_partialstem($partial, $filter);
}
+sub match
+{
+ my ($class, $search, $filter) = @_;
+ return $pkgpath->match_repo($search, $filter);
+}
+
1;
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm
index 726efefaef6..09de0d3d009 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageName.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageName.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageName.pm,v 1.19 2007/05/13 12:55:54 espie Exp $
+# $OpenBSD: PackageName.pm,v 1.20 2007/05/13 13:12:21 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -317,6 +317,27 @@ sub split
return $class->new(OpenBSD::PackageName::splitstem($pkgname));
}
+sub match_repo
+{
+ my ($self, $o) = @_;
+ return $o->stemlist->findstem($o->{stem});
+}
+
+package OpenBSD::PackageName::PartialStem;
+our @ISA=(qw(OpenBSD::PackageName::PartialStem));
+
+sub to_pattern
+{
+ my $o = shift;
+ return '*.'.$o->{stem}.'*-*';
+}
+
+sub match_repo
+{
+ my ($self, $o) = @_;
+ return $o->stemlist->find_partialstem($o->{stem});
+}
+
package OpenBSD::PackageName::Name;
sub to_string
{
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
index e74a19db8d5..315d3167adf 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageRepositoryList.pm,v 1.7 2007/05/13 10:10:35 espie Exp $
+# $OpenBSD: PackageRepositoryList.pm,v 1.8 2007/05/13 13:12:21 espie Exp $
#
# Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org>
#
@@ -134,6 +134,12 @@ sub match_spec
return $self->_first_of('match_spec', $filter, $spec);
}
+sub match_repo
+{
+ my ($self, $spec, $filter) = @_;
+ return $self->_first_of('match_repo', $filter, $spec);
+}
+
sub cleanup
{
my $self = shift;