-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrpmlint-time-report.py
More file actions
executable file
·29 lines (24 loc) · 965 Bytes
/
rpmlint-time-report.py
File metadata and controls
executable file
·29 lines (24 loc) · 965 Bytes
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
#!/usr/bin/env python3
import sys
from itertools import takewhile
from pathlib import Path
total = []
folder = Path(sys.argv[1])
for path in folder.iterdir():
with path.open() as f:
lines = f.read().splitlines()
for i in range(len(lines)):
line = lines[i]
if line.endswith('Checked files'):
lines = lines[i + 1:]
checks = list(takewhile(lambda x: 'TOTAL' not in x, lines))
for c in checks:
parts = c.split(']')[1].split()
name = parts[0]
duration = float(parts[1])
frac = float(parts[2])
if name not in ('rpm2cpio') and duration > 3:
total.append((name, duration, frac, str(path)))
break
for name, duration, frac, path in sorted(total, key=lambda x: x[1], reverse=True):
print(f'{path:30} {duration:5} {frac:5}% {name:30}')