You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/01/12 20:13:33 UTC

mesos git commit: Fixed apply-reviews.py on ASF CI machines.

Repository: mesos
Updated Branches:
  refs/heads/master 6482a4010 -> 8cd5acd3c


Fixed apply-reviews.py on ASF CI machines.

The ASF CI machines for non-Windows builds sometimes contain
version of Python too old to support native SSL requests.
This adds back the logic for using `wget` on non-Windows machines.


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8cd5acd3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8cd5acd3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8cd5acd3

Branch: refs/heads/master
Commit: 8cd5acd3c1d18fb705687ace30165211d087364c
Parents: 6482a40
Author: Joseph Wu <jo...@apache.org>
Authored: Thu Jan 12 12:01:23 2017 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Thu Jan 12 12:01:23 2017 -0800

----------------------------------------------------------------------
 support/apply-reviews.py | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8cd5acd3/support/apply-reviews.py
----------------------------------------------------------------------
diff --git a/support/apply-reviews.py b/support/apply-reviews.py
index b9b978a..c77b4c2 100755
--- a/support/apply-reviews.py
+++ b/support/apply-reviews.py
@@ -147,10 +147,30 @@ def ssl_create_default_context():
 
 def fetch_patch():
   """Fetches a patch from Review Board or GitHub."""
-  r = urllib2.urlopen(patch_url(), context=ssl_create_default_context())
+  if platform.system() == 'Windows':
+    r = urllib2.urlopen(patch_url(), context=ssl_create_default_context())
 
-  with open('%s.patch' % patch_id(), 'w') as patch:
-    patch.write(r.read())
+    with open('%s.patch' % patch_id(), 'w') as patch:
+      patch.write(r.read())
+  else:
+    # NOTE: SSL contexts are only supported in Python 2.7.9+. The version
+    # of Python running on the non-Windows ASF CI machines is sometimes older.
+    # Hence, we fall back to `wget` on non-Windows machines.
+    cmd = ' '.join(['wget',
+                   '--no-check-certificate',
+                   '--no-verbose',
+                   '-O '
+                   '{review_id}.patch',
+                   '{url}'])\
+                   .format(review_id=patch_id(), url=patch_url())
+
+    # In case of github we always need to fetch the patch to extract username
+    # and email, so we ignore the dry_run option by setting the second parameter
+    # to False.
+    if options['github']:
+      shell(cmd, False)
+    else:
+      shell(cmd, options['dry_run'])
 
 
 def patch_id():