summaryrefslogtreecommitdiffstats
path: root/Tools/Scripts/update-webkit-auxiliary-libs
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Scripts/update-webkit-auxiliary-libs')
-rwxr-xr-xTools/Scripts/update-webkit-auxiliary-libs99
1 files changed, 2 insertions, 97 deletions
diff --git a/Tools/Scripts/update-webkit-auxiliary-libs b/Tools/Scripts/update-webkit-auxiliary-libs
index 9a6b20f..d301938 100755
--- a/Tools/Scripts/update-webkit-auxiliary-libs
+++ b/Tools/Scripts/update-webkit-auxiliary-libs
@@ -30,106 +30,11 @@
use strict;
use warnings;
-
-use File::Find;
-use File::Spec;
-use File::Temp ();
use FindBin;
-use HTTP::Date qw(str2time);
-use POSIX;
-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";
my $auxiliaryLibsURL = "http://developer.apple.com/opensource/internet/$zipFile";
-my $webkitLibrariesDir = toUnixPath($ENV{'WEBKITLIBRARIESDIR'}) || "$sourceDir/WebKitLibraries/win";
-my $tmpRelativeDir = File::Temp::tempdir("webkitlibsXXXXXXX", TMPDIR => 1, CLEANUP => 1);
-my $tmpAbsDir = File::Spec->rel2abs($tmpRelativeDir);
-
-print "Checking Last-Modified date of $zipFile...\n";
-
-my $result = system "curl -s -I $auxiliaryLibsURL | grep Last-Modified > \"$tmpAbsDir/$file.headers\"";
-
-if (WEXITSTATUS($result)) {
- print STDERR "Couldn't check Last-Modified date of new $zipFile.\n";
- print STDERR "Please ensure that $auxiliaryLibsURL is reachable.\n";
-
- if (! -f "$webkitLibrariesDir/$file.headers") {
- print STDERR "Unable to check Last-Modified date and no version of $file to fall back to.\n";
- exit 1;
- }
-
- print STDERR "Falling back to existing version of $file.\n";
- exit 0;
-}
-
-if (open NEW, "$tmpAbsDir/$file.headers") {
- my $new = lastModifiedToUnixTime(<NEW>);
- close NEW;
-
- if (defined $new && open OLD, "$webkitLibrariesDir/$file.headers") {
- my $old = lastModifiedToUnixTime(<OLD>);
- close OLD;
- if (defined $old && abs($new - $old) < $newnessThreshold) {
- print "Current $file is up to date\n";
- exit 0;
- }
- }
-}
-
-print "Downloading $zipFile...\n\n";
-$result = system "curl -o \"$tmpAbsDir/$zipFile\" $auxiliaryLibsURL";
-die "Couldn't download $zipFile!" if $result;
-
-$result = system "unzip", "-q", "-d", $tmpAbsDir, "$tmpAbsDir/$zipFile";
-die "Couldn't unzip $zipFile." if $result;
-
-print "\nInstalling $file...\n";
-
-sub wanted
-{
- my $relativeName = File::Spec->abs2rel($File::Find::name, "$tmpAbsDir/$file/win");
- my $destination = "$webkitLibrariesDir/$relativeName";
-
- if (-d $_) {
- mkdir $destination;
- return;
- }
-
- system "cp", $_, $destination;
-}
-
-File::Find::find(\&wanted, "$tmpAbsDir/$file");
-
-$result = system "mv", "$tmpAbsDir/$file.headers", $webkitLibrariesDir;
-print STDERR "Couldn't move $file.headers to $webkitLibrariesDir" . ".\n" if $result;
-
-print "The $file has been sucessfully installed in\n $webkitLibrariesDir\n";
-exit;
-
-sub toUnixPath
-{
- my $path = shift;
- return unless $path;
- chomp($path = `cygpath -u '$path'`);
- return $path;
-}
-
-sub lastModifiedToUnixTime($)
-{
- my ($str) = @_;
+my $command = "$FindBin::Bin/update-webkit-dependency";
- $str =~ /^Last-Modified: (.*)$/ or return;
- return str2time($1);
-}
+system("perl", $command, $auxiliaryLibsURL, "win") == 0 or die;