0 | |
#!/usr/bin/python3
|
|
0 |
#!/usr/bin/pypy3
|
|
1 |
# pypy3 runs faster than python3
|
|
2 |
#
|
1 | 3 |
# the excuses file can be found here:
|
2 | 4 |
# https://release.debian.org/britney/excuses.yaml
|
3 | 5 |
|
|
31 | 33 |
|
32 | 34 |
already_seen = set()
|
33 | 35 |
|
34 | |
|
35 | 36 |
def edge_dep(name, dep):
|
36 | 37 |
return " ".join(['"%s"' % name, "->", '"%s"' % dep])
|
37 | 38 |
|
38 | |
|
39 | 39 |
def edge_dep_label(name, dep, label):
|
40 | 40 |
return " ".join(['"%s"' % name, "->", '"%s"' % dep, '[label="%s"]' % label])
|
41 | |
|
42 | 41 |
|
43 | 42 |
def print_all(*args, **kwargs):
|
44 | 43 |
print(*args, **kwargs, file=rust_excuses)
|
45 | 44 |
print(*args, **kwargs, file=rust_excuses_arch)
|
46 | 45 |
|
47 | |
|
48 | 46 |
is_in_debian_cache = {}
|
49 | |
|
50 | |
|
51 | 47 |
def is_in_debian(src):
|
52 | 48 |
global is_in_debian_cache
|
53 | 49 |
if src not in is_in_debian_cache:
|
|
59 | 55 |
x = is_in_debian_cache[src]
|
60 | 56 |
return x
|
61 | 57 |
|
|
58 |
|
|
59 |
BG_NOT_IN_DEBIAN = "#cc0000"
|
|
60 |
BG_OLD_IN_DEBIAN = "#ffcc66"
|
|
61 |
BG_TOO_NEW = "#66ff99"
|
|
62 |
BG_MISC_FAIL = "#ff6666"
|
62 | 63 |
|
63 | 64 |
def traverse(name, arch="", d=0):
|
64 | 65 |
if name in already_seen:
|
|
86 | 87 |
)
|
87 | 88 |
if dep not in already_seen:
|
88 | 89 |
if is_in_debian(dep):
|
89 | |
print_all('"%s" [fillcolor="#ffcc66",style=filled]' % dep)
|
|
90 |
print_all('"%s" [fillcolor="%s",style=filled]' % (dep, BG_OLD_IN_DEBIAN))
|
90 | 91 |
else:
|
91 | |
print_all('"%s" [fillcolor="#ff6666",style=filled]' % dep)
|
|
92 |
print_all('"%s" [fillcolor="%s",style=filled]' % (dep, BG_NOT_IN_DEBIAN))
|
92 | 93 |
for edge in edges:
|
93 | 94 |
print(edge, file=rust_excuses)
|
94 | 95 |
|
|
102 | 103 |
print_all(edge_dep(name, dep))
|
103 | 104 |
traverse(dep, arch, d + 1)
|
104 | 105 |
|
105 | |
if not dependencies:
|
106 | |
age = excuses.get(name, {}).get("policy_info", {}).get("age", {})
|
107 | |
if age.get("verdict", "") == "REJECTED_TEMPORARILY":
|
108 | |
print_all('"%s" [fillcolor="#66ff99",style=filled]' % name)
|
|
106 |
policy = excuses.get(name, {}).get("policy_info", {})
|
|
107 |
failed = [k for (k, v) in policy.items() if v.get("verdict", "") != "PASS"]
|
|
108 |
attrs = {"shape": "box"}
|
|
109 |
if "age" in failed:
|
|
110 |
failed = failed.remove("age")
|
|
111 |
attrs.update({ "fillcolor": BG_TOO_NEW, "style": "filled" })
|
|
112 |
if failed:
|
|
113 |
attrs.update({ "label": "\\N\\nfailed: %s" % ",".join(failed) })
|
|
114 |
attrs.update({ "fillcolor": BG_MISC_FAIL, "style": "filled" })
|
|
115 |
print_all('"%s" [%s]' % (name, ",".join("%s=\"%s\"" % p for p in attrs.items())))
|
109 | 116 |
|
110 | 117 |
|
111 | 118 |
# import code
|