From ec8ddac0b1b2a0ba80424a1b47bb6bab9e35bcf5 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Sun, 19 Apr 2009 14:58:33 +0000 Subject: 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. --- usr.sbin/pkg_add/OpenBSD/PackingList.pm | 44 ++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 4 deletions(-) (limited to 'usr.sbin/pkg_add/OpenBSD/PackingList.pm') 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 # @@ -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)); -- cgit v1.2.3