Chromium Code Reviews| Index: chrome/test/chromedriver/run_buildbot_steps.py |
| diff --git a/chrome/test/chromedriver/run_buildbot_steps.py b/chrome/test/chromedriver/run_buildbot_steps.py |
| index c471dbcf28d486ece975dc4750cf9a53b149aadf..43ff90371f10bcd73f2d4959787b755fb7eac9e5 100755 |
| --- a/chrome/test/chromedriver/run_buildbot_steps.py |
| +++ b/chrome/test/chromedriver/run_buildbot_steps.py |
| @@ -31,6 +31,10 @@ GS_SERVER_LOGS_URL = GS_CHROMEDRIVER_DATA_BUCKET + '/server_logs' |
| SERVER_LOGS_LINK = ( |
| 'http://chromedriver-data.storage.googleapis.com/server_logs') |
| TEST_LOG_FORMAT = '%s_log.json' |
| +GS_GITHASH_TO_SVN_URL =\ |
| + 'https://chromium.googlesource.com/chromium/src/+/%s?format=json' |
| +GS_SEARCH_PATTERN =\ |
| + r'.*git-svn-id: svn://svn.chromium.org/chrome/trunk/src@(\d+) ' |
| SCRIPT_DIR = os.path.join(_THIS_DIR, os.pardir, os.pardir, os.pardir, os.pardir, |
| os.pardir, os.pardir, os.pardir, 'scripts') |
| @@ -379,15 +383,36 @@ def _CleanTmpDir(): |
| print 'deleting file', file_path |
| os.remove(file_path) |
| +def _GetSVNRevisionFromGitHash(snapshot_revision): |
| + json_url = GS_GITHASH_TO_SVN_URL % snapshot_revision |
| + try: |
| + response = urllib2.urlopen(json_url) |
| + except urllib2.HTTPError, error: |
| + print 'HTTP Error %d' % error.getcode() |
|
stgao
2014/06/20 22:58:17
Please use util.PrintAndFlush instead of print.
pshenoy
2014/06/20 23:04:08
Done.
|
| + return None |
| + data = json.loads(response.read()[4:]) |
| + if 'message' in data: |
| + message = data['message'].split('\n') |
| + message = [line for line in message if line.strip()] |
| + search_pattern = re.compile(GS_SEARCH_PATTERN) |
| + result = search_pattern.search(message[len(message)-1]) |
| + if result: |
| + return result.group(1) |
| + return None |
| def _WaitForLatestSnapshot(revision): |
| util.MarkBuildStepStart('wait_for_snapshot') |
| while True: |
| snapshot_revision = archive.GetLatestSnapshotVersion() |
| - if int(snapshot_revision) >= int(revision): |
| - break |
| - util.PrintAndFlush('Waiting for snapshot >= %s, found %s' % |
| - (revision, snapshot_revision)) |
| + if not revision.isdigit(): |
| + revision = _GetSVNRevisionFromGitHash(revision) |
| + if not snapshot_revision.isdigit(): |
| + snapshot_revision = _GetSVNRevisionFromGitHash(snapshot_revision) |
| + if revision is not None and snapshot_revision is not None: |
| + if int(snapshot_revision) >= int(revision): |
| + break |
| + util.PrintAndFlush('Waiting for snapshot >= %s, found %s' % |
| + (revision, snapshot_revision)) |
| time.sleep(60) |
| util.PrintAndFlush('Got snapshot revision %s' % snapshot_revision) |