diff options
author | Francois Pons <fpons@mandriva.com> | 2001-01-31 17:35:28 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2001-01-31 17:35:28 +0000 |
commit | 54f0345baaecd1bee49c8acb857d5ae0c5845dfc (patch) | |
tree | 36cab672c4b9a345232ebdc409007ef43b7f8dbb /perl-install | |
parent | d2a5b908522cf50eddc1c4fd46caf9e5c2152958 (diff) | |
download | drakx-backup-do-not-use-54f0345baaecd1bee49c8acb857d5ae0c5845dfc.tar drakx-backup-do-not-use-54f0345baaecd1bee49c8acb857d5ae0c5845dfc.tar.gz drakx-backup-do-not-use-54f0345baaecd1bee49c8acb857d5ae0c5845dfc.tar.bz2 drakx-backup-do-not-use-54f0345baaecd1bee49c8acb857d5ae0c5845dfc.tar.xz drakx-backup-do-not-use-54f0345baaecd1bee49c8acb857d5ae0c5845dfc.zip |
added rpmrebuilddb directory cleaning before, remove old rpm file
if everything has been successfull.
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/pkgs.pm | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index dd44bdf4a..da18c0424 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -750,10 +750,20 @@ sub rebuild_db_open_for_traversal { ($? & 0xff00) and die "rebuilding of rpm database failed"; } else { log::l("rebuilding rpm database"); - c::rpmdbRebuild($prefix) and c::_exit(0); - - log::l("rebuilding of rpm database failed: ". c::rpmErrorString()); - c::_exit(2); + my $rebuilddb_dir = "$prefix/var/lib/rpmrebuilddb.$$"; + -d $rebuilddb_dir and log::l("removing stale directory $rebuilddb_dir"), commands::rm("-rf", $rebuilddb_dir); + + c::rpmdbRebuild($prefix) or log::l("rebuilding of rpm database failed: ". c::rpmErrorString()), c::_exit(2); + + #-rebuilding has been successfull, so remove old rpm database if any. + 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; } |