summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/PackageName.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-14 10:00:09 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-14 10:00:09 +0000
commit4eb45a02d3106a414c165c9bbf9d188474aaa8df (patch)
tree4a7fc95d68fe3712dd19ebcd4c30cad3be1c75fc /usr.sbin/pkg_add/OpenBSD/PackageName.pm
parent9f3ff678da304f25a7b5583c667e4dff7d39f58e (diff)
maintain stemlist for installed packages dynamically
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackageName.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageName.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm
index fc5e38fd075..e9c10232a1c 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.22 2007/05/13 13:39:43 espie Exp $
+# $OpenBSD: PackageName.pm,v 1.23 2007/05/14 10:00:08 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -153,6 +153,23 @@ sub find
return keys %{$self->{$stem}};
}
+sub add
+{
+ my ($self, $pkgname) = @_;
+ my $stem = OpenBSD::PackageName::splitstem($pkgname);
+ $self->{$stem}->{$pkgname} = 1;
+}
+
+sub delete
+{
+ my ($self, $pkgname) = @_;
+ my $stem = OpenBSD::PackageName::splitstem($pkgname);
+ delete $self->{$stem}->{$pkgname};
+ if(keys %{$self->{$stem}} == 0) {
+ delete $self->{$stem};
+ }
+}
+
sub find_partial
{
my ($self, $partial) = @_;