summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/PackingList.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-04-19 14:58:33 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-04-19 14:58:33 +0000
commitec8ddac0b1b2a0ba80424a1b47bb6bab9e35bcf5 (patch)
treed6cca43827cdc725b832e2a73bf959a6200d61f2 /usr.sbin/pkg_add/OpenBSD/PackingList.pm
parent087733393d1622a68046244a995781b5af3496b2 (diff)
synch with my new style search/location changes
It's likely there will be some fallout, but it's getting a bit too large to keep around. This does kill a few very old oddities as well.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackingList.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm44
1 files changed, 40 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index c60ce2bc828..26367230885 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingList.pm,v 1.87 2009/04/14 17:53:58 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.88 2009/04/19 14:58:32 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -45,6 +45,18 @@ sub set_cwd
$self->{cwd} = \$p;
}
+package OpenBSD::PackingList::hashpath;
+sub match
+{
+ my ($a, $b) = @_;
+ for my $i (keys %$a) {
+ if ($b->{$i}) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
package OpenBSD::PackingList;
use OpenBSD::PackingElement;
@@ -352,7 +364,7 @@ sub set_pkgname
{
my ($self, $name) = @_;
if (defined $self->{name}) {
- $self->{name}->{name} = $name;
+ $self->{name}->set_name($name);
} else {
OpenBSD::PackingElement::Name->add($self, $name);
}
@@ -361,7 +373,7 @@ sub set_pkgname
sub pkgname
{
my $self = shift;
- return $self->{name}->{name};
+ return $self->{name}->name;
}
sub localbase
@@ -369,7 +381,7 @@ sub localbase
my $self = shift;
if (defined $self->{localbase}) {
- return $self->{localbase}->{name};
+ return $self->{localbase}->name;
} else {
return '/usr/local';
}
@@ -381,6 +393,30 @@ sub is_signed
return defined $self->{'digital-signature'};
}
+sub pkgpath
+{
+ my $self = shift;
+ if (!defined $self->{_hashpath}) {
+ my $h = $self->{_hashpath} =
+ bless {}, "OpenBSD::PackingList::hashpath";
+ if (defined $self->{extrainfo}) {
+ $h->{$self->{extrainfo}->{subdir}} = 1;
+ }
+ if (defined $self->{pkgpath}) {
+ for my $i (@{$self->{pkgpath}}) {
+ $h->{$i->name} = 1;
+ }
+ }
+ }
+ return $self->{_hashpath};
+}
+
+sub match_pkgpath
+{
+ my ($self, $plist2) = @_;
+ return $self->pkgpath->match($plist2->pkgpath);
+}
+
our @unique_categories =
(qw(name digital-signature no-default-conflict manual-installation extrainfo localbase arch));