Bug 155576 - Improve update-webkit-dependency script
Summary: Improve update-webkit-dependency script
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Local Build
Hardware: PC Windows 10
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-16 19:46 PDT by Jeremy Zerfas
Modified: 2016-03-24 17:59 PDT (History)
4 users (show)

See Also:


Attachments
Patch to improve update-webkit-dependency. (14.91 KB, patch)
2016-03-16 19:49 PDT, Jeremy Zerfas
no flags Details | Formatted Diff | Diff
Patch to improve update-webkit-dependency. (14.93 KB, patch)
2016-03-16 19:55 PDT, Jeremy Zerfas
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Zerfas 2016-03-16 19:46:26 PDT
The update-webkit-dependency script could use several improvements.

First, every time it is ran it tries to download the entire dependency just in order to get the Last-Modified header so that it can check to see if the dependency is up to date. This could be improved by instead doing a request for just the first byte of the dependency if the server supports range requests and also setting a size limit for the request so the entire dependency is not downloaded in order to get the headers. This can save a decent amount of time and bandwidth for people.

Second, it tries to use the Last-Modified header to determine whether the dependency is up to date and if the server doesn't emit Last-Modified headers (like Dropbox's server which is currently used to store the WinCairoRequirements.zip file and also GitHub as well) it then tries to get the Last-Modified header from a separate *.headers file that is also placed on the server. This could be improved by also using ETag headers (which Dropbox and GitHub both support) to see if the dependency is up to date. When using Dropbox this would generally eliminate the need to maintain those separate *.headers file which seems to cause problems from time to time (see https://lists.webkit.org/pipermail/webkit-help/2015-November/003987.html and bug 153876).

Third, it would also be nice if before installing a dependency, it first checked the zip file to make sure it contains the expected directories. This would help in preventing problems like those in bug 153876.

The patch that I'll be attaching in a moment makes these improvements to the script plus makes a few other minor improvements (more error checking and better error messages mainly).
Comment 1 Jeremy Zerfas 2016-03-16 19:49:42 PDT
Created attachment 274258 [details]
Patch to improve update-webkit-dependency.
Comment 2 WebKit Commit Bot 2016-03-16 19:52:16 PDT
Attachment 274258 [details] did not pass style-queue:


ERROR: Tools/ChangeLog:17:  Line contains tab character.  [whitespace/tab] [5]
ERROR: Tools/ChangeLog:1:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
Total errors found: 2 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Jeremy Zerfas 2016-03-16 19:55:36 PDT
Created attachment 274259 [details]
Patch to improve update-webkit-dependency.
Comment 4 Alex Christensen 2016-03-24 10:23:52 PDT
Comment on attachment 274259 [details]
Patch to improve update-webkit-dependency.

This seems ok to me.  Brent, could you double check this?  I'm not sure if this will break the ews bots.
Comment 5 Brent Fulgham 2016-03-24 10:54:13 PDT
Comment on attachment 274259 [details]
Patch to improve update-webkit-dependency.

View in context: https://bugs.webkit.org/attachment.cgi?id=274259&action=review

This looks fine to me. We can roll it out if we encounter problems. r=me.

> Tools/Scripts/update-webkit-dependency:197
> +my $prefixDirectoryPathInZipFile = "$file/".(($prefixInZip eq ".") ? "" : "$prefixInZip/");

The use of the UNIX-style slash here *might* be a problem on Windows, but I'm not sure.
Comment 6 WebKit Commit Bot 2016-03-24 11:42:58 PDT
Comment on attachment 274259 [details]
Patch to improve update-webkit-dependency.

Clearing flags on attachment: 274259

Committed r198638: <http://trac.webkit.org/changeset/198638>
Comment 7 WebKit Commit Bot 2016-03-24 11:43:02 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Jeremy Zerfas 2016-03-24 17:59:22 PDT
(In reply to comment #5)

> > Tools/Scripts/update-webkit-dependency:197
> > +my $prefixDirectoryPathInZipFile = "$file/".(($prefixInZip eq ".") ? "" : "$prefixInZip/");
> 
> The use of the UNIX-style slash here *might* be a problem on Windows, but
> I'm not sure.

I was concerned about that too but it turns out that the documentation for the Archive::Zip module says "Regardless of what your local file system uses for file naming, names in a Zip file are in Unix format (forward slashes (/) separating directory names, etc.)." So the use of the forward slashes should work fine and might even be required.