summaryrefslogtreecommitdiffstats
path: root/urpm/orphans.pm
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@mandriva.com>2009-01-13 14:09:13 +0000
committerChristophe Fergeau <cfergeau@mandriva.com>2009-01-13 14:09:13 +0000
commitd8a22452d3f175975195c40e8055cfd50b2414eb (patch)
tree254c597cb485fff70b28bbdbadf18fea6b157c46 /urpm/orphans.pm
parentf8c1eabb7d685ee517ecac69b682b96398cec860 (diff)
downloadurpmi-d8a22452d3f175975195c40e8055cfd50b2414eb.tar
urpmi-d8a22452d3f175975195c40e8055cfd50b2414eb.tar.gz
urpmi-d8a22452d3f175975195c40e8055cfd50b2414eb.tar.bz2
urpmi-d8a22452d3f175975195c40e8055cfd50b2414eb.tar.xz
urpmi-d8a22452d3f175975195c40e8055cfd50b2414eb.zip
mark packages that were initially installed through deps, removed and
reinstalled as non-orphanable, fix writing of installed-through-deps
Diffstat (limited to 'urpm/orphans.pm')
-rw-r--r--urpm/orphans.pm24
1 files changed, 12 insertions, 12 deletions
diff --git a/urpm/orphans.pm b/urpm/orphans.pm
index 13e46ed3..5ec8fef4 100644
--- a/urpm/orphans.pm
+++ b/urpm/orphans.pm
@@ -43,22 +43,22 @@ sub unrequested_list {
sub mark_as_requested {
my ($urpm, $state, $test) = @_;
my $unrequested = unrequested_list($urpm);
- my @requested;
+ my $dirty;
- push @requested, map { ($urpm->{depslist}[$_])->name } keys %{$state->{rejected_already_installed} || {}};
-
- foreach (@requested) {
- my $name = $_;
- if ($unrequested->{$_}) {
- $urpm->{info}(N("Marking $_ as manually installed, it won't be auto-orphaned"));
+ foreach (keys %{$state->{rejected_already_installed}},
+ grep { $state->{selected}{$_}{requested} } keys %{$state->{selected}}) {
+ my $name = $urpm->{depslist}[$_]->name;
+ if ($unrequested->{$name} && exists(${$state->{rejected_already_installed}}{$_})) {
+ $urpm->{info}(N("Marking $name as manually installed, it won't be auto-orphaned"));
} else {
- $urpm->{debug}("$_ is not in potential orphans") if $urpm->{debug};
- print("$_ is not in potential orphans\n");
+ $urpm->{debug}("$name is not in potential orphans") if $urpm->{debug};
}
- delete $unrequested->{$_};
+ $dirty = $dirty || (defined (delete $unrequested->{$name}));
}
- if (!$test) {
- _write_unrequested_list__file($urpm, $unrequested);
+ if ($dirty && !$test) {
+ my $pkgs = installed_packages_packed($urpm);
+ my $unreq = partition { $unrequested->{$_->name} } @$pkgs;
+ _write_unrequested_list__file($urpm, $unreq);
}
}