-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathobs-package-build-stats.py
More file actions
executable file
·31 lines (24 loc) · 1.01 KB
/
obs-package-build-stats.py
File metadata and controls
executable file
·31 lines (24 loc) · 1.01 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
#!/usr/bin/env python3
import concurrent.futures
import subprocess
import xml.etree.ElementTree as ET
PROJECT = 'openSUSE:Factory'
THRESHOLD = 1000
out = subprocess.check_output(f'osc ls {PROJECT}', shell=True, encoding='utf8').strip()
packages = out.splitlines()
python_packages = [p for p in packages if 'python' in p]
def get_time(pkg):
data = subprocess.check_output(f'osc api /build/{PROJECT}/standard/x86_64/{pkg}/_statistics',
shell=True, encoding='utf8', stderr=subprocess.DEVNULL)
xml = ET.fromstring(data)
return int(xml.find('*/total/time').text)
with concurrent.futures.ThreadPoolExecutor() as executor:
futures = {executor.submit(get_time, x): x for x in python_packages}
for future in concurrent.futures.as_completed(futures):
if future.exception():
print(f'.. skipping {futures[future]}')
else:
time = future.result()
pkg = futures[future]
if time >= THRESHOLD:
print(pkg, time)