From 68a49326b018f298207b00b15793befb7a2d7cbe Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Wed, 2 Dec 2009 11:36:28 +0000 Subject: fix some inter-dependencies case: - when we merge updatesets, invalidate the solver (there isn't any, usually). - look inside set for check_depends. - do register_dependencies after committing all plists to cache. --- usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 9 ++++----- usr.sbin/pkg_add/OpenBSD/UpdateSet.pm | 3 ++- usr.sbin/pkg_add/pkg_add | 6 ++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index 305db7462e9..f03132c2073 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.89 2009/11/29 13:19:29 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.90 2009/12/02 11:36:27 espie Exp $ # # Copyright (c) 2005-2007 Marc Espie # @@ -250,9 +250,7 @@ sub find_dep_in_self { my ($self, $state, $dep) = @_; - return find_candidate($dep->spec, - map {$_->pkgname} $self->{set}->newer); - + return find_candidate($dep->spec, $self->{set}->newer_names); } sub find_dep_in_stuff_to_install @@ -350,7 +348,8 @@ sub check_depends my @bad = (); for my $dep ($self->dependencies) { - push(@bad, $dep) unless is_installed($dep); + push(@bad, $dep) + unless is_installed($dep) or $self->{set}->{newer}->{$dep}; } return @bad; } diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm index 13737b9e321..eeec7822851 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.31 2009/11/30 16:15:13 espie Exp $ +# $OpenBSD: UpdateSet.pm,v 1.32 2009/12/02 11:36:27 espie Exp $ # # Copyright (c) 2007 Marc Espie # @@ -266,6 +266,7 @@ sub merge } # then regen tracker info for $self $tracker->add_set($self); + delete $self->{solver}; return $self; } diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index f776afd1933..a01fc5cf66d 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.408 2009/12/01 09:53:09 espie Exp $ +# $OpenBSD: pkg_add,v 1.409 2009/12/02 11:36:27 espie Exp $ # # Copyright (c) 2003-2009 Marc Espie # @@ -491,7 +491,6 @@ sub really_add OpenBSD::Add::tweak_plist_status($plist, $state); $plist->to_cache; OpenBSD::Add::register_installation($plist); - $set->{solver}->register_dependencies($state); add_installed($pkgname); delete $handle->{partial}; OpenBSD::PkgCfl::register($plist, $state); @@ -499,6 +498,9 @@ sub really_add $plist->get(DISPLAY)->prepare($state); } } + for my $handle ($set->newer) { + $set->{solver}->register_dependencies($state); + } $set->{solver}->adjust_old_dependencies($state); if ($state->{repairdependencies}) { $set->{solver}->repair_dependencies($state); -- cgit v1.2.3