<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[181977] trunk/Tools</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181977">181977</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2015-03-25 15:46:41 -0700 (Wed, 25 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Migrate update-webkit for Windows to not require Cygwin
https://bugs.webkit.org/show_bug.cgi?id=143040

Reviewed by Brent Fulgham.

* Scripts/update-webkit-dependency:
(wanted):
(toUnixPath): Deleted.
* Scripts/webkitdirs.pm:
(fontExists):
(checkInstalledTools):
(setupAppleWinEnv):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsupdatewebkitdependency">trunk/Tools/Scripts/update-webkit-dependency</a></li>
<li><a href="#trunkToolsScriptswebkitdirspm">trunk/Tools/Scripts/webkitdirs.pm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (181976 => 181977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-03-25 22:42:39 UTC (rev 181976)
+++ trunk/Tools/ChangeLog        2015-03-25 22:46:41 UTC (rev 181977)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-03-25  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Migrate update-webkit for Windows to not require Cygwin
+        https://bugs.webkit.org/show_bug.cgi?id=143040
+
+        Reviewed by Brent Fulgham.
+
+        * Scripts/update-webkit-dependency:
+        (wanted):
+        (toUnixPath): Deleted.
+        * Scripts/webkitdirs.pm:
+        (fontExists):
+        (checkInstalledTools):
+        (setupAppleWinEnv):
+
</ins><span class="cx"> 2015-03-25  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [Content Extensions] Convert content extension compiling to return error codes and write its output using a client
</span></span></pre></div>
<a id="trunkToolsScriptsupdatewebkitdependency"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/update-webkit-dependency (181976 => 181977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/update-webkit-dependency        2015-03-25 22:42:39 UTC (rev 181976)
+++ trunk/Tools/Scripts/update-webkit-dependency        2015-03-25 22:46:41 UTC (rev 181977)
</span><span class="lines">@@ -32,11 +32,14 @@
</span><span class="cx"> use strict;
</span><span class="cx"> use warnings;
</span><span class="cx"> 
</span><ins>+use Archive::Zip qw( :ERROR_CODES );
+use File::Copy;
</ins><span class="cx"> use File::Find;
</span><span class="cx"> use File::Spec;
</span><span class="cx"> use File::Temp ();
</span><span class="cx"> use FindBin;
</span><del>-use HTTP::Date qw(str2time);
</del><ins>+use HTTP::Date qw(str2time time2str);
+use LWP::Simple;
</ins><span class="cx"> use POSIX;
</span><span class="cx"> use lib $FindBin::Bin;
</span><span class="cx"> use webkitdirs;
</span><span class="lines">@@ -67,26 +70,33 @@
</span><span class="cx"> my $sourceDir = sourceDir();
</span><span class="cx"> my $file = getLibraryName($libsURL);
</span><span class="cx"> my $zipFile = &quot;$file.zip&quot;; 
</span><del>-my $webkitLibrariesDir = toUnixPath($ENV{'WEBKIT_LIBRARIES'}) || &quot;$sourceDir/WebKitLibraries/win&quot;;
</del><ins>+my $webkitLibrariesDir = $ENV{'WEBKIT_LIBRARIES'} || &quot;$sourceDir/WebKitLibraries/win&quot;;
</ins><span class="cx"> my $tmpRelativeDir = File::Temp::tempdir(&quot;webkitlibsXXXXXXX&quot;, TMPDIR =&gt; 1, CLEANUP =&gt; 1);
</span><span class="cx"> my $tmpAbsDir = File::Spec-&gt;rel2abs($tmpRelativeDir);
</span><span class="cx"> 
</span><span class="cx"> print &quot;Checking Last-Modified date of $zipFile...\n&quot;;
</span><span class="cx"> 
</span><del>-my $result = system &quot;curl -s -I -k $libsURL | grep Last-Modified &gt; \&quot;$tmpAbsDir/$file.headers\&quot;&quot;;
</del><ins>+my ($content_type, $document_length, $modified_time, $expires, $server) = head($libsURL);
</ins><span class="cx"> 
</span><del>-if (WEXITSTATUS($result)) {
</del><ins>+if (defined $modified_time) {
</ins><span class="cx"> 
</span><ins>+    open NEW, &quot;&gt;&quot;, &quot;$tmpAbsDir/$file.headers&quot;;
+    print NEW &quot;Last-Modified: &quot; . time2str($modified_time) . &quot;\n&quot;;
+    close NEW;
+
+} else {
+
</ins><span class="cx">     #Note: Neither GitHub nor DropBox emit the Last-Modified HTTP header, so fall back to a file
</span><span class="cx">         #containing the necessary information if we do not receive the information in our initial query.
</span><span class="cx">     my $headerURL = $libsURL;
</span><span class="cx">     $headerURL =~ s/\.zip$/\.headers/;
</span><span class="cx"> 
</span><del>-    $result = system &quot;curl -k -o \&quot;$tmpAbsDir/$file.headers\&quot; $headerURL&quot;;
</del><ins>+    my $result = getstore($headerURL, &quot;$tmpAbsDir/$file.headers&quot;);
</ins><span class="cx"> 
</span><del>-    if (WEXITSTATUS($result)) {
</del><ins>+    if (!is_success($result)) {
</ins><span class="cx">         print STDERR &quot;Couldn't check Last-Modified date of new $zipFile.\n&quot;;
</span><del>-        print STDERR &quot;Please ensure that $libsURL is reachable.\n&quot;;
</del><ins>+        print STDERR &quot;Please ensure that Perl can use LWP::Simple to connect to HTTPS urls, and that $libsURL is reachable.\n&quot;;
+        print STDERR &quot;You may have to run $ cpan LWP::Protocol::https\n&quot;;
</ins><span class="cx"> 
</span><span class="cx">         if (! -f &quot;$webkitLibrariesDir/$file.headers&quot;) {
</span><span class="cx">             print STDERR &quot;Unable to check Last-Modified date and no version of $file to fall back to.\n&quot;;
</span><span class="lines">@@ -113,11 +123,13 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> print &quot;Downloading $zipFile...\n\n&quot;;
</span><del>-$result = system &quot;curl -k -o \&quot;$tmpAbsDir/$zipFile\&quot; $libsURL&quot;;
-die &quot;Couldn't download $zipFile!&quot; if $result;
</del><ins>+print &quot;$libsURL\n&quot;;
+my $result = getstore($libsURL, &quot;$tmpAbsDir/$zipFile&quot;);
+die &quot;Couldn't download $zipFile!&quot; if is_error($result);
</ins><span class="cx"> 
</span><del>-$result = system &quot;unzip&quot;, &quot;-q&quot;, &quot;-d&quot;, $tmpAbsDir, &quot;$tmpAbsDir/$zipFile&quot;;
-die &quot;Couldn't unzip $zipFile.&quot; if $result;
</del><ins>+my $zip = Archive::Zip-&gt;new(&quot;$tmpAbsDir/$zipFile&quot;);
+$result = $zip-&gt;extractTree(&quot;&quot;, $tmpAbsDir);
+die &quot;Couldn't unzip $zipFile.&quot; if $result != AZ_OK;
</ins><span class="cx"> 
</span><span class="cx"> print &quot;\nInstalling $file...\n&quot;;
</span><span class="cx"> 
</span><span class="lines">@@ -131,25 +143,17 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    system &quot;cp&quot;, $_, $destination;
</del><ins>+    copy($_, $destination);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> File::Find::find(\&amp;wanted, &quot;$tmpAbsDir/$file&quot;);
</span><span class="cx"> 
</span><del>-$result = system &quot;mv&quot;, &quot;$tmpAbsDir/$file.headers&quot;, $webkitLibrariesDir;
-print STDERR &quot;Couldn't move $file.headers to $webkitLibrariesDir&quot; . &quot;.\n&quot; if $result;
</del><ins>+$result = move(&quot;$tmpAbsDir/$file.headers&quot;, $webkitLibrariesDir);
+print STDERR &quot;Couldn't move $file.headers to $webkitLibrariesDir&quot; . &quot;.\n&quot; if $result == 0;
</ins><span class="cx"> 
</span><span class="cx"> print &quot;The $file has been sucessfully installed in\n $webkitLibrariesDir\n&quot;;
</span><span class="cx"> exit;
</span><span class="cx"> 
</span><del>-sub toUnixPath
-{
-    my $path = shift;
-    return unless $path;
-    chomp($path = `cygpath -u '$path'`);
-    return $path;
-}
-
</del><span class="cx"> sub lastModifiedToUnixTime($)
</span><span class="cx"> {
</span><span class="cx">     my ($str) = @_;
</span></span></pre></div>
<a id="trunkToolsScriptswebkitdirspm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitdirs.pm (181976 => 181977)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitdirs.pm        2015-03-25 22:42:39 UTC (rev 181976)
+++ trunk/Tools/Scripts/webkitdirs.pm        2015-03-25 22:46:41 UTC (rev 181977)
</span><span class="lines">@@ -1449,15 +1449,16 @@
</span><span class="cx"> sub fontExists($)
</span><span class="cx"> {
</span><span class="cx">     my $font = shift;
</span><del>-    my $val = system qw(regtool get), '\\HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts\\' . $font . ' (TrueType)';
-    return 0 == $val;
</del><ins>+    my $cmd = &quot;reg query \&quot;HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts\\&quot; . $font .&quot;\&quot; 2&gt;&amp;1&quot;;
+    my $val = `$cmd`;
+    return $? == 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub checkInstalledTools()
</span><span class="cx"> {
</span><span class="cx">     # SVN 1.7.10 is known to be compatible with current servers. SVN 1.8.x seems to be missing some authentication
</span><span class="cx">     # protocols we use for svn.webkit.org:
</span><del>-    my $svnVersion = `svn --version | grep &quot;\\sversion&quot;`;
</del><ins>+    my $svnVersion = `svn --version 2&gt; NUL | grep &quot;\\sversion&quot;`;
</ins><span class="cx">     chomp($svnVersion);
</span><span class="cx">     if (!$? and $svnVersion =~ /1\.8\./) {
</span><span class="cx">         print &quot;svn 1.7.10 is known to be compatible with our servers. You are running $svnVersion,\nwhich may not work properly.\n&quot;
</span><span class="lines">@@ -1468,7 +1469,7 @@
</span><span class="cx">     die &quot;You must have Python installed to build WebKit.\n&quot; if ($?);
</span><span class="cx"> 
</span><span class="cx">     # cURL 7.34.0 has a bug that prevents authentication with opensource.apple.com (and other things using SSL3).
</span><del>-    my $curlVer = `curl --version | grep &quot;curl&quot;`;
</del><ins>+    my $curlVer = `curl --version 2&gt; NUL | grep &quot;curl&quot;`;
</ins><span class="cx">     chomp($curlVer);
</span><span class="cx">     if (!$? and $curlVer =~ /libcurl\/7\.34\.0/) {
</span><span class="cx">         print &quot;cURL version 7.34.0 has a bug that prevents authentication with SSL v2 or v3.\n&quot;;
</span><span class="lines">@@ -1525,7 +1526,10 @@
</span><span class="cx"> 
</span><span class="cx">         foreach my $variable (keys %variablesToSet) {
</span><span class="cx">             print &quot;Setting the Environment Variable '&quot; . $variable . &quot;' to '&quot; . $variablesToSet{$variable} . &quot;'\n\n&quot;;
</span><del>-            system qw(regtool -s set), '\\HKEY_CURRENT_USER\\Environment\\' . $variable, $variablesToSet{$variable};
</del><ins>+            my $ret = system &quot;setx&quot;, $variable, $variablesToSet{$variable};
+            if ($ret != 0) {
+                system qw(regtool -s set), '\\HKEY_CURRENT_USER\\Environment\\' . $variable, $variablesToSet{$variable};
+            }
</ins><span class="cx">             $restartNeeded ||=  $variable eq &quot;WEBKIT_LIBRARIES&quot; || $variable eq &quot;WEBKIT_OUTPUTDIR&quot;;
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>