summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-03-27 12:04:42 +0000
committerFrancois Pons <fpons@mandriva.com>2001-03-27 12:04:42 +0000
commit9efbb4990254cdca79cc84cab1e660824f2d4a0f (patch)
tree5a5bf8dcd56114d7a138d387a228e3101d4e7e40
parent1e495ca482a29b8baeb85f56654a3bd3d108b64a (diff)
downloaddrakx-backup-do-not-use-9efbb4990254cdca79cc84cab1e660824f2d4a0f.tar
drakx-backup-do-not-use-9efbb4990254cdca79cc84cab1e660824f2d4a0f.tar.gz
drakx-backup-do-not-use-9efbb4990254cdca79cc84cab1e660824f2d4a0f.tar.bz2
drakx-backup-do-not-use-9efbb4990254cdca79cc84cab1e660824f2d4a0f.tar.xz
drakx-backup-do-not-use-9efbb4990254cdca79cc84cab1e660824f2d4a0f.zip
fixed too early erasing of old rpmlib db. now postponed at end of install
and only if rpm-4.0 or above has been installed.
-rw-r--r--perl-install/install_steps.pm4
-rw-r--r--perl-install/pkgs.pm37
2 files changed, 25 insertions, 16 deletions
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 95f71a7fe..0c65acf03 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -477,6 +477,10 @@ GridHeight=70
#- move some file after an upgrade that may be seriously annoying.
#- and rename saved files to .mdkgiorig.
if ($o->{isUpgrade}) {
+ my $pkg = pkgs::packageByName($o->{packages}, 'rpm');
+ $pkg && pkgs::packageSelectedOrInstalled($pkg) && pkgs::versionCompare(pkgs::packageVersion($pkg), '4.0') >= 0 and
+ pkgs::clean_old_rpm_db($o->{prefix});
+
log::l("moving previous desktop files that have been updated to Trash of each user");
install_any::kdemove_desktop_file($o->{prefix});
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 3a3bea5bf..e5e17923b 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -825,24 +825,8 @@ sub rebuild_db_open_for_traversal {
my $rebuilddb_dir = "$prefix/var/lib/rpmrebuilddb.$$";
-d $rebuilddb_dir and log::l("removing stale directory $rebuilddb_dir"), commands::rm("-rf", $rebuilddb_dir);
- my $failed;
c::rpmdbRebuild($prefix) or log::l("rebuilding of rpm database failed: ". c::rpmErrorString()), c::_exit(2);
- foreach (qw(Basenames Conflictname Group Name Packages Providename Requirename Triggername)) {
- -s "$prefix/var/lib/rpm/$_" or $failed = 'failed';
- }
- #- rebuilding has been successfull, so remove old rpm database if any.
- #- once we have checked the rpm4 db file are present and not null, in case
- #- of doubt, avoid removing them...
- unless ($failed) {
- log::l("rebuilding rpm database completed successfully");
- foreach (qw(conflictsindex.rpm fileindex.rpm groupindex.rpm nameindex.rpm packages.rpm
- providesindex.rpm requiredby.rpm triggerindex.rpm)) {
- -e "$prefix/var/lib/rpm/$_" or next;
- log::l("removing old rpm file $_");
- commands::rm("-f", "$prefix/var/lib/rpm/$_");
- }
- }
c::_exit(0);
}
$packages->{rebuild_db} = undef;
@@ -854,6 +838,27 @@ sub rebuild_db_open_for_traversal {
$db;
}
+sub clean_old_rpm_db {
+ my ($prefix) = @_;
+ my $failed;
+
+ foreach (qw(Basenames Conflictname Group Name Packages Providename Requirename Triggername)) {
+ -s "$prefix/var/lib/rpm/$_" or $failed = 'failed';
+ }
+ #- rebuilding has been successfull, so remove old rpm database if any.
+ #- once we have checked the rpm4 db file are present and not null, in case
+ #- of doubt, avoid removing them...
+ unless ($failed) {
+ log::l("rebuilding rpm database completed successfully");
+ foreach (qw(conflictsindex.rpm fileindex.rpm groupindex.rpm nameindex.rpm packages.rpm
+ providesindex.rpm requiredby.rpm triggerindex.rpm)) {
+ -e "$prefix/var/lib/rpm/$_" or next;
+ log::l("removing old rpm file $_");
+ commands::rm("-f", "$prefix/var/lib/rpm/$_");
+ }
+ }
+}
+
sub done_db {
log::l("closing install.log file");
close LOG;