summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-11-16 17:13:36 +0000
committerThierry Vignaud <tv@mageia.org>2012-11-16 17:13:36 +0000
commit9cd10d1bda5bc1a1d309559c7f7354d624bf2080 (patch)
treec794171f92860d8fdc04709e244f824462332989 /perl-install
parent4cbaa32bc492ce40e144c1950446e75fd92b46e1 (diff)
downloaddrakx-9cd10d1bda5bc1a1d309559c7f7354d624bf2080.tar
drakx-9cd10d1bda5bc1a1d309559c7f7354d624bf2080.tar.gz
drakx-9cd10d1bda5bc1a1d309559c7f7354d624bf2080.tar.bz2
drakx-9cd10d1bda5bc1a1d309559c7f7354d624bf2080.tar.xz
drakx-9cd10d1bda5bc1a1d309559c7f7354d624bf2080.zip
(_rebuild_RPM_DB) extract it out of rpmDbOpen()
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/install/pkgs.pm42
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)) {