diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-06-05 23:19:01 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-06-05 23:19:01 +0000 |
commit | e365692f2cafb7c9a2efa865e976f84d5d1fc4e8 (patch) | |
tree | 8f4d75c5c05644d7ec1a71ee5c9f22d44c478b53 /usr.sbin/pkg_add | |
parent | 1a073eb4e2fb8cfca5238a9de151658dbaafdb28 (diff) |
allow accessing all older values (make a semantic distinction), so that
adjust_dependencies gets access to all. This fixes some bogus replacements.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 5 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Vstat.pm | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 6 |
3 files changed, 15 insertions, 8 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index e5c747822be..239163ba8c8 100644 --- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm +++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Dependencies.pm,v 1.51 2007/06/04 16:58:40 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.52 2007/06/05 23:19:00 espie Exp $ # # Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org> # @@ -208,7 +208,7 @@ sub register_dependencies sub record_old_dependencies { my ($self, $state) = @_; - for my $o ($self->{set}->older) { + for my $o ($self->{set}->older_to_do) { require OpenBSD::RequiredBy; my @wantlist = OpenBSD::RequiredBy->new($o->{pkgname})->list; $o->{wantlist} = \@wantlist; @@ -220,6 +220,7 @@ sub adjust_old_dependencies my ($self, $state) = @_; my $pkgname = $self->{set}->handle->{pkgname}; for my $o ($self->{set}->older) { + next unless defined $o->{wantlist}; require OpenBSD::Replace; require OpenBSD::RequiredBy; diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm index 98f3da05f81..523f25b3935 100644 --- a/usr.sbin/pkg_add/OpenBSD/Vstat.pm +++ b/usr.sbin/pkg_add/OpenBSD/Vstat.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Vstat.pm,v 1.33 2007/06/04 14:57:33 espie Exp $ +# $OpenBSD: Vstat.pm,v 1.34 2007/06/05 23:19:00 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -350,7 +350,7 @@ package OpenBSD::UpdateSet; sub new { my $class = shift; - return bless {}, $class; + return bless {newer => [], older => []}, $class; } sub add_newer @@ -374,12 +374,18 @@ sub newer sub older { my $self = shift; + return @{$self->{older}}; +} + +sub older_to_do +{ + my $self = shift; # XXX in `combined' updates, some dependencies may remove extra # packages, so we do a double-take on the list of packages we # are actually replacing... for now, until we merge update sets. require OpenBSD::PackageInfo; my @l = (); - for my $h (@{$self->{older}}) { + for my $h ($self->older) { if (OpenBSD::PackageInfo::is_installed($h->{pkgname})) { push(@l, $h); } diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 8c174747f50..9b9574d3ed5 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.310 2007/06/04 14:57:33 espie Exp $ +# $OpenBSD: pkg_add,v 1.311 2007/06/05 23:19:00 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -346,7 +346,7 @@ sub really_add # packages, so we do a double-take on the list of packages we # are actually replacing. my $replacing = 0; - if ($set->older) { + if ($set->older_to_do) { $replacing = 1; } # if (defined $plist->{old_libs}) { @@ -387,7 +387,7 @@ sub really_add } $set->{solver}->record_old_dependencies($state); - for my $o ($set->older) { + for my $o ($set->older_to_do) { my $oldname = $o->{pkgname}; $state->progress->set_header($oldname." (deleting)"); $state->set_name_from_handle($o); |