diff options
-rw-r--r-- | pod/urpmi.8.pod | 4 | ||||
-rwxr-xr-x | urpmi | 15 | ||||
-rw-r--r-- | urpmi.bash-completion | 2 |
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. @@ -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" |