+2008-01-03 Adam Roben <aroben@apple.com>
+
+ Fix Bug 15663: update-webkit re-downloads WebKitAuxiliaryLibrary unnecessarily
+
+ http://bugs.webkit.org/show_bug.cgi?id=15663
+
+ Added a fuzz factor into the Last-Modified comparison for downloading
+ WebKitAuxiliaryLibrary.zip.
+
+ The zip file is served from a set of mirrors who give Last-Modified
+ times that are off by 1-3 seconds from each other. This was causing
+ the build bots to redownload WebKitAuxiliaryLibrary for every build,
+ which would then cause all of WebCore to rebuild each time.
+
+ Reviewed by Mark.
+
+ * Scripts/update-webkit-auxiliary-libs: Check if the new zip file is
+ at least 30 seconds newer than the old one -- otherwise we assume that
+ the difference in time is due to the mirrors being slightly offset
+ from each other.
+ (sub lastModifiedToUnixTime): Added.
+
2008-01-03 Alexey Proskuryakov <ap@webkit.org>
Windows build fix.
use strict;
use warnings;
+use Date::Parse qw(str2time);
use File::Find;
use File::Temp;
use File::Spec;
use lib $FindBin::Bin;
use webkitdirs;
+sub lastModifiedToUnixTime($);
+
+# Time in seconds that the new zip file must be newer than the old for us to
+# consider them to be different. If the difference in modification time is less
+# than this threshold, we assume that the files are the same. We need this
+# because the zip file is served from a set of mirrors with slightly different
+# Last-Modified times.
+my $newnessThreshold = 30;
+
my $sourceDir = sourceDir();
my $file = "WebKitAuxiliaryLibrary";
my $zipFile = "$file.zip";
print STDERR "Couldn't check Last-Modified date of new $zipFile.\n" if $result;
if (!$result && open NEW, "$tmpDir/$file.headers") {
- my $new = <NEW>;
+ my $new = lastModifiedToUnixTime(<NEW>);
close NEW;
- if (open OLD, "$webkitLibrariesDir/$file.headers") {
- my $old = <OLD>;
+ if (defined $new && open OLD, "$webkitLibrariesDir/$file.headers") {
+ my $old = lastModifiedToUnixTime(<OLD>);
close OLD;
- if ($old eq $new) {
+ if (defined $old && abs($new - $old) < $newnessThreshold) {
print "Current $file is up to date\n";
exit 0;
}
chomp($path = `cygpath -u '$path'`);
return $path;
}
+
+sub lastModifiedToUnixTime($)
+{
+ my ($str) = @_;
+
+ $str =~ /^Last-Modified: (.*)$/ or return;
+ return str2time($1);
+}