From 4be998c4dc3185b80e716c7b44fb30b4c221fcb6 Mon Sep 17 00:00:00 2001 From: Asher Baker Date: Tue, 27 Oct 2015 17:24:03 +0000 Subject: [PATCH 1/2] Include repo information in symbol files. --- tools/buildbot/upload_symbols.py | 48 +++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/tools/buildbot/upload_symbols.py b/tools/buildbot/upload_symbols.py index ad732157..8c5bfb71 100644 --- a/tools/buildbot/upload_symbols.py +++ b/tools/buildbot/upload_symbols.py @@ -32,7 +32,53 @@ with open(symbol_file, 'w') as fp: fp.write(stdout) fp.write(stderr) +lines = out.splitlines() + +paths = set() +roots = {} + +for line in lines: + line = line.strip().split(None, 2) + + if line[0] != 'FILE': + continue + + path = os.path.dirname(line[2]) + + if path in paths: + continue + + paths.add(path) + + root = None + url = None + rev = None + + with open(os.devnull, 'w') as devnull: + try: + root = subprocess.check_output(['git', 'rev-parse', '--show-toplevel'], stderr=devnull, cwd=path, universal_newlines=True).strip() + + if root in roots: + continue + + url = subprocess.check_output(['git', 'ls-remote', '--get-url', 'origin'], stderr=devnull, cwd=path, universal_newlines=True).strip() + rev = subprocess.check_output(['git', 'log', '--pretty=format:%H', '-n', '1'], stderr=devnull, cwd=path, universal_newlines=True).strip() + except (OSError, subprocess.CalledProcessError): + continue + + roots[root] = (url, rev) + +index = 1 +while lines[index].split(None, 1)[0] == 'INFO': + index += 1; + +for root, info in roots.items(): + lines.insert(index, 'INFO REPO ' + ' '.join([root, info[0], info[1]])) + index += 1; + +out = os.linesep.join(lines) + request = urllib.Request(SYMBOL_SERVER, out) request.add_header('Content-Type', 'text/plain') -server_response = urllib.urlopen(request).read().decode('utf8') +server_response = urllib.urlopen(request).read().decode('utf8').strip() print(server_response) From 4d3c89c0652e3b89456773a1277844d5fda89936 Mon Sep 17 00:00:00 2001 From: Asher Baker Date: Wed, 28 Oct 2015 09:47:40 +0000 Subject: [PATCH 2/2] Flip INFO REPO records around for parsing sanity. --- tools/buildbot/upload_symbols.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/buildbot/upload_symbols.py b/tools/buildbot/upload_symbols.py index 8c5bfb71..a9b255be 100644 --- a/tools/buildbot/upload_symbols.py +++ b/tools/buildbot/upload_symbols.py @@ -73,7 +73,7 @@ while lines[index].split(None, 1)[0] == 'INFO': index += 1; for root, info in roots.items(): - lines.insert(index, 'INFO REPO ' + ' '.join([root, info[0], info[1]])) + lines.insert(index, 'INFO REPO ' + ' '.join([info[1], info[0], root])) index += 1; out = os.linesep.join(lines)