From: Don Armstrong Date: Fri, 5 Dec 2008 00:31:36 +0000 (-0800) Subject: * Only replace indices if changes have been made to the index X-Git-Tag: release/2.6.0~466^2~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=73ab791939b6efeffa50c8718ee9f68570ba5c77;p=debbugs.git * Only replace indices if changes have been made to the index --- diff --git a/scripts/gen-indices b/scripts/gen-indices index ca115465..0e34ce80 100755 --- a/scripts/gen-indices +++ b/scripts/gen-indices @@ -174,6 +174,7 @@ sub emailfromrfc822 { return $email; } +my $modification_made = 0; my $cnt = 0; my @dirs = ($initialdir); @@ -196,6 +197,7 @@ while (my $dir = shift @dirs) { } next if $stat->mtime < $time; my $fdata = readbug($bug, $initialdir); + $modification_made = 1; addbugtoindex("package", $bug, split /[\s,]+/, $fdata->{"package"}); addbugtoindex("tag", $bug, split /[\s,]+/, $fdata->{"keywords"}); addbugtoindex('submitter-email', $bug, @@ -232,12 +234,17 @@ if (not $options{quick}) { } } - for my $i (@indexes) { - untie %{$slow_index{$i}}; + untie %{$slow_index{$i}}; + # Only move if we've made changes, otherwise unlink + if ($modification_made) { move("$indexdest/by-$i$suffix.idx.new", "$indexdest/by-$i$suffix.idx"); # We do this, because old versions of touch don't support -d '@epoch' system('touch','-d',"1/1/1970 UTC + ${start_time}secs","$indexdest/by-$i$suffix.idx"); + } + else { + unlink("$indexdest/by-$i$suffix.idx.new"); + } } unlink($config{spool_dir}.'/lock/gen-indices')