summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--pod/urpmi.8.pod4
-rw-r--r--urpm/args.pm1
-rwxr-xr-xurpm/main_loop.pm1
-rwxr-xr-xurpmi14
-rw-r--r--urpmi.bash-completion1
6 files changed, 20 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 03474749..28eab695 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
- urpmi
+ o new option --replacepkgs (same as rpm --replacepkgs) (#16112)
o fix --quiet (regression introduced in 4.9.28)
- all tools
o new option --wait-lock (#13025)
diff --git a/pod/urpmi.8.pod b/pod/urpmi.8.pod
index 1d48c47f..a166ddad 100644
--- a/pod/urpmi.8.pod
+++ b/pod/urpmi.8.pod
@@ -190,6 +190,10 @@ Proposes a verbose mode with various messages.
With this option, urpmi will not install "suggested" packages.
By default, urpmi will install (newly) suggested packages.
+=item B<--replacepkgs>
+
+Force installing the packages even though they are already installed.
+
=item B<--allow-nodeps>
With this option, urpmi will ask the user on error whether it should
diff --git a/urpm/args.pm b/urpm/args.pm
index b5694863..e580257b 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -95,6 +95,7 @@ my %options_spec = (
$urpm->{options}{'priority-upgrade'} = '';
},
force => \$::force,
+ replacepkgs => \$options{replacepkgs},
'no-suggests' => sub { $urpm->{options}{'no-suggests'} = 1 },
'allow-nodeps' => sub { $urpm->{options}{'allow-nodeps'} = 1 },
'allow-force' => sub { $urpm->{options}{'allow-force'} = 1 },
diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm
index 5952466a..d631347e 100755
--- a/urpm/main_loop.pm
+++ b/urpm/main_loop.pm
@@ -161,6 +161,7 @@ foreach my $set (@{$state->{transaction} || []}) {
repackage => $urpm->{options}{repackage},
post_clean_cache => $urpm->{options}{'post-clean'},
oldpackage => $state->{oldpackage},
+ replacepkgs => $options{replacepkgs},
nosize => $urpm->{options}{ignoresize},
ignorearch => $urpm->{options}{ignorearch},
noscripts => $urpm->{options}{noscripts},
diff --git a/urpmi b/urpmi
index e77bb5af..52f268d6 100755
--- a/urpmi
+++ b/urpmi
@@ -102,6 +102,7 @@ usage:
") . N(" --install-src - install only source package (no binaries).
") . N(" --clean - remove rpm from cache before anything else.
") . N(" --noclean - don't clean rpms from cache.
+") . N(" --replacepkgs - force installing packages which are already installed.
") . N(" --force - force invocation even if some packages do not exist.
") . N(" --allow-nodeps - allow asking user to install packages without
dependencies checking.
@@ -458,7 +459,15 @@ sub ask_choice {
#- handle parallel option if any.
#- return value is true if program should be restarted (in order to take care of important
#- packages being upgraded (problably urpmi and perl-URPM, but maybe rpm too, and glibc also ?).
-my $restart_itself = urpm::select::resolve_dependencies($urpm,
+my $restart_itself;
+if ($options{replacepkgs}) {
+ foreach (keys %requested) {
+ my $pkg = $urpm->{depslist}[$_] or next;
+ $pkg->set_flag_requested;
+ $state->{selected}{$_} = undef;
+ }
+} else {
+ $restart_itself = urpm::select::resolve_dependencies($urpm,
$state,
\%requested,
rpmdb => $env && "$env/rpmdb.cz",
@@ -469,7 +478,8 @@ my $restart_itself = urpm::select::resolve_dependencies($urpm,
nodeps => $urpm->{options}{'allow-nodeps'} || $urpm->{options}{'allow-force'},
no_suggests => $urpm->{options}{'no-suggests'},
priority_upgrade => $test || $env ? '' : $urpm->{options}{'priority-upgrade'},
-);
+ );
+}
my @unselected_uninstalled = @{$state->{unselected_uninstalled} || []};
if (@unselected_uninstalled) {
diff --git a/urpmi.bash-completion b/urpmi.bash-completion
index c15d84c8..8c93fd86 100644
--- a/urpmi.bash-completion
+++ b/urpmi.bash-completion
@@ -108,6 +108,7 @@ _urpmi()
# add dangereous option for everything else as rurpmi
if [[ ${COMP_WORDS[0]} != *rurpmi ]]; then
options="$options --root --use-distrib --env \
+ --replacepkgs \
--allow-nodeps --allow-force --no-suggests --force \
--noscripts --auto-update --keep --nokeep \
--verify-rpm"