summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-08-16 10:24:24 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-08-16 10:24:24 +0000
commit1c49d57b670b1d444a79281377e53fc0d717ded3 (patch)
tree6ffaf6dd25e0d6e8082d30d3a56ce441cdb0e77d /usr.sbin/pkg_add/OpenBSD
parentc2c80dcbc826340c574e0bf14dfb61987350da2c (diff)
support code for pkg_add -u:
- distant_available(), using the distant listing functions. - stem compiler, to match lots of stems
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocator.pm11
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageName.pm21
2 files changed, 30 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
index 2ac537f269c..20e1c6e7260 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.16 2005/08/16 09:44:07 espie Exp $
+# $OpenBSD: PackageLocator.pm,v 1.17 2005/08/16 10:24:23 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -338,6 +338,15 @@ sub available
return @l;
}
+sub distant_available
+{
+ my @l = ();
+ foreach my $loc (@pkgpath) {
+ push(@l, $loc->list());
+ }
+ return @l;
+}
+
sub info
{
my $self = shift;
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm
index 0447620ae00..e93cecbaa5c 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.6 2004/10/11 09:44:06 espie Exp $
+# $OpenBSD: PackageName.pm,v 1.7 2005/08/16 10:24:23 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -70,4 +70,23 @@ sub findstem
return @r;
}
+sub compile_stemlist
+{
+ my $hash = {};
+ for my $n (@_) {
+ my $stem = splitstem($n);
+ $hash->{$stem} = [] unless defined $hash->{$stem};
+ push(@{$hash->{$stem}}, $n);
+ }
+ bless $hash, "OpenBSD::PackageLocator::_compiled_stemlist";
+}
+
+package OpenBSD::PackageLocator::_compiled_stemlist;
+
+sub findstem
+{
+ my ($self, $stem) = @_;
+ return $self->{$stem};
+}
+
1;