summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-10 09:13:39 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-10 09:13:39 +0000
commit5b6ff038ec8e4bdc82ed221f02a57e6a7ebc4a5f (patch)
tree115241ff7c90ee31dc8c73da39069c597243dac9 /urpm.pm
parent7ba1f0eeaab2f07bf5656ce98fc859e6e9915614 (diff)
downloadurpmi-5b6ff038ec8e4bdc82ed221f02a57e6a7ebc4a5f.tar
urpmi-5b6ff038ec8e4bdc82ed221f02a57e6a7ebc4a5f.tar.gz
urpmi-5b6ff038ec8e4bdc82ed221f02a57e6a7ebc4a5f.tar.bz2
urpmi-5b6ff038ec8e4bdc82ed221f02a57e6a7ebc4a5f.tar.xz
urpmi-5b6ff038ec8e4bdc82ed221f02a57e6a7ebc4a5f.zip
- adapt ->translate_why_removed to do what each callers do: sort its args and return a single string
- create translate_why_removed_one to make function smaller
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm61
1 files changed, 32 insertions, 29 deletions
diff --git a/urpm.pm b/urpm.pm
index 6706c9fc..0ad56704 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -3293,35 +3293,38 @@ sub removed_packages {
}
sub translate_why_removed {
- my ($urpm, $state, @l) = @_;
- map {
- my $closure = $state->{rejected}{$_}{closure};
- my ($from) = keys %$closure;
- my ($whyk) = keys %{$closure->{$from}};
- my $whyv = $closure->{$from}{$whyk};
- my $frompkg = $urpm->search($from, strict_fullname => 1);
- my $s = do {
- if ($whyk =~ /old_requested/) {
- N("in order to install %s", $frompkg ? scalar $frompkg->fullname : $from);
- } elsif ($whyk =~ /unsatisfied/) {
- join(",\n ", map {
- if (/([^\[\s]*)(?:\[\*\])?(?:\[|\s+)([^\]]*)\]?$/ && $2 ne '*') {
- N("due to unsatisfied %s", "$1 $2");
- } else {
- N("due to missing %s", $_);
- }
- } @$whyv);
- } elsif ($whyk =~ /conflicts/) {
- N("due to conflicts with %s", $whyv);
- } elsif ($whyk =~ /unrequested/) {
- N("unrequested");
- } else {
- undef;
- }
- };
- #- now insert the reason if available.
- $_ . ($s ? "\n ($s)" : '');
- } @l;
+ my ($urpm, $state, @fullnames) = @_;
+ join("\n", map { translate_why_removed_one($urpm, $state, $_) } sort @fullnames);
+}
+sub translate_why_removed_one {
+ my ($urpm, $state, $fullname) = @_;
+
+ my $closure = $state->{rejected}{$fullname}{closure};
+ my ($from) = keys %$closure;
+ my ($whyk) = keys %{$closure->{$from}};
+ my $whyv = $closure->{$from}{$whyk};
+ my $frompkg = $urpm->search($from, strict_fullname => 1);
+ my $s = do {
+ if ($whyk =~ /old_requested/) {
+ N("in order to install %s", $frompkg ? scalar $frompkg->fullname : $from);
+ } elsif ($whyk =~ /unsatisfied/) {
+ join(",\n ", map {
+ if (/([^\[\s]*)(?:\[\*\])?(?:\[|\s+)([^\]]*)\]?$/ && $2 ne '*') {
+ N("due to unsatisfied %s", "$1 $2");
+ } else {
+ N("due to missing %s", $_);
+ }
+ } @$whyv);
+ } elsif ($whyk =~ /conflicts/) {
+ N("due to conflicts with %s", $whyv);
+ } elsif ($whyk =~ /unrequested/) {
+ N("unrequested");
+ } else {
+ undef;
+ }
+ };
+ #- now insert the reason if available.
+ $fullname . ($s ? "\n ($s)" : '');
}
sub check_sources_signatures {