diff options
author | Francois Pons <fpons@mandriva.com> | 2003-06-13 15:13:11 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2003-06-13 15:13:11 +0000 |
commit | 497ca49641346b3e2bb8bd9ef38db614f94fac87 (patch) | |
tree | b6c5b6f1c82463fffe95c83b1007bff335f0dc58 /urpm.pm | |
parent | 50acfe2c3b02fde7f51e8c1b37bac4d60fce324e (diff) | |
download | urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.tar urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.tar.gz urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.tar.bz2 urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.tar.xz urpmi-497ca49641346b3e2bb8bd9ef38db614f94fac87.zip |
4.3-15mdk
Diffstat (limited to 'urpm.pm')
-rw-r--r-- | urpm.pm | 53 |
1 files changed, 53 insertions, 0 deletions
@@ -2790,6 +2790,59 @@ sub parallel_remove { ); } +#- misc functions to help finding ask_unselect and ask_remove elements with their reasons translated. +sub unselected_packages { + my ($urpm, $state, %options) = @_; + + grep { $state->{rejected}{$_}{backtrack} } keys %{$state->{rejected} || {}}; +} +sub translate_why_unselected { + my ($urpm, $state, @l) = @_; + + map { my @froms = keys %{$state->{rejected}{$_}{backtrack}{closure} || {}}; + my @unsatisfied = @{$state->{rejected}{$_}{backtrack}{unsatisfied} || []}; + my $s = join ", ", ((map { N("due to missing %s", $_) } @froms), + (map { N("due to unsatisfied %s", $_) } @unsatisfied)); + $_ . ($s ? " ($s)" : ''); + } @l; +} + +sub removed_packages { + my ($urpm, $state, %options) = @_; + + grep { $state->{rejected}{$_}{removed} && !$state->{rejected}{$_}{obsoleted} } keys %{$state->{rejected} || {}}; +} +sub translate_why_removed { + my ($urpm, $state, @l) = @_; + + map { my ($from) = keys %{$state->{rejected}{$_}{closure}}; + my ($whyk) = keys %{$state->{rejected}{$_}{closure}{$from}}; + my ($whyv) = $state->{rejected}{$_}{closure}{$from}{$whyk}; + my $frompkg = $urpm->search($from, strict_fullname => 1); + my $s; + for ($whyk) { + /old_requested/ and + $s .= N("in order to install %s", $frompkg ? scalar $frompkg->fullname : $from); + /unsatisfied/ and do { + foreach (@$whyv) { + $s and $s .= ', '; + if (/([^\[\s]*)(?:\[\*\])?(?:\[|\s+)([^\]]*)\]?$/) { + $s .= N("due to unsatisfied %s", "$1 $2"); + } else { + $s .= N("due to missing %s", $_); + } + } + }; + /conflicts/ and + $s .= N("due to conflicts with %s", $whyv); + /unrequested/ and + $s .= N("unrequested"); + } + #- now insert the reason if available. + $_ . ($s ? " ($s)" : ''); + } @l; +} + 1; __END__ |