Commit c81b9bf3 authored by Eric Stevenson's avatar Eric Stevenson Committed by Commit Bot

[Supersize] Fix broken BuildReport method.

Broken in
https://chromium-review.googlesource.com/c/chromium/src/+/1232018.

Change-Id: I79982c7e0879af5d2a68d60bbd165164762c6a30
Reviewed-on: https://chromium-review.googlesource.com/1246831Reviewed-by: default avataragrieve <agrieve@chromium.org>
Commit-Queue: Eric Stevenson <estevenson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594703}
parent ed5d9496
...@@ -36,6 +36,8 @@ import os ...@@ -36,6 +36,8 @@ import os
import re import re
import subprocess import subprocess
import archive
import diff
import html_report import html_report
...@@ -109,10 +111,12 @@ def _FetchExistingMilestoneReports(): ...@@ -109,10 +111,12 @@ def _FetchExistingMilestoneReports():
yield report yield report
def _FetchSizeFile(path): def _SizeInfoFromGsPath(path):
if path is None: size_contents = subprocess.check_output(['gsutil.py', 'cat', path])
return None file_obj = cStringIO.StringIO(size_contents)
return cStringIO.StringIO(subprocess.check_output(['gsutil.py', 'cat', path])) ret = archive.LoadAndPostProcessSizeInfo(path, file_obj=file_obj)
file_obj.close()
return ret
def _PossibleReportFiles(): def _PossibleReportFiles():
...@@ -163,18 +167,11 @@ def _BuildReport(paths): ...@@ -163,18 +167,11 @@ def _BuildReport(paths):
if e.errno != errno.EEXIST: if e.errno != errno.EEXIST:
raise raise
before_file = _FetchSizeFile(before_size_path) # May be None. size_info = _SizeInfoFromGsPath(after_size_path)
after_file = _FetchSizeFile(after_size_path) if before_size_path:
with codecs.open(outpath, 'w', encoding='ascii') as out_file: size_info = diff.Diff(_SizeInfoFromGsPath(before_size_path), size_info)
html_report.BuildReport(
out_file, html_report.BuildReportFromSizeInfo(outpath, size_info, all_symbols=True)
size_file=(after_size_path, after_file),
before_size_file=(before_size_path, before_file),
all_symbols=True,
)
if before_file is not None:
before_file.close()
after_file.close()
return outpath return outpath
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment