summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@mandriva.com>2009-03-23 17:05:06 +0000
committerChristophe Fergeau <cfergeau@mandriva.com>2009-03-23 17:05:06 +0000
commita6560aa5e65d380a9f40de585f28f4af022e8d74 (patch)
tree2e95a3b8928f219b673b09401cc2bf225bc02dcc
parent1cf4d68e8b1adcacacb2688f9ae56846bc74a4cf (diff)
downloadurpmi-a6560aa5e65d380a9f40de585f28f4af022e8d74.tar
urpmi-a6560aa5e65d380a9f40de585f28f4af022e8d74.tar.gz
urpmi-a6560aa5e65d380a9f40de585f28f4af022e8d74.tar.bz2
urpmi-a6560aa5e65d380a9f40de585f28f4af022e8d74.tar.xz
urpmi-a6560aa5e65d380a9f40de585f28f4af022e8d74.zip
Revert "urpmi doesn't have a --auto-orphans parameter, fixes bug #48946"
The parameter was actually implemented and working, dunno how I overlooked that.
-rw-r--r--pod/urpmi.8.pod4
-rwxr-xr-xurpmi15
-rw-r--r--urpmi.bash-completion2
3 files changed, 18 insertions, 3 deletions
diff --git a/pod/urpmi.8.pod b/pod/urpmi.8.pod
index 8edba48f..7e274c91 100644
--- a/pod/urpmi.8.pod
+++ b/pod/urpmi.8.pod
@@ -107,6 +107,10 @@ Like B<--auto-select>, but also updates all relevant media before
selection of upgradeable packages is made. This avoids a previous call to
C<urpmi.update>.
+=item B<--auto-orphans>
+
+Remove all orphans without asking (see also C<urpme --auto-orphans>)
+
=item B<--no-md5sum>
Disable MD5SUM file checking when updating media.
diff --git a/urpmi b/urpmi
index 6c74d67a..fec56f1a 100755
--- a/urpmi
+++ b/urpmi
@@ -81,6 +81,7 @@ usage:
") . N(" --auto-update - update media then upgrade the system.
") . N(" --no-md5sum - disable MD5SUM file checking.
") . N(" --force-key - force update of gpg key.
+") . N(" --auto-orphans - remove orphans without asking
") . N(" --no-suggests - do not auto select \"suggested\" packages.
") . N(" --no-uninstall - never ask to uninstall a package, abort the installation.
") . N(" --no-install - don't install packages (only download)
@@ -239,7 +240,7 @@ if ($restricted) {
#- force some options
foreach (qw(keep verify-rpm)) { $urpm->{options}{$_} = 1 }
#- forbid some other options
- urpm::error_restricted($urpm) if $urpm->{root} || $options{usedistrib} || $force || $env || $parallel || $options{synthesis} || $auto_update;
+ urpm::error_restricted($urpm) if $urpm->{root} || $options{usedistrib} || $force || $env || $parallel || $options{synthesis} || $auto_update || $options{auto_orphans};
foreach (qw(allow-nodeps allow-force curl-options rsync-options wget-options prozilla-options noscripts)) {
urpm::error_restricted($urpm) if $urpm->{options}{$_};
}
@@ -563,6 +564,16 @@ my @to_install = @{$urpm->{depslist}}[sort { $a <=> $b } keys %{$state->{selecte
}
}
+
+if (@to_install && $options{auto_orphans}) {
+ urpm::orphans::compute_future_unrequested_orphans($urpm, $state);
+ if (my @orphans = map { scalar $_->fullname } @{$state->{orphans_to_remove}}) {
+ print P("The following orphan package will be removed.",
+ "The following orphan packages will be removed.", scalar(@orphans))
+ . "\n" . urpm::orphans::add_leading_spaces(join("\n", @orphans) . "\n");
+ }
+}
+
#- this cleans up the list of potential orphan packages:
#- - if a package is explicitly requested on the command line, then
#- we assume the user doesn't want this package to be auto orphaned
@@ -654,7 +665,7 @@ my $exit_code = urpm::main_loop::run($urpm, $state,
}
});
-if ($exit_code == 0 && $auto_select) {
+if ($exit_code == 0 && $auto_select && !$options{auto_orphans}) {
if (urpm::orphans::check_unrequested_orphans_after_auto_select($urpm)) {
if (my $msg = urpm::orphans::get_now_orphans_msg($urpm)) {
print "\n", $msg;
diff --git a/urpmi.bash-completion b/urpmi.bash-completion
index ffd20dca..752606e7 100644
--- a/urpmi.bash-completion
+++ b/urpmi.bash-completion
@@ -95,7 +95,7 @@ _urpmi()
# add dangereous option for everything else as rurpmi
if [[ ${COMP_WORDS[0]} != *rurpmi ]]; then
options="$options --root --use-distrib --env \
- --replacepkgs --justdb \
+ --auto-orphans --replacepkgs --justdb \
--allow-nodeps --allow-force --no-suggests --force \
--noscripts --auto-update --keep --nokeep \
--verify-rpm"