summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--urpm/main_loop.pm17
-rw-r--r--urpm/select.pm17
-rwxr-xr-xurpmi5
4 files changed, 28 insertions, 14 deletions
diff --git a/NEWS b/NEWS
index 120892da..6777b702 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@
- urpmi:
o "missing file" and "bad rpms" errors are reported asap
and are fatal errors unless the user wants to go on anyway (or --force)
+ o display a message "Package foo is already installed" when asking
+ "urpmi foo bar" and only installing bar (#41593)
+ (requires perl-URPM 3.16)
o set connection timeout for rsync as well (Anssi)
o fix --replacepkgs when a same package appears more than once in urpmi db
o fix displaying "files are missing" (regression introduced in 5.6)
diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm
index 4d8b4382..6f743746 100644
--- a/urpm/main_loop.pm
+++ b/urpm/main_loop.pm
@@ -294,20 +294,9 @@ if ($nok) {
if ($auto_select) {
print N("Packages are up to date"), "\n";
} else {
- my @pkgs = map { $urpm->{depslist}[$_] } map { split /\|/ } keys %$requested;
- my ($installed, $error) = partition { $_->flag_installed } @pkgs;
- my @installed = map { scalar $_->fullname } @$installed;
- my @error = map { scalar $_->fullname } @$error;
- my @msg1 = @installed == 0 ? () :
- @installed == 1 ?
- N("Package %s is already installed", join(', ', @installed)) :
- N("Packages %s are already installed", join(', ', @installed));
- my @msg2 = @error == 0 ? () :
- @error == 1 ?
- N("Package %s can not be installed", join(', ', @error)) :
- N("Packages %s can not be installed", join(', ', @error));
- $callbacks->{already_installed_or_not_installable} and $callbacks->{already_installed_or_not_installable}->(\@msg1, \@msg2);
- print join("\n", @msg1, @msg2, '');
+ my $msg = urpm::select::translate_already_installed($state);
+ $callbacks->{already_installed_or_not_installable} and
+ $callbacks->{already_installed_or_not_installable}->([$msg], []);
}
}
$exit_code = 15 if our $expect_install;
diff --git a/urpm/select.pm b/urpm/select.pm
index cf176b52..f04d3bff 100644
--- a/urpm/select.pm
+++ b/urpm/select.pm
@@ -514,6 +514,22 @@ sub unselected_packages {
grep { $state->{rejected}{$_}{backtrack} } keys %{$state->{rejected} || {}};
}
+#- misc functions to help finding ask_unselect and ask_remove elements with their reasons translated.
+sub already_installed {
+ my ($state) = @_;
+ grep { $state->{rejected}{$_}{installed} } keys %{$state->{rejected} || {}};
+}
+
+sub translate_already_installed {
+ my ($state) = @_;
+
+ my @l = already_installed($state) or return;
+
+ @l == 1 ?
+ N("Package %s is already installed", join(', ', @l)) :
+ N("Packages %s are already installed", join(', ', @l));
+}
+
sub translate_why_unselected {
my ($urpm, $state, @fullnames) = @_;
@@ -539,6 +555,7 @@ sub translate_why_unselected_one {
} @unsatisfied)),
$rb->{promote} && !$rb->{keep} ? N("trying to promote %s", join(", ", @{$rb->{promote}})) : (),
$rb->{keep} ? N("in order to keep %s", join(", ", @{$rb->{keep}})) : (),
+ $rb->{installed} ? "already installed" : (),
);
$fullname . ($s ? " ($s)" : '');
}
diff --git a/urpmi b/urpmi
index bf0a94ba..c9749d46 100755
--- a/urpmi
+++ b/urpmi
@@ -495,6 +495,11 @@ if ($options{replacepkgs}) {
);
}
+{
+ my $msg = urpm::select::translate_already_installed($state);
+ $msg and print "$msg\n";
+}
+
my @unselected_uninstalled = @{$state->{unselected_uninstalled} || []};
if (@unselected_uninstalled) {
my $list = join "\n", map { $_->name . '-' . $_->version . '-' . $_->release } @unselected_uninstalled;