diff options
Diffstat (limited to 'perl-install/install/pkgs.pm')
-rw-r--r-- | perl-install/install/pkgs.pm | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/perl-install/install/pkgs.pm b/perl-install/install/pkgs.pm index 9bb967b47..21c3c3ff1 100644 --- a/perl-install/install/pkgs.pm +++ b/perl-install/install/pkgs.pm @@ -614,6 +614,27 @@ sub _openInstallLog() { $LOG; } +sub _rebuild_RPM_DB() { + if (my $pid = fork()) { + waitpid $pid, 0; + $? & 0xff00 and die "rebuilding of rpm database failed"; + } else { + log::l("rebuilding rpm database"); + my $rebuilddb_dir = "$::prefix/var/lib/rpmrebuilddb.$$"; + if (-d $rebuilddb_dir) { + log::l("removing stale directory $rebuilddb_dir"); + rm_rf($rebuilddb_dir); + } + + if (!URPM::DB::rebuild($::prefix)) { + log::l("rebuilding of rpm database failed: " . URPM::rpmErrorString()); + c::_exit(2); + } + + c::_exit(0); + } +} + sub rpmDbOpen { my ($b_rebuild_if_needed) = @_; @@ -621,26 +642,7 @@ sub rpmDbOpen { my $need_rebuild = $b_rebuild_if_needed && !URPM::DB::verify($::prefix); - if ($need_rebuild) { - if (my $pid = fork()) { - waitpid $pid, 0; - $? & 0xff00 and die "rebuilding of rpm database failed"; - } else { - log::l("rebuilding rpm database"); - my $rebuilddb_dir = "$::prefix/var/lib/rpmrebuilddb.$$"; - if (-d $rebuilddb_dir) { - log::l("removing stale directory $rebuilddb_dir"); - rm_rf($rebuilddb_dir); - } - - if (!URPM::DB::rebuild($::prefix)) { - log::l("rebuilding of rpm database failed: " . URPM::rpmErrorString()); - c::_exit(2); - } - - c::_exit(0); - } - } + _rebuild_RPM_DB() if $need_rebuild; my $db; if ($db = URPM::DB::open($::prefix)) { |