summaryrefslogtreecommitdiffstats
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
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
-rwxr-xr-xgurpmi22
-rw-r--r--urpm.pm61
-rw-r--r--urpme2
-rwxr-xr-xurpmi2
4 files changed, 35 insertions, 32 deletions
diff --git a/gurpmi2 b/gurpmi2
index c068b3ed..947c1c73 100755
--- a/gurpmi2
+++ b/gurpmi2
@@ -190,7 +190,7 @@ sub do_install {
@ask_remove
? ask_continue(N(
"The following packages have to be removed for others to be upgraded:\n%s\nContinue installation anyway?",
- join "\n", $urpm->translate_why_removed($state, sort @ask_remove)
+ $urpm->translate_why_removed($state, @ask_remove)
), \&do_install_2)
: goto &do_install_2;
}
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 {
diff --git a/urpme b/urpme
index 09306898..94a05d2f 100644
--- a/urpme
+++ b/urpme
@@ -112,7 +112,7 @@ my @toremove = $urpm->find_packages_to_remove(
root => $root,
) or $urpm->{fatal}(0, N("Nothing to remove"));
-my $list = join "\n", $urpm->translate_why_removed($state, sort @toremove);
+my $list = $urpm->translate_why_removed($state, @toremove);
if ($test && $auto) {
#- Warning : the following message is parsed in urpm::parallel_*
my $msg = N("Checking to remove the following packages");
diff --git a/urpmi b/urpmi
index 1a58d894..98078b17 100755
--- a/urpmi
+++ b/urpmi
@@ -527,7 +527,7 @@ if (@ask_remove) {
@_ and $no_remove = 1;
});
}
- my $list = join "\n", $urpm->translate_why_removed($state, sort @ask_remove);
+ my $list = $urpm->translate_why_removed($state, @ask_remove);
if ($no_remove && !$force) {
print N("The installation cannot continue because the following packages