diff options
author | Christophe Fergeau <cfergeau@mandriva.com> | 2009-01-13 14:09:14 +0000 |
---|---|---|
committer | Christophe Fergeau <cfergeau@mandriva.com> | 2009-01-13 14:09:14 +0000 |
commit | 7d3c217051e016500247eb15caaa5b85c14f24a2 (patch) | |
tree | a1d62eb4edcde6a63d714c4299c8ed20d2e578f4 /urpm/orphans.pm | |
parent | d8a22452d3f175975195c40e8055cfd50b2414eb (diff) | |
download | urpmi-7d3c217051e016500247eb15caaa5b85c14f24a2.tar urpmi-7d3c217051e016500247eb15caaa5b85c14f24a2.tar.gz urpmi-7d3c217051e016500247eb15caaa5b85c14f24a2.tar.bz2 urpmi-7d3c217051e016500247eb15caaa5b85c14f24a2.tar.xz urpmi-7d3c217051e016500247eb15caaa5b85c14f24a2.zip |
Code cleanups after pixel feedback
Diffstat (limited to 'urpm/orphans.pm')
-rw-r--r-- | urpm/orphans.pm | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/urpm/orphans.pm b/urpm/orphans.pm index 5ec8fef4..6f243ff5 100644 --- a/urpm/orphans.pm +++ b/urpm/orphans.pm @@ -4,7 +4,6 @@ use strict; use urpm::util; use urpm::msg; use urpm; -use strict; # $Id: select.pm 243120 2008-07-01 12:24:34Z pixel $ @@ -48,17 +47,17 @@ sub mark_as_requested { 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}}{$_})) { + if (defined($unrequested->{$name})) { $urpm->{info}(N("Marking $name as manually installed, it won't be auto-orphaned")); + $dirty = 1; } else { $urpm->{debug}("$name is not in potential orphans") if $urpm->{debug}; } - $dirty = $dirty || (defined (delete $unrequested->{$name})); + delete $unrequested->{$name}; } + if ($dirty && !$test) { - my $pkgs = installed_packages_packed($urpm); - my $unreq = partition { $unrequested->{$_->name} } @$pkgs; - _write_unrequested_list__file($urpm, $unreq); + _write_unrequested_list__file($urpm, [keys %{$unrequested}]); } } @@ -82,8 +81,10 @@ sub _installed_and_unrequested_lists { sub _write_unrequested_list__file { my ($urpm, $unreq) = @_; + $urpm->{info}("writing " . unrequested_list__file($urpm)); + output_safe(unrequested_list__file($urpm), - join('', sort map { $_->name . "\n" } @$unreq), + join('', sort map { $_ . "\n" } @$unreq), ".old") if !$urpm->{env_dir}; } @@ -98,7 +99,7 @@ sub _installed_req_and_unreq_and_update_unrequested_list { my ($unreq, $req) = partition { $unrequested->{$_->name} } @$pkgs; # update the list (to filter dups and now-removed-pkgs) - _write_unrequested_list__file($urpm, $unreq); + _write_unrequested_list__file($urpm, [map { $_->name } @$unreq]); ($req, $unreq, $unrequested); } |