summaryrefslogtreecommitdiffstats
path: root/urpmi
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 /urpmi
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.
Diffstat (limited to 'urpmi')
-rwxr-xr-xurpmi15
1 files changed, 13 insertions, 2 deletions
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;