summaryrefslogtreecommitdiffstats
path: root/perl-install/pkgs.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-09-06 09:45:55 +0000
committerFrancois Pons <fpons@mandriva.com>2002-09-06 09:45:55 +0000
commit8ef5a525e06308ca0ac0e0f1501b645c2efc0de5 (patch)
tree2b295321f8c06973c4ec49db3440b19782d20f94 /perl-install/pkgs.pm
parentb01ebfe5b90f2cdf6ca9fdc79e9815a633e808b4 (diff)
downloaddrakx-backup-do-not-use-8ef5a525e06308ca0ac0e0f1501b645c2efc0de5.tar
drakx-backup-do-not-use-8ef5a525e06308ca0ac0e0f1501b645c2efc0de5.tar.gz
drakx-backup-do-not-use-8ef5a525e06308ca0ac0e0f1501b645c2efc0de5.tar.bz2
drakx-backup-do-not-use-8ef5a525e06308ca0ac0e0f1501b645c2efc0de5.tar.xz
drakx-backup-do-not-use-8ef5a525e06308ca0ac0e0f1501b645c2efc0de5.zip
allow cleaning ask_remove according to removed package.
Diffstat (limited to 'perl-install/pkgs.pm')
-rw-r--r--perl-install/pkgs.pm17
1 files changed, 12 insertions, 5 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index dfb568208..3d4d9d672 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -97,7 +97,7 @@ sub invCorrectSize { ($_[0] - $C) / $B }
sub selectedSize {
my ($packages) = @_;
my $size = 0;
- my %skip;
+ my (%skip_added, %skip_removed);
#- take care of packages selected...
foreach (@{$packages->{depslist}}) {
if ($_->flag_selected) {
@@ -105,14 +105,14 @@ sub selectedSize {
#- if a package is obsoleted with the same name it should
#- have been selected, so a selected new package obsoletes
#- all the old package.
- exists $skip{$_->name} and next; $skip{$_->name} = undef;
+ exists $skip_added{$_->name} and next; $skip_added{$_->name} = undef;
$size -= $packages->{sizes}{$_->name};
}
}
#- but remove size of package being obsoleted or removed.
foreach ((map { /(.*)\.[^\.]*$/ } keys %{$packages->{state}{obsoleted}}), keys %{$packages->{state}{ask_remove}}) {
my ($name) = /(.*)-[^\-]*-[^\-]*$/ or next;
- exists $skip{$name} and next; $skip{$name} = undef;
+ exists $skip_removed{$name} and next; $skip_removed{$name} = undef;
$size -= $packages->{sizes}{$name};
}
$size;
@@ -1089,7 +1089,7 @@ sub install($$$;$$) {
}
sub remove($$) {
- my ($prefix, $toRemove) = @_;
+ my ($prefix, $toRemove, $packages) = @_;
return if $::g_auto_install || !@{$toRemove || []};
@@ -1098,7 +1098,7 @@ sub remove($$) {
foreach my $p (@$toRemove) {
#- stuff remove all packages that matches $p, not a problem since $p has name-version-release format.
- $trans->remove($p) if allowedToUpgrade($p);
+ $trans->remove($p);
}
eval { fs::mount("/proc", "$prefix/proc", "proc", 0) } unless -e "$prefix/proc/cpuinfo";
@@ -1116,6 +1116,13 @@ sub remove($$) {
if (my @probs = $trans->run(undef, force => 1)) {
die "removing of old rpms failed:\n ", join("\n ", @probs);
+ } else {
+ #- clean ask_remove according to package marked to be deleted.
+ if ($packages) {
+ foreach my $p (@$toRemove) {
+ delete $packages->{state}{ask_remove}{$p};
+ }
+ }
}
#- keep in mind removing of these packages by cleaning $toRemove.