From 5eaeeea2aae68dd37e728d66e7d1e2458e6e7a33 Mon Sep 17 00:00:00 2001 From: Jeroen van Wolffelaar Date: Tue, 14 Feb 2006 02:13:48 +0000 Subject: [PATCH] Don't redo expensive cross-suite merging merging when not needed --- bin/parse-contents | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/bin/parse-contents b/bin/parse-contents index 341ecd5..550b6ee 100755 --- a/bin/parse-contents +++ b/bin/parse-contents @@ -117,6 +117,15 @@ for my $archive (@archives) { for my $suite (@suites) { or die "Oops"; } + + my $go = 0; + my $suite_mtime = (stat "$DBDIR/reverse_$suite.db")[9]; + for my $file (glob "$DBDIR/reverse_${suite}_*.txt") { + $go = 1 if not defined $suite_mtime + or $suite_mtime < (stat $file)[9]; + } + next unless $go; + print "Merging reverse path lists for ${suite}...\n"; open MERGED, "sort -m $DBDIR/reverse_${suite}_*.txt |" @@ -162,16 +171,4 @@ for my $archive (@archives) { for my $suite (@suites) { rename "$DBDIR/reverse_$suite.db.new", "$DBDIR/reverse_$suite.db"; }} -#print "Writing databases...\n"; - -# FIXME: missing filenames due to optimising above. Need to store filenames -# per-suite/arch, but merge them in the end for better cached searching -#open FILENAMES, "> $DBDIR/filenames.txt.new"; -#for (keys %filenames) { -# print FILENAMES "$_\n"; -#} -#close FILENAMES; - -#rename("$DBDIR/filenames.txt.new", "$DBDIR/filenames.txt"); - # vim: set ts=4 -- 2.39.2