summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--urpm/select.pm18
-rwxr-xr-xurpmi13
3 files changed, 26 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index ff2249c4..8f972366 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+- library:
+ o create urpm::select::conflicting_packages_msg() for rpmdrake
+
Version 6.10 - 9 September 2008, Thierry Vignaud
- library:
diff --git a/urpm/select.pm b/urpm/select.pm
index 01e20d8f..c780b932 100644
--- a/urpm/select.pm
+++ b/urpm/select.pm
@@ -599,6 +599,24 @@ sub rejected_unsatisfied {
map { $_ ? @$_ : () } map { $_->{unsatisfied} } values %$closure;
}
+sub conflicting_packages_msg_ {
+ my ($urpm, $state, $removed_packages_msgs) = @_;
+
+ my $list = join("\n", @$removed_packages_msgs) or return;
+ @$removed_packages_msgs == 1 ?
+ N("The following package has to be removed for others to be upgraded:\n%s", $list)
+ : N("The following packages have to be removed for others to be upgraded:\n%s", $list);
+}
+sub conflicting_packages_msg {
+ my ($urpm, $state) = @_;
+ conflicting_packages_msg_($urpm, $state, [ removed_packages_msgs($urpm, $state) ]);
+}
+
+sub removed_packages_msgs {
+ my ($urpm, $state) = @_;
+ map { translate_why_removed_one($urpm, $state, $_) } sort(removed_packages($urpm, $state));
+}
+
sub translate_why_removed {
my ($urpm, $state, @fullnames) = @_;
join("\n", map { translate_why_removed_one($urpm, $state, $_) } sort @fullnames);
diff --git a/urpmi b/urpmi
index f6e34ff4..541fb3a5 100755
--- a/urpmi
+++ b/urpmi
@@ -519,8 +519,8 @@ if (@ask_unselect) {
}
}
-my @ask_remove = $urpm->{options}{'allow-force'} ? @{[]} : urpm::select::removed_packages($urpm, $state);
-if (@ask_remove) {
+if (my @conflicting_pkgs_msgs =
+ $urpm->{options}{'allow-force'} ? () : urpm::select::removed_packages_msgs($urpm, $state)) {
{
my $db = urpm::db_open_or_die_($urpm);
urpm::select::find_removed_from_basesystem($urpm, $db, $state, sub {
@@ -531,10 +531,9 @@ if (@ask_remove) {
@pkgs and $no_remove = 1;
});
}
- my $list = urpm::select::translate_why_removed($urpm, $state, @ask_remove);
-
if ($no_remove && !$force) {
- my $msg = @ask_remove == 1 ?
+ my $list = join("\n", @conflicting_pkgs_msgs);
+ my $msg = @conflicting_pkgs_msgs == 1 ?
N("The installation cannot continue because the following package
has to be removed for others to be upgraded:\n%s\n", $list)
: N("The installation cannot continue because the following packages
@@ -543,9 +542,7 @@ have to be removed for others to be upgraded:\n%s\n", $list);
exit 0;
}
- my $msg = @ask_remove == 1 ?
- N("The following package has to be removed for others to be upgraded:\n%s", $list)
- : N("The following packages have to be removed for others to be upgraded:\n%s", $list);
+ my $msg = urpm::select::conflicting_packages_msg_($urpm, $state, \@conflicting_pkgs_msgs);
if ($test) {
$msg = "$msg\n" . N("(test only, removal will not be actually done)");
}