diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-11-22 16:15:46 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-11-23 14:44:54 +0000 |
commit | fae3c13eb6ebc1da1e6bc2de3ee024d2bc2e990f (patch) | |
tree | 642cc974a5d3c982137100939b96fff67abd758e /scripts/lib | |
parent | 33a2d0143016bbb4fc87e5a78aab5246d4407c5f (diff) | |
download | poky-fae3c13eb6ebc1da1e6bc2de3ee024d2bc2e990f.tar.gz |
resulttool: Clean up repoducible build logs
We've improved the data stored for reproduicible builds. Teach resulttool how
to apply those cleanups when reprocessing data so we can reduce results file
sizes and make the data easier to process.
(From OE-Core rev: b799c57ae6d61c1b1c7035c8a2c4ba6ee08d1a81)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/resulttool/resultutils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/lib/resulttool/resultutils.py b/scripts/lib/resulttool/resultutils.py index b9b93afaa6..9cba8639a3 100644 --- a/scripts/lib/resulttool/resultutils.py +++ b/scripts/lib/resulttool/resultutils.py | |||
@@ -131,6 +131,27 @@ def strip_logs(results): | |||
131 | del newresults[res]['result']['ptestresult.sections'][i]['log'] | 131 | del newresults[res]['result']['ptestresult.sections'][i]['log'] |
132 | return newresults | 132 | return newresults |
133 | 133 | ||
134 | def handle_cleanups(results): | ||
135 | # Remove pointless path duplication from old format reproducibility results | ||
136 | for res2 in results: | ||
137 | try: | ||
138 | section = results[res2]['result']['reproducible']['files'] | ||
139 | for pkgtype in section: | ||
140 | for filelist in section[pkgtype].copy(): | ||
141 | if section[pkgtype][filelist] and type(section[pkgtype][filelist][0]) == dict: | ||
142 | newlist = [] | ||
143 | for entry in section[pkgtype][filelist]: | ||
144 | newlist.append(entry["reference"].split("/./")[1]) | ||
145 | section[pkgtype][filelist] = newlist | ||
146 | |||
147 | except KeyError: | ||
148 | pass | ||
149 | # Remove pointless duplicate rawlogs data | ||
150 | try: | ||
151 | del results[res2]['result']['reproducible.rawlogs'] | ||
152 | except KeyError: | ||
153 | pass | ||
154 | |||
134 | def decode_log(logdata): | 155 | def decode_log(logdata): |
135 | if isinstance(logdata, str): | 156 | if isinstance(logdata, str): |
136 | return logdata | 157 | return logdata |
@@ -173,6 +194,7 @@ def save_resultsdata(results, destdir, fn="testresults.json", ptestjson=False, p | |||
173 | resultsout = results[res] | 194 | resultsout = results[res] |
174 | if not ptestjson: | 195 | if not ptestjson: |
175 | resultsout = strip_logs(results[res]) | 196 | resultsout = strip_logs(results[res]) |
197 | handle_cleanups(resultsout) | ||
176 | with open(dst, 'w') as f: | 198 | with open(dst, 'w') as f: |
177 | f.write(json.dumps(resultsout, sort_keys=True, indent=1)) | 199 | f.write(json.dumps(resultsout, sort_keys=True, indent=1)) |
178 | for res2 in results[res]: | 200 | for res2 in results[res]: |