summaryrefslogtreecommitdiffstats
path: root/perl-install/pkgs.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-08-31 10:19:47 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-08-31 10:19:47 +0000
commit4dd916de93d0065ebac5eda0690c23d9fda746a2 (patch)
tree00bf3dee765a8aaa1072e99ac0f4bc227b1ce409 /perl-install/pkgs.pm
parent2619950a37933ea6ec0175d92e7dcdc64fac7114 (diff)
downloaddrakx-4dd916de93d0065ebac5eda0690c23d9fda746a2.tar
drakx-4dd916de93d0065ebac5eda0690c23d9fda746a2.tar.gz
drakx-4dd916de93d0065ebac5eda0690c23d9fda746a2.tar.bz2
drakx-4dd916de93d0065ebac5eda0690c23d9fda746a2.tar.xz
drakx-4dd916de93d0065ebac5eda0690c23d9fda746a2.zip
create remove_marked_ask_remove() and use it
Diffstat (limited to 'perl-install/pkgs.pm')
-rw-r--r--perl-install/pkgs.pm47
1 files changed, 21 insertions, 26 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index ab8f2c313..9f001f9fb 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -1218,42 +1218,37 @@ sub install {
fs::loopback::save_boot($loop_boot);
}
-sub remove {
- my ($toRemove, $packages) = @_;
+sub remove_marked_ask_remove {
+ my ($packages) = @_;
+ my @to_remove = keys %{$packages->{state}{ask_remove}} or return;
+
delete $packages->{rpmdb}; #- make sure rpmdb is closed before.
- return if !@{$toRemove || []};
+ #- we are not checking depends since it should come when
+ #- upgrading a system. although we may remove some functionalities ?
+
+ remove(\@to_remove);
+ delete $packages->{state}{ask_remove}{$_} foreach @to_remove;
+}
+
+sub remove {
+ my ($to_remove) = @_;
+
+ log::l("removing: " . join(' ', @to_remove));
+
my $db = rpmDbOpenForInstall() or die "error opening RPM database: ", URPM::rpmErrorString();
my $trans = $db->create_transaction($::prefix);
- foreach my $p (@$toRemove) {
- #- stuff remove all packages that matches $p, not a problem since $p has name-version-release format.
- $trans->remove($p);
- }
+ #- stuff remove all packages that matches $p, not a problem since $p has name-version-release format.
+ $trans->remove($_) foreach @$to_remove;
- #- we are not checking depends since it should come when
- #- upgrading a system. although we may remove some functionalities ?
+ installCallback($db, user => undef, remove => scalar @$to_remove);
- #- do not modify/translate the message used with installCallback since
- #- these are keys during progressing installation, or change in other
- #- place (install_steps_gtk.pm,...).
- installCallback($db, user => undef, remove => scalar @$toRemove);
-
- 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};
- }
- }
+ if (my @pbs = $trans->run(undef, force => 1)) {
+ die "removing of old rpms failed:\n ", join("\n ", @pbs);
}
-
- #- keep in mind removing of these packages by cleaning $toRemove.
- @{$toRemove || []} = ();
}
sub selected_leaves {