summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2011-01-02 14:26:18 +0000
committerMarc Espie <espie@cvs.openbsd.org>2011-01-02 14:26:18 +0000
commitb40f3c265535bc3bcccd3119a5535800b245d683 (patch)
treee158366882956dd00222acf559cbf228a274ade7 /usr.sbin/pkg_add
parentc52b96ea87bad76302d1f8c26368c7ff1b1ba932 (diff)
kill very old idiom, I don't actually want to go thru items directly.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/CollisionReport.pm27
1 files changed, 18 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm b/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm
index bc651f380c6..7ed65c52792 100644
--- a/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm
+++ b/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: CollisionReport.pm,v 1.40 2010/12/24 09:04:14 espie Exp $
+# $OpenBSD: CollisionReport.pm,v 1.41 2011/01/02 14:26:17 espie Exp $
#
# Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org>
#
@@ -18,6 +18,22 @@
use strict;
use warnings;
+package OpenBSD::PackingElement;
+sub handle_collisions
+{
+}
+
+package OpenBSD::PackingElement::FileBase;
+sub handle_collisions
+{
+ my ($self, $todo, $pkg, $bypkg) = @_;
+ my $name = $self->fullname;
+ if (defined $todo->{$name}) {
+ push(@{$bypkg->{$pkg}}, $name);
+ delete $todo->{$name};
+ }
+}
+
package OpenBSD::CollisionReport;
use OpenBSD::PackingList;
use OpenBSD::PackageInfo;
@@ -44,14 +60,7 @@ sub find_collisions
my $plist = OpenBSD::PackingList->from_installation($pkg,
\&OpenBSD::PackingList::FilesOnly);
next if !defined $plist;
- for my $item (@{$plist->{items}}) {
- next unless $item->IsFile;
- my $name = $item->fullname;
- if (defined $todo->{$name}) {
- push(@{$bypkg->{$pkg}}, $name);
- delete $todo->{$name};
- }
- }
+ $plist->handle_collisions($todo, $pkg, $bypkg);
}
return $bypkg;
}