From c48868d5213d9aeb66900e38623f3ab4a0695c7c Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Thu, 5 Nov 2015 13:26:40 +0000 Subject: tweak dependencies handling, might fix some infrequent bugs including the infamous cups bug. - look for candidates in the whole new set first. Yep, that includes kept packages (should make things slightly faster, I expect) - correctly remove caching of list of installed packages outsides of old packages from the current set each time we revisit the set (looking at the old behavior this actually sounds very likely). --- usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index 265b8c0a7ff..443d7f04e5b 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.156 2015/08/14 10:12:02 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.157 2015/11/05 13:26:39 espie Exp $ # # Copyright (c) 2005-2010 Marc Espie # @@ -380,7 +380,7 @@ sub solve_depends $self->{all_dependencies} = {}; $self->{to_register} = {}; $self->{deplist} = {}; - delete $self->{installed}; + delete $self->{installed_list}; for my $package ($self->{set}->newer, $self->{set}->kept) { $package->{before} = []; @@ -388,8 +388,8 @@ sub solve_depends my $v = $self->solve_dependency($state, $dep, $package); # XXX next if !defined $v; - $self->{all_dependencies}->{$v} = $dep; - $self->{to_register}->{$package}->{$v} = $dep; + $self->{all_dependencies}{$v} = $dep; + $self->{to_register}{$package}{$v} = $dep; } } @@ -469,7 +469,8 @@ sub find_dep_in_self { my ($self, $state, $dep) = @_; - return $self->find_candidate($dep, $self->{set}->newer_names); + return $self->find_candidate($dep, $self->{set}->newer_names, + $self->{set}->kept_names); } use OpenBSD::PackageInfo; @@ -693,7 +694,7 @@ sub check_depends for my $dep ($self->dependencies) { push(@{$self->{bad}}, $dep) unless is_installed($dep) or - defined $self->{set}->{newer}->{$dep}; + defined $self->{set}{newer}{$dep}; } return $self->{bad}; } @@ -705,7 +706,7 @@ sub register_dependencies require OpenBSD::RequiredBy; for my $pkg ($self->{set}->newer) { my $pkgname = $pkg->pkgname; - my @l = keys %{$self->{to_register}->{$pkg}}; + my @l = keys %{$self->{to_register}{$pkg}}; OpenBSD::Requiring->new($pkgname)->add(@l); for my $dep (@l) { -- cgit v1.2.3