diff options
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index 534b8e1ef35..6dafcbb359e 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.172 2019/05/23 22:33:29 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.173 2019/10/13 16:22:58 espie Exp $ # # Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org> # @@ -192,6 +192,8 @@ sub find_dep_in_repositories return unless $dep->spec->is_valid; + my $default = $dep->{def}; + my $candidates = $self->{set}->match_locations($dep->spec); if (!$state->defines('allversions')) { require OpenBSD::Search; @@ -200,19 +202,20 @@ sub find_dep_in_repositories } # XXX not really efficient, but hey my %c = map {($_->name, $_)} @$candidates; + my @pkgs = keys %c; if (@pkgs == 1) { return $candidates->[0]; } elsif (@pkgs > 1) { # unless -ii, we return the def if available if ($state->is_interactive < 2) { - if (defined(my $d = $c{$dep->{def}})) { + if (defined(my $d = $c{$default})) { return $d; } } # put default first if available - @pkgs = ((grep {$_ eq $dep->{def}} @pkgs), - (sort (grep {$_ ne $dep->{def}} @pkgs))); + @pkgs = ((grep {$_ eq $default} @pkgs), + (sort (grep {$_ ne $default} @pkgs))); my $good = $state->ask_list( 'Ambiguous: choose dependency for '.$self->{set}->print.': ', @pkgs); |