diff options
Diffstat (limited to 'WebKitTools/Scripts/update-webkit-support-libs')
-rwxr-xr-x | WebKitTools/Scripts/update-webkit-support-libs | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/WebKitTools/Scripts/update-webkit-support-libs b/WebKitTools/Scripts/update-webkit-support-libs index 7065293..fa2afd0 100755 --- a/WebKitTools/Scripts/update-webkit-support-libs +++ b/WebKitTools/Scripts/update-webkit-support-libs @@ -38,43 +38,33 @@ use FindBin; use lib $FindBin::Bin; use webkitdirs; -my $expectedMD5 = "a1341aadbcce1ef26dad2b2895457314"; - my $sourceDir = sourceDir(); my $file = "WebKitSupportLibrary"; my $zipFile = "$file.zip"; my $zipDirectory = toUnixPath($ENV{'WEBKITSUPPORTLIBRARIESZIPDIR'}) || $sourceDir; my $pathToZip = File::Spec->catfile($zipDirectory, $zipFile); my $webkitLibrariesDir = toUnixPath($ENV{'WEBKITLIBRARIESDIR'}) || "$sourceDir/WebKitLibraries/win"; +my $versionFile = $file . "Version"; +my $pathToVersionFile = File::Spec->catfile($webkitLibrariesDir, $versionFile); my $tmpDir = File::Spec->rel2abs(File::Temp::tempdir("webkitlibsXXXXXXX", TMPDIR => 1, CLEANUP => 1)); -# Make sure the file zipfile exists and matches the expected MD5 before doing anything. - --f $pathToZip or dieAndInstructToDownload("$zipFile could not be find in your root source directory."); - -`md5sum "$pathToZip"` =~ /^([0-9a-fA-F]{32}).*/ or die "Error running md5sum on \"$pathToZip\""; -my $actualMD5 = $1; -$actualMD5 eq $expectedMD5 or dieAndInstructToDownload("$zipFile is out of date."); - -print "Checking mod-date of $zipFile...\n"; -open MOD, ">$tmpDir/$file.modified" or die "Couldn't open $tmpDir/$file.modified for writing"; -print MOD (stat $pathToZip)[9] . "\n"; -close MOD; +chomp(my $expectedVersion = `curl -s http://developer.apple.com/opensource/internet/$versionFile`); -if (open NEW, "$tmpDir/$file.modified") { - my $new = <NEW>; - close NEW; - - if (open OLD, "$webkitLibrariesDir/$file.modified") { - my $old = <OLD>; - close OLD; - if ($old eq $new) { - print "Current $file is up to date\n"; - exit 0; - } +# Check whether the extracted library is up-to-date. If it is, we don't have anything to do. +if (open VERSION, "<", $pathToVersionFile) { + chomp(my $extractedVersion = <VERSION>); + close VERSION; + if ($extractedVersion eq $expectedVersion) { + print "$file is up-to-date.\n"; + exit; } } +# Check whether the downloaded library is up-to-date. If it isn't, the user needs to download it. +-f $pathToZip or dieAndInstructToDownload("$zipFile could not be found in $zipDirectory."); +chomp(my $zipFileVersion = `unzip -p "$pathToZip" $file/win/$versionFile`); +dieAndInstructToDownload("$zipFile is out-of-date.") if $zipFileVersion ne $expectedVersion; + my $result = system "unzip", "-q", "-d", $tmpDir, $pathToZip; die "Couldn't unzip $zipFile." if $result; @@ -95,9 +85,6 @@ sub wanted File::Find::find(\&wanted, "$tmpDir/$file"); -$result = system "mv", "$tmpDir/$file.modified", $webkitLibrariesDir; -print STDERR "Couldn't move $file.modified to $webkitLibrariesDir" . ".\n" if $result; - print "The $file has been sucessfully installed in\n $webkitLibrariesDir\n"; exit; |