Skip to content

Commit 281fbff

Browse files
committed
fixup! ci: Split up generated files by tree and toolchain version
Signed-off-by: Nathan Chancellor <[email protected]>
1 parent 866b6fe commit 281fbff

File tree

2 files changed

+87
-83
lines changed

2 files changed

+87
-83
lines changed

generate_tuxsuite.py

Lines changed: 75 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -26,80 +26,81 @@ def parse_args(trees):
2626
def emit_tuxsuite_yml(config, tree, llvm_version):
2727
toolchain = "clang-{}".format(llvm_version)
2828
tuxsuite_yml = "tuxsuite/{}-{}.tux.yml".format(tree, toolchain)
29-
orig_stdout = sys.stdout
30-
f = open(tuxsuite_yml, "w")
31-
sys.stdout = f
32-
33-
print("# DO NOT MODIFY MANUALLY!")
34-
print("# This file has been autogenerated by invoking:")
35-
print("# $ ./generate_tuxsuite.py {}".format(tree))
36-
print("# Invoke tuxsuite via:")
37-
print(
38-
"# $ tuxsuite build-set --set-name defconfigs --json-out builds.json --tux-config {}{}"
39-
.format(tuxsuite_yml, patch_series_flag(tree)))
40-
41-
tuxsuite_buildset = {
42-
'sets': [
43-
{
44-
'name': 'defconfigs',
45-
'builds': [],
46-
}
47-
]
48-
} # yapf: disable
49-
repo, ref = get_repo_ref(config, tree)
50-
ci_folder = pathlib.Path(__file__).resolve().parent
51-
with open(ci_folder.joinpath("LLVM_TOT_VERSION")) as f:
52-
max_version = int(f.read())
53-
defconfigs = []
54-
distribution_configs = []
55-
allconfigs = []
56-
for build in config["builds"]:
57-
if build["git_repo"] == repo and \
58-
build["git_ref"] == ref and \
59-
build["llvm_version"] == llvm_version:
60-
arch = build["ARCH"] if "ARCH" in build else "x86_64"
61-
if llvm_version == max_version:
62-
toolchain = "clang-nightly"
63-
64-
current_build = {
65-
"git_repo": build["git_repo"],
66-
"git_ref": build["git_ref"],
67-
"target_arch": arch,
68-
"toolchain": toolchain,
69-
"kconfig": build["config"],
70-
"targets": build["targets"]
71-
}
72-
if "kernel_image" in build:
73-
current_build.update({"kernel_image": build["kernel_image"]})
74-
if "make_variables" in build:
75-
current_build.update(
76-
{"make_variables": build["make_variables"]})
77-
78-
if "defconfig" in str(build["config"]):
79-
defconfigs.append(current_build)
80-
elif "https://" in str(build["config"]):
81-
distribution_configs.append(current_build)
82-
else:
83-
allconfigs.append(current_build)
84-
85-
tuxsuite_buildset["sets"][0]["builds"] = defconfigs
86-
if distribution_configs:
87-
tuxsuite_buildset["sets"] += [{
88-
"name": "distribution_configs",
89-
"builds": distribution_configs
90-
}]
91-
if allconfigs:
92-
tuxsuite_buildset["sets"] += [{
93-
"name": "allconfigs",
94-
"builds": allconfigs
95-
}]
96-
print(
97-
yaml.dump(tuxsuite_buildset,
98-
Dumper=NoAliasDumper,
99-
width=1000,
100-
sort_keys=False))
101-
sys.stdout = orig_stdout
102-
f.close()
29+
30+
with open(tuxsuite_yml, "w") as f:
31+
orig_stdout = sys.stdout
32+
sys.stdout = f
33+
34+
print("# DO NOT MODIFY MANUALLY!")
35+
print("# This file has been autogenerated by invoking:")
36+
print("# $ ./generate_tuxsuite.py {}".format(tree))
37+
print("# Invoke tuxsuite via:")
38+
print(
39+
"# $ tuxsuite build-set --set-name defconfigs --json-out builds.json --tux-config {}{}"
40+
.format(tuxsuite_yml, patch_series_flag(tree)))
41+
42+
tuxsuite_buildset = {
43+
'sets': [
44+
{
45+
'name': 'defconfigs',
46+
'builds': [],
47+
}
48+
]
49+
} # yapf: disable
50+
repo, ref = get_repo_ref(config, tree)
51+
ci_folder = pathlib.Path(__file__).resolve().parent
52+
with open(ci_folder.joinpath("LLVM_TOT_VERSION")) as f:
53+
max_version = int(f.read())
54+
defconfigs = []
55+
distribution_configs = []
56+
allconfigs = []
57+
for build in config["builds"]:
58+
if build["git_repo"] == repo and \
59+
build["git_ref"] == ref and \
60+
build["llvm_version"] == llvm_version:
61+
arch = build["ARCH"] if "ARCH" in build else "x86_64"
62+
if llvm_version == max_version:
63+
toolchain = "clang-nightly"
64+
65+
current_build = {
66+
"git_repo": build["git_repo"],
67+
"git_ref": build["git_ref"],
68+
"target_arch": arch,
69+
"toolchain": toolchain,
70+
"kconfig": build["config"],
71+
"targets": build["targets"]
72+
}
73+
if "kernel_image" in build:
74+
current_build.update(
75+
{"kernel_image": build["kernel_image"]})
76+
if "make_variables" in build:
77+
current_build.update(
78+
{"make_variables": build["make_variables"]})
79+
80+
if "defconfig" in str(build["config"]):
81+
defconfigs.append(current_build)
82+
elif "https://" in str(build["config"]):
83+
distribution_configs.append(current_build)
84+
else:
85+
allconfigs.append(current_build)
86+
87+
tuxsuite_buildset["sets"][0]["builds"] = defconfigs
88+
if distribution_configs:
89+
tuxsuite_buildset["sets"] += [{
90+
"name": "distribution_configs",
91+
"builds": distribution_configs
92+
}]
93+
if allconfigs:
94+
tuxsuite_buildset["sets"] += [{
95+
"name": "allconfigs",
96+
"builds": allconfigs
97+
}]
98+
print(
99+
yaml.dump(tuxsuite_buildset,
100+
Dumper=NoAliasDumper,
101+
width=1000,
102+
sort_keys=False))
103+
sys.stdout = orig_stdout
103104

104105

105106
if __name__ == "__main__":

generate_workflow.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,18 @@ def print_builds(config, tree_name, llvm_version):
193193
workflow["jobs"].update(tuxsuite_setups("allconfigs", tuxsuite_yml))
194194
workflow["jobs"].update(check_logs_allconfigs)
195195

196-
orig_stdout = sys.stdout
197-
f = open(github_yml, "w")
198-
sys.stdout = f
199-
print("# DO NOT MODIFY MANUALLY!")
200-
print("# This file has been autogenerated by invoking:")
201-
print("# $ ./generate_workflow.py {}".format(tree_name))
202-
print(yaml.dump(workflow, Dumper=yaml.Dumper, width=1000, sort_keys=False))
203-
sys.stdout = orig_stdout
204-
f.close()
196+
with open(github_yml, "w") as f:
197+
orig_stdout = sys.stdout
198+
sys.stdout = f
199+
print("# DO NOT MODIFY MANUALLY!")
200+
print("# This file has been autogenerated by invoking:")
201+
print("# $ ./generate_workflow.py {}".format(tree_name))
202+
print(
203+
yaml.dump(workflow,
204+
Dumper=yaml.Dumper,
205+
width=1000,
206+
sort_keys=False))
207+
sys.stdout = orig_stdout
205208

206209

207210
if __name__ == "__main__":

0 commit comments

Comments
 (0)