diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-11-10 09:19:22 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-11-10 09:19:22 +0000 |
commit | b306c1a29317c0f0af8d07d2b9026959c339d033 (patch) | |
tree | 2c72fea4d685fd51000e5f19c51cf991aa8be47e | |
parent | 5b6ff038ec8e4bdc82ed221f02a57e6a7ebc4a5f (diff) | |
download | urpmi-b306c1a29317c0f0af8d07d2b9026959c339d033.tar urpmi-b306c1a29317c0f0af8d07d2b9026959c339d033.tar.gz urpmi-b306c1a29317c0f0af8d07d2b9026959c339d033.tar.bz2 urpmi-b306c1a29317c0f0af8d07d2b9026959c339d033.tar.xz urpmi-b306c1a29317c0f0af8d07d2b9026959c339d033.zip |
- adapt ->translate_why_unselected to do what each callers do: sort its args and return a single string
- create translate_why_unselected_one to make function smaller
-rwxr-xr-x | gurpmi2 | 2 | ||||
-rw-r--r-- | urpm.pm | 42 | ||||
-rwxr-xr-x | urpmi | 2 |
3 files changed, 25 insertions, 21 deletions
@@ -79,7 +79,7 @@ my @ask_unselect = $urpm->unselected_packages($state); @ask_unselect ? ask_continue(N( "Some requested packages cannot be installed:\n%s\nContinue installation anyway?", - join "\n", $urpm->translate_why_unselected($state, sort @ask_unselect) + $urpm->translate_why_unselected($state, @ask_unselect) ), \&do_install) : do_install(); @@ -3264,25 +3264,29 @@ sub unselected_packages { sub uniq { my %l; $l{$_} = 1 foreach @_; grep { delete $l{$_} } @_ } sub translate_why_unselected { - my ($urpm, $state, @l) = @_; - - map { - my $rb = $state->{rejected}{$_}{backtrack}; - my @froms = keys %{$rb->{closure} || {}}; - my @unsatisfied = @{$rb->{unsatisfied} || []}; - my $s = join ", ", ( - (map { N("due to missing %s", $_) } @froms), - (map { N("due to unsatisfied %s", $_) } uniq(map { - #- XXX in theory we shouldn't need this, dependencies (and not ids) should - #- already be present in @unsatisfied. But with biarch packages this is - #- not always the case. - /\D/ ? $_ : scalar($urpm->{depslist}[$_]->fullname); - } @unsatisfied)), - $rb->{promote} && !$rb->{keep} ? N("trying to promote %s", join(", ", @{$rb->{promote}})) : @{[]}, - $rb->{keep} ? N("in order to keep %s", join(", ", @{$rb->{keep}})) : @{[]}, - ); - $_ . ($s ? " ($s)" : ''); - } @l; + my ($urpm, $state, @fullnames) = @_; + + join("\n", map { translate_why_unselected_one($urpm, $state, $_) } sort @fullnames); +} + +sub translate_why_unselected_one { + my ($urpm, $state, $fullname) = @_; + + my $rb = $state->{rejected}{$fullname}{backtrack}; + my @froms = keys %{$rb->{closure} || {}}; + my @unsatisfied = @{$rb->{unsatisfied} || []}; + my $s = join ", ", ( + (map { N("due to missing %s", $_) } @froms), + (map { N("due to unsatisfied %s", $_) } uniq(map { + #- XXX in theory we shouldn't need this, dependencies (and not ids) should + #- already be present in @unsatisfied. But with biarch packages this is + #- not always the case. + /\D/ ? $_ : scalar($urpm->{depslist}[$_]->fullname); + } @unsatisfied)), + $rb->{promote} && !$rb->{keep} ? N("trying to promote %s", join(", ", @{$rb->{promote}})) : (), + $rb->{keep} ? N("in order to keep %s", join(", ", @{$rb->{keep}})) : (), + ); + $fullname . ($s ? " ($s)" : ''); } sub removed_packages { @@ -499,7 +499,7 @@ that are older than the installed ones:\n%s", $list); my @ask_unselect = $urpm->unselected_packages($state); if (@ask_unselect) { - my $list = join "\n", $urpm->translate_why_unselected($state, sort @ask_unselect); + my $list = $urpm->translate_why_unselected($state, @ask_unselect); my $msg = N("Some requested packages cannot be installed:\n%s", $list); if ($urpm->{options}{auto}) { print "$msg\n"; |