osbuild: make state handling generic

Rather than treating the dnf-cache specially, give each stage its
own state directory that they can reuse. This should obviously be
used with care by the stages in order to make the builds
reproducible.
This commit is contained in:
Tom Gundersen 2019-06-06 19:28:22 +02:00
parent d7cf0ac006
commit cdcfa1277e
10 changed files with 15 additions and 13 deletions

View file

@ -47,9 +47,14 @@ def main(pipeline_path, from_archive, save):
name = stage["name"]
options = stage.get("options", {})
options["tree"] = os.path.abspath(tree)
options["state"] = f"{os.getcwd()}/state/{name}"
options_str = json.dumps(options, indent=2)
r = subprocess.run(["mkdir", "-p", f"{os.getcwd()}/state/{name}"])
if r.returncode != 0:
return
print()
print(f"{RESET}{BOLD}{i}. {name}{RESET} {options_str}")
print()