Change all the schemata to not allow additional properties. This
should help with misspelled properties as well as missing schema
information in the stage itself.
Done via a small python3 script:
--- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< ---
import os
import sys
def list_stages(base):
return [(base, f) for f in os.listdir(base) if f.startswith("org.osbuild")]
stages = list_stages("stages")
stages += list_stages("assemblers")
def find_line(lines, start):
for i, l in enumerate(lines):
if l.startswith(start):
return i
return None
NOADD = '"additionalProperties": false'
for stage in stages:
with open(f"{stage[0]}/{stage[1]}", "r") as f:
print(f"{stage[0]}/{stage[1]}", file=sys.stderr)
data = f.readlines()
i = find_line(data, 'STAGE_OPTS = """')
if i:
data.insert(i+1, NOADD + ",\n")
else:
i = find_line(data, 'STAGE_OPTS = ""')
if i:
data[i] = f'STAGE_OPTS = """\n'
data.insert(i+1, NOADD + "\n")
data.insert(i+2, '"""\n')
with open(f"{stage[0]}/{stage[1]}", "w") as f:
f.writelines(data)
20 lines
499 B
Python
Executable file
20 lines
499 B
Python
Executable file
#!/usr/bin/python3
|
|
|
|
import json
|
|
import sys
|
|
|
|
STAGE_DESC = "No-op assembler"
|
|
STAGE_INFO = """
|
|
No-op assembler. Produces no output, just prints a JSON dump of its options
|
|
and then exits.
|
|
"""
|
|
STAGE_OPTS = """
|
|
"additionalProperties": false
|
|
"""
|
|
def main(_tree, _output_dir, options):
|
|
print("Not doing anything with these options:", json.dumps(options))
|
|
|
|
if __name__ == '__main__':
|
|
args = json.load(sys.stdin)
|
|
r = main(args["tree"], args["output_dir"], args.get("options", {}))
|
|
sys.exit(r)
|