Title: [225361] trunk/Tools
Revision
225361
Author
commit-qu...@webkit.org
Date
2017-11-30 15:39:14 -0800 (Thu, 30 Nov 2017)

Log Message

[WinCairo] Cannot build without Internet connection
https://bugs.webkit.org/show_bug.cgi?id=180068

Patch by Basuke Suzuki <basuke.suz...@sony.com> on 2017-11-30
Reviewed by Alex Christensen

With no Internet connection, if libraries has been downloaded
before, trust that version and keep building.

* Scripts/download-latest-github-release.py:
(Status):
(current_release):
(has_latest_release):
(main):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (225360 => 225361)


--- trunk/Tools/ChangeLog	2017-11-30 23:22:18 UTC (rev 225360)
+++ trunk/Tools/ChangeLog	2017-11-30 23:39:14 UTC (rev 225361)
@@ -1,3 +1,19 @@
+2017-11-30  Basuke Suzuki  <basuke.suz...@sony.com>
+
+        [WinCairo] Cannot build without Internet connection
+        https://bugs.webkit.org/show_bug.cgi?id=180068
+
+        Reviewed by Alex Christensen
+
+        With no Internet connection, if libraries has been downloaded
+        before, trust that version and keep building.
+
+        * Scripts/download-latest-github-release.py:
+        (Status):
+        (current_release):
+        (has_latest_release):
+        (main):
+
 2017-11-30  Alex Christensen  <achristen...@webkit.org>
 
         WKURLSchemeHandler.request should include HTTPBody

Modified: trunk/Tools/Scripts/download-latest-github-release.py (225360 => 225361)


--- trunk/Tools/Scripts/download-latest-github-release.py	2017-11-30 23:22:18 UTC (rev 225360)
+++ trunk/Tools/Scripts/download-latest-github-release.py	2017-11-30 23:39:14 UTC (rev 225361)
@@ -46,6 +46,7 @@
     DOWNLOADED = 0
     UP_TO_DATE = 1
     COULD_NOT_FIND = 2
+    USE_EXISTING_VERSION = 3
 
 
 def parse_args(argv):
@@ -81,14 +82,18 @@
     return None, None
 
 
-def has_latest_release(version_info_path, version_info):
+def existing_version_info(version_info_path):
     if not os.path.exists(version_info_path):
-        return False
+        return None
 
     with open(version_info_path) as file:
-        return json.load(file) == version_info
+        return json.load(file)
 
 
+def has_latest_release(version_info_path, version_info):
+    return existing_version_info(version_info_path) == version_info
+
+
 def download_release(source_url, target_path):
     with open(target_path, 'wb') as file:
         file.write(urllib2.urlopen(source_url).read())
@@ -102,24 +107,36 @@
 def main(argv):
     args = parse_args(argv)
 
+    binary_path = os.path.join(args.output_dir, args.filename)
+    version_info_path = binary_path + '.version'
+
     print 'Seeking latest release of {} from {}...'.format(args.filename, args.repo)
-    release_url, version_info = find_latest_release(args)
 
-    if not release_url:
-        print 'No release found!'
-        return Status.COULD_NOT_FIND
+    try:
+        release_url, version_info = find_latest_release(args)
 
-    binary_path = os.path.join(args.output_dir, args.filename)
-    version_info_path = binary_path + '.version'
+        if not release_url:
+            print 'No release found!'
+            return Status.COULD_NOT_FIND
 
-    if has_latest_release(version_info_path, version_info):
-        print 'Already up-to-date!'
-        return Status.UP_TO_DATE
+        if has_latest_release(version_info_path, version_info):
+            print 'Already up-to-date:', existing_version_info(version_info_path)
+            return Status.UP_TO_DATE
 
+    except urllib2.URLError, error:
+        print error
+
+        version_info = existing_version_info(version_info_path)
+        if version_info:
+            print 'Use existing version:', version_info
+            return Status.USE_EXISTING_VERSION
+        else:
+            return Status.COULD_NOT_FIND
+
     if not os.path.exists(args.output_dir):
         os.makedirs(args.output_dir)
 
-    print 'Downloading to {}...'.format(os.path.abspath(args.output_dir))
+    print 'Downloading {} to {}...'.format(version_info['tag_name'], os.path.abspath(args.output_dir))
     download_release(release_url, binary_path)
     save_version_info(version_info_path, version_info)
     print 'Done!'
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to