summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--perl-install/install_steps.pm5
-rw-r--r--perl-install/pkgs.pm47
2 files changed, 22 insertions, 30 deletions
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 0afb51383..3bb6d8644 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -436,10 +436,7 @@ sub installPackages { #- complete REWORK, TODO and TOCHECK!
my ($o) = @_;
my $packages = $o->{packages};
- if (%{$packages->{state}{ask_remove} || {}}) {
- log::l("removing : ", join ', ', keys %{$packages->{state}{ask_remove}});
- pkgs::remove([ keys %{$packages->{state}{ask_remove}} ], $packages);
- }
+ pkgs::remove_marked_ask_remove($packages);
#- small transaction will be built based on this selection and depslist.
my @toInstall = pkgs::packagesToInstall($packages);
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 {