From: Frank Lichtenheld Date: Sun, 17 Jan 2010 14:07:08 +0000 (+0100) Subject: Fix some problems with config/database reloading X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=eefec1d45b4122c94629ab55d39d4bdf5f7dec43;p=deb%2Fpackages.git Fix some problems with config/database reloading --- diff --git a/lib/Packages/Config.pm b/lib/Packages/Config.pm index 2ec87ed..a7014f8 100644 --- a/lib/Packages/Config.pm +++ b/lib/Packages/Config.pm @@ -24,7 +24,7 @@ sub init { my ($dir) = @_; my $modtime = (stat( "$dir/config.sh" ))[9] || 0; $config_read_time ||= 0; - if ($modtime >= $config_read_time) { + if ($modtime > $config_read_time) { if (!open (C, '<', "$dir/config.sh")) { error( "Internal: Cannot open configuration file." ); } @@ -50,12 +50,12 @@ sub init { s/\$\{?topdir\}?/$TOPDIR/g; } close (C); + unshift @LANGUAGES, 'en'; + unshift @DDTP_LANGUAGES, 'en'; debug( "read config ($modtime > $config_read_time)" ) if DEBUG; $config_read_time = $modtime; } $DBDIR = "$TOPDIR/files/db"; - unshift @LANGUAGES, 'en'; - unshift @DDTP_LANGUAGES, 'en'; } 1; diff --git a/lib/Packages/DB.pm b/lib/Packages/DB.pm index 1402690..e6d1b3f 100644 --- a/lib/Packages/DB.pm +++ b/lib/Packages/DB.pm @@ -19,31 +19,44 @@ our $db_read_time ||= 0; sub init { my $dbmodtime = (stat("$DBDIR/packages_small.db"))[9] || 0; - if ($dbmodtime >= $db_read_time) { + if ($dbmodtime > $db_read_time) { + undef $obj; + untie %packages; $obj = tie %packages, 'DB_File', "$DBDIR/packages_small.db", O_RDONLY, 0666, $DB_BTREE or die "couldn't tie DB $DBDIR/packages_small.db: $!"; + undef $s_obj; + untie %sources; $s_obj = tie %sources, 'DB_File', "$DBDIR/sources_small.db", O_RDONLY, 0666, $DB_BTREE or die "couldn't tie DB $DBDIR/sources_small.db: $!"; + untie %src2bin; tie %src2bin, 'DB_File', "$DBDIR/sources_packages.db", O_RDONLY, 0666, $DB_BTREE or die "couldn't open $DBDIR/sources_packages.db: $!"; + untie %descriptions; tie %descriptions, 'DB_File', "$DBDIR/descriptions.db", O_RDONLY, 0666, $DB_BTREE or die "couldn't tie DB $DBDIR/descriptions.db: $!"; + untie %desctrans; tie %desctrans, 'DB_File', "$DBDIR/descriptions_translated.db", O_RDONLY, 0666, $DB_BTREE or die "couldn't tie DB $DBDIR/descriptions_translated.db: $!"; + untie %did2pkg; tie %did2pkg, 'DB_File', "$DBDIR/descriptions_packages.db", O_RDONLY, 0666, $DB_BTREE or die "couldn't tie DB $DBDIR/descriptions_packages.db: $!"; + untie %debtags; tie %debtags, 'DB_File', "$TOPDIR/files/debtags/vocabulary.db", O_RDONLY, 0666, $DB_BTREE or die "couldn't tie DB $TOPDIR/files/debtags/vocabulary.db: $!"; + undef $p_obj; + untie %postf; $p_obj = tie %postf, 'DB_File', "$DBDIR/package_postfixes.db", O_RDONLY, 0666, $DB_BTREE or die "couldn't tie postfix db $DBDIR/package_postfixes.db: $!"; + undef $sp_obj; + untie %spostf; $sp_obj = tie %spostf, 'DB_File', "$DBDIR/source_postfixes.db", O_RDONLY, 0666, $DB_BTREE or die "couldn't tie postfix db $DBDIR/source_postfixes.db: $!";