aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-16 19:19:31 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-16 19:19:31 +0000
commit90a17674f16feeea606908264cb75c769c5b4884 (patch)
tree36bc3d0e51ac005238bd78f3895031c297883761
parenta267d41f271521eace90843bd2300af882050aa8 (diff)
make buildbot_globals.py read global_variables.json file from googlesource
BUG=skia:2564 NOTRY=True R=borenet@google.com Author: epoger@google.com Review URL: https://codereview.chromium.org/291563008 git-svn-id: http://skia.googlecode.com/svn/trunk@14770 2bbb7eff-a529-9590-31e7-b0007b416f81
-rwxr-xr-xtools/buildbot_globals.py25
1 files changed, 8 insertions, 17 deletions
diff --git a/tools/buildbot_globals.py b/tools/buildbot_globals.py
index 341cc36291..1dd7819061 100755
--- a/tools/buildbot_globals.py
+++ b/tools/buildbot_globals.py
@@ -12,6 +12,7 @@ Provides read access to buildbot's global_variables.json .
from contextlib import closing
import HTMLParser
+import base64
import json
import re
import svn
@@ -22,8 +23,9 @@ import urllib2
_global_vars = None
-GLOBAL_VARS_JSON_URL = ('http://skia-tree-status.appspot.com/repo-serving/'
- 'buildbot/site_config/global_variables.json')
+_GLOBAL_VARS_JSON_BASE64_URL = (
+ 'https://skia.googlesource.com/buildbot/+/master/'
+ 'site_config/global_variables.json?format=TEXT')
class GlobalVarsRetrievalError(Exception):
@@ -46,21 +48,9 @@ class NoSuchGlobalVariable(KeyError):
pass
-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 the repository.
- """
- with closing(urllib2.urlopen(url)) as f:
- return f.read()
-
-
def Get(var_name):
"""Return the value associated with this name in global_variables.json.
-
+
Args:
var_name: string; the variable to look up.
Returns:
@@ -71,10 +61,11 @@ def Get(var_name):
global _global_vars
if not _global_vars:
try:
- global_vars_text = retrieve_from_mirror(GLOBAL_VARS_JSON_URL)
+ with closing(urllib2.urlopen(_GLOBAL_VARS_JSON_BASE64_URL)) as f:
+ global_vars_text = base64.b64decode(f.read())
except Exception as e:
raise GlobalVarsRetrievalError('Failed to retrieve %s:\n%s' %
- (GLOBAL_VARS_JSON_URL, str(e)))
+ (_GLOBAL_VARS_JSON_BASE64_URL, str(e)))
try:
_global_vars = json.loads(global_vars_text)
except ValueError as e: