Fix createrepo issue for modular compose when multiple threads tried to use the same tmp directory.
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
parent
d4b7293acb
commit
621f1e2247
@ -30,7 +30,7 @@ from kobo.shortcuts import run, relative_path
|
|||||||
from ..wrappers.scm import get_dir_from_scm
|
from ..wrappers.scm import get_dir_from_scm
|
||||||
from ..wrappers.createrepo import CreaterepoWrapper
|
from ..wrappers.createrepo import CreaterepoWrapper
|
||||||
from .base import PhaseBase
|
from .base import PhaseBase
|
||||||
from ..util import find_old_compose
|
from ..util import find_old_compose, temp_dir
|
||||||
|
|
||||||
import productmd.rpms
|
import productmd.rpms
|
||||||
|
|
||||||
@ -187,17 +187,16 @@ def create_variant_repo(compose, arch, variant, pkg_type):
|
|||||||
modules = {"modules": []}
|
modules = {"modules": []}
|
||||||
for mmd in variant.mmds:
|
for mmd in variant.mmds:
|
||||||
modules["modules"].append(yaml.safe_load(mmd.dumps()))
|
modules["modules"].append(yaml.safe_load(mmd.dumps()))
|
||||||
tmp_dir = compose.mkdtemp(prefix="pungi_")
|
with temp_dir() as tmp_dir:
|
||||||
modules_path = os.path.join(tmp_dir, "modules.yaml")
|
modules_path = os.path.join(tmp_dir, "modules.yaml")
|
||||||
with open(modules_path, "w") as outfile:
|
with open(modules_path, "w") as outfile:
|
||||||
outfile.write(yaml.safe_dump(modules))
|
outfile.write(yaml.safe_dump(modules))
|
||||||
cmd = repo.get_modifyrepo_cmd(os.path.join(repo_dir, "repodata"),
|
cmd = repo.get_modifyrepo_cmd(os.path.join(repo_dir, "repodata"),
|
||||||
modules_path, mdtype="modules",
|
modules_path, mdtype="modules",
|
||||||
compress_type="gz")
|
compress_type="gz")
|
||||||
log_file = compose.paths.log.log_file(
|
log_file = compose.paths.log.log_file(
|
||||||
arch, "modifyrepo-modules-%s" % variant)
|
arch, "modifyrepo-modules-%s" % variant)
|
||||||
run(cmd, logfile=log_file, show_cmd=True)
|
run(cmd, logfile=log_file, show_cmd=True)
|
||||||
shutil.rmtree(tmp_dir)
|
|
||||||
|
|
||||||
compose.log_info("[DONE ] %s" % msg)
|
compose.log_info("[DONE ] %s" % msg)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user