summaryrefslogtreecommitdiffstats
path: root/urpmi
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-07 20:46:40 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-07 20:46:40 +0000
commitc617573f7ca65da803615991419db926420f22b1 (patch)
treebb3d7d440cbeec7fee53d0751c5232f31a4c8548 /urpmi
parentc54d9828bb2eb4a38197b8d656aefd52c9c9ea36 (diff)
downloadurpmi-c617573f7ca65da803615991419db926420f22b1.tar
urpmi-c617573f7ca65da803615991419db926420f22b1.tar.gz
urpmi-c617573f7ca65da803615991419db926420f22b1.tar.bz2
urpmi-c617573f7ca65da803615991419db926420f22b1.tar.xz
urpmi-c617573f7ca65da803615991419db926420f22b1.zip
o handle "unrequested orphans" (similar to "deborphan")
Diffstat (limited to 'urpmi')
-rwxr-xr-xurpmi21
1 files changed, 20 insertions, 1 deletions
diff --git a/urpmi b/urpmi
index b79bf901..23e0b811 100755
--- a/urpmi
+++ b/urpmi
@@ -83,6 +83,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}{$_};
}
@@ -587,6 +588,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");
+ }
+}
+
foreach my $pkg (@to_install) {
#- reflect change in flag usage, now requested is set whatever a package is selected or not,
#- but required is always set (so a required but not requested is a pure dependency).
@@ -669,6 +680,14 @@ my $exit_code = urpm::main_loop::run($urpm, $state,
}
});
+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;
+ }
+ }
+}
+
unless ($env || $options{nolock}) {
$urpmi_lock->unlock;
$rpm_lock->unlock if $rpm_lock;