stage: temp dirs within store's tmp dir

Instead of creating the temporary directory for the BuildRoot and
the sources output directly at the store root, create them inside
the store's temporary directory.
This commit is contained in:
Christian Kellner 2021-01-16 21:57:43 +01:00 committed by Tom Gundersen
parent 0bb3121273
commit 1a3c8e85c6

View file

@ -2,7 +2,6 @@ import contextlib
import hashlib import hashlib
import json import json
import os import os
import tempfile
from typing import Dict, List from typing import Dict, List
from .api import API from .api import API
@ -56,13 +55,12 @@ class Stage:
return m.hexdigest() return m.hexdigest()
def run(self, tree, runner, build_tree, store, monitor, libdir): def run(self, tree, runner, build_tree, store, monitor, libdir):
var = store.store
with contextlib.ExitStack() as cm: with contextlib.ExitStack() as cm:
build_root = buildroot.BuildRoot(build_tree, runner, libdir, var) build_root = buildroot.BuildRoot(build_tree, runner, libdir, store.tmp)
cm.enter_context(build_root) cm.enter_context(build_root)
sources_tmp = tempfile.TemporaryDirectory(prefix="osbuild-sources-output-", dir=var) sources_tmp = store.tempdir(prefix="osbuild-sources-output-")
sources_output = cm.enter_context(sources_tmp) sources_output = cm.enter_context(sources_tmp)
args = { args = {