summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-13 12:55:55 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-13 12:55:55 +0000
commit03779222aceb38a385f53c4aa0f950efc026b72b (patch)
treeecd55f561fd5f5926e349a3bbf095bfefa816b3d /usr.sbin
parentea7d0856cc9279abe3f565676f1cbf03aced9ea8 (diff)
move towards unifying stem searches and pkgspec searches.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageName.pm15
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgSpec.pm8
2 files changed, 21 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm
index 52d179f2167..726efefaef6 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.18 2007/05/07 14:29:06 espie Exp $
+# $OpenBSD: PackageName.pm,v 1.19 2007/05/13 12:55:54 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -304,6 +304,19 @@ sub to_pattern
return $o->{stem}.'-*';
}
+sub new
+{
+ my ($class, $stem) = @_;
+
+ return bless {stem => $stem}, $class;
+}
+
+sub split
+{
+ my ($class, $pkgname) = @_;
+ return $class->new(OpenBSD::PackageName::splitstem($pkgname));
+}
+
package OpenBSD::PackageName::Name;
sub to_string
{
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm
index 07f8f34c3ae..c8009f7fb92 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PkgSpec.pm,v 1.8 2007/05/12 22:55:29 espie Exp $
+# $OpenBSD: PkgSpec.pm,v 1.9 2007/05/13 12:55:54 espie Exp $
#
# Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org>
#
@@ -217,6 +217,12 @@ sub match_ref
return @l;
}
+sub match_repo
+{
+ my ($self, $o) = @_;
+ return $self->match_ref($o->list);
+}
+
sub match
{
my ($self, @list) = @_;