-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathfilter-build-log.py
More file actions
48 lines (43 loc) · 1.45 KB
/
filter-build-log.py
File metadata and controls
48 lines (43 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#
# filter-build-log.py - Cuts out cruft to focus on build failure details.
#
# This script filters build logs down to only [WARNING] and [ERROR] lines,
# and consolidates lengthy duplicate class listings down to packages only.
import sys
def print_filtered_log(log):
dups = []
parsingdups = False
atbeginning = True
for line in log:
line = line.rstrip('\n')
if line.startswith('[INFO]'):
# Filter out non-error build messages.
continue
if line.startswith('Download') or line.startswith('Progress'):
# Filter out details of remote resource queries.
continue
if atbeginning and not line.strip():
# Filter out leading blank lines.
continue
atbeginning = False
if parsingdups:
if line.startswith(' '):
if line.find('/') >= 0:
# Strip to containing package only.
line = line[:line.rindex('/')]
dups.append(line)
else:
parsingdups = False
for dup in sorted(set(dups)):
print(dup)
print('')
dups = []
else:
if line == ' Duplicate classes:':
print(' Duplicate packages:')
parsingdups = True
else:
print(line)
for arg in sys.argv[1:]:
with open(arg) as f:
print_filtered_log(f)