From 44ed6ee04c327dc2429f9f00c22f81393b92aeec Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Fri, 1 Jan 2010 12:57:09 +0000 Subject: make the merge_paths operations visible --- usr.sbin/pkg_add/OpenBSD/UpdateSet.pm | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm index 09703d6cce6..a8d77f3f83e 100644 --- a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm +++ b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: UpdateSet.pm,v 1.47 2010/01/01 12:47:14 espie Exp $ +# $OpenBSD: UpdateSet.pm,v 1.48 2010/01/01 12:57:08 espie Exp $ # # Copyright (c) 2007-2009 Marc Espie # @@ -88,6 +88,19 @@ sub add_repositories $set->{path}->add(@repos); } +sub merge_paths +{ + my ($set, $other) = @_; + + if (defined $other->path) { + if (!defined $set->path) { + $set->{path} = $other->path; + } elsif ($set->{path} ne $other->path) { + $set->add_path(@{$other->{path}}); + } + } +} + sub match_locations { my ($set, @spec) = @_; @@ -348,13 +361,7 @@ sub merge $self->add_newer($set->newer); $self->add_older($set->older); $self->add_kept($set->kept); - if (defined $set->path) { - if (!defined $self->path) { - $self->{path} = $set->path; - } elsif ($set->{path} ne $self->path) { - $self->add_path(@{$set->{path}}); - } - } + $self->merge_paths($set); # ... and mark it as already done $set->{finished} = 1; $tracker->handle_set($set); -- cgit v1.2.3