Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: tools/buildbot_globals.py

Issue 254013003: Fix buildbot_globals.py: Retrieve the file from our repo mirror (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/buildbot_globals.py
diff --git a/tools/buildbot_globals.py b/tools/buildbot_globals.py
index c3d370308edb7613072a0239976fe698befa7fee..341cc362913f269ddcb785d1eba5c854d82cc325 100755
--- a/tools/buildbot_globals.py
+++ b/tools/buildbot_globals.py
@@ -22,8 +22,8 @@ import urllib2
_global_vars = None
-GLOBAL_VARS_JSON_URL = ('https://skia.googlesource.com/buildbot/+'
- '/master/site_config/global_variables.json')
+GLOBAL_VARS_JSON_URL = ('http://skia-tree-status.appspot.com/repo-serving/'
+ 'buildbot/site_config/global_variables.json')
class GlobalVarsRetrievalError(Exception):
@@ -46,29 +46,16 @@ class NoSuchGlobalVariable(KeyError):
pass
-def retrieve_from_googlesource(url):
- """Retrieve the given file from GoogleSource's HTTP interface, trimming the
- extraneous HTML. Intended to be a GoogleSource equivalent of "svn cat".
-
- This just returns the unescaped contents of the first <pre> tag which matches
- our expectations for GoogleSource's HTTP interface. If that interface changes,
- this function will almost surely break.
+def retrieve_from_mirror(url):
+ """Retrieve the given file from the Skia Buildbot repo mirror.
Args:
url: string; the URL of the file to retrieve.
Returns:
- The contents of the file in GoogleSource, stripped of the extra HTML from
- the HTML interface.
+ The contents of the file in the repository.
"""
with closing(urllib2.urlopen(url)) as f:
- contents = f.read()
- pre_open = '<pre class="git-blob prettyprint linenums lang-(\w+)">'
- pre_close = '</pre>'
- matched_tag = re.search(pre_open, contents).group()
- start_index = contents.find(matched_tag)
- end_index = contents.find(pre_close)
- parser = HTMLParser.HTMLParser()
- return parser.unescape(contents[start_index + len(matched_tag):end_index])
+ return f.read()
def Get(var_name):
@@ -84,10 +71,10 @@ def Get(var_name):
global _global_vars
if not _global_vars:
try:
- global_vars_text = retrieve_from_googlesource(GLOBAL_VARS_JSON_URL)
- except Exception:
- raise GlobalVarsRetrievalError('Failed to retrieve %s.' %
- GLOBAL_VARS_JSON_URL)
+ global_vars_text = retrieve_from_mirror(GLOBAL_VARS_JSON_URL)
+ except Exception as e:
+ raise GlobalVarsRetrievalError('Failed to retrieve %s:\n%s' %
+ (GLOBAL_VARS_JSON_URL, str(e)))
try:
_global_vars = json.loads(global_vars_text)
except ValueError as e:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698