diff options
author | Christophe Fergeau <cfergeau@mandriva.com> | 2009-01-13 14:09:05 +0000 |
---|---|---|
committer | Christophe Fergeau <cfergeau@mandriva.com> | 2009-01-13 14:09:05 +0000 |
commit | f8c1eabb7d685ee517ecac69b682b96398cec860 (patch) | |
tree | e7588525df2162f3958794a13b8544fea48a9a99 /urpm | |
parent | e39d69aa09e8489351ae23a12d7a88a90ea9db32 (diff) | |
download | urpmi-f8c1eabb7d685ee517ecac69b682b96398cec860.tar urpmi-f8c1eabb7d685ee517ecac69b682b96398cec860.tar.gz urpmi-f8c1eabb7d685ee517ecac69b682b96398cec860.tar.bz2 urpmi-f8c1eabb7d685ee517ecac69b682b96398cec860.tar.xz urpmi-f8c1eabb7d685ee517ecac69b682b96398cec860.zip |
Mark packages as "manually installed"
With the orphan mechanism, there is no way to manually mark a
package that was installed as a dep of another package as not
being a potential orphan. Mimic apt and if an already package
is passed as an argument to urpmi, remove it from the potential
orphans list. Fixes bug #45054.
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/orphans.pm | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/urpm/orphans.pm b/urpm/orphans.pm index 15546190..13e46ed3 100644 --- a/urpm/orphans.pm +++ b/urpm/orphans.pm @@ -4,6 +4,7 @@ use strict; use urpm::util; use urpm::msg; use urpm; +use strict; # $Id: select.pm 243120 2008-07-01 12:24:34Z pixel $ @@ -38,6 +39,29 @@ sub unrequested_list { } cat_(unrequested_list__file($urpm)) }; } +#- side-effects: those of _write_unrequested_list__file +sub mark_as_requested { + my ($urpm, $state, $test) = @_; + my $unrequested = unrequested_list($urpm); + my @requested; + + 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")); + } else { + $urpm->{debug}("$_ is not in potential orphans") if $urpm->{debug}; + print("$_ is not in potential orphans\n"); + } + delete $unrequested->{$_}; + } + if (!$test) { + _write_unrequested_list__file($urpm, $unrequested); + } +} + #- side-effects: #- + those of _installed_req_and_unreq_and_update_unrequested_list (<root>/var/lib/rpm/installed-through-deps.list) sub _installed_req_and_unreq { @@ -53,7 +77,17 @@ sub _installed_and_unrequested_lists { push @$pkgs, @$pkgs2; ($pkgs, $unrequested); } + #- side-effects: <root>/var/lib/rpm/installed-through-deps.list +sub _write_unrequested_list__file { + my ($urpm, $unreq) = @_; + + output_safe(unrequested_list__file($urpm), + join('', sort map { $_->name . "\n" } @$unreq), + ".old") if !$urpm->{env_dir}; +} + +#- side-effects: those of _write_unrequested_list__file sub _installed_req_and_unreq_and_update_unrequested_list { my ($urpm) = @_; @@ -64,9 +98,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) - output_safe(unrequested_list__file($urpm), - join('', sort map { $_->name . "\n" } @$unreq), - ".old") if !$urpm->{env_dir}; + _write_unrequested_list__file($urpm, $unreq); ($req, $unreq, $unrequested); } |