Fix createrepo issue for modular compose

This commit is contained in:
Lubomír Sedlář 2017-04-11 15:21:53 +02:00
parent eba2dfa549
commit 3ad0305134
2 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,55 @@
From 621f1e224737bae86d449503fb0aec7abac9d197 Mon Sep 17 00:00:00 2001
From: Jan Kaluza <jkaluza@redhat.com>
Date: Tue, 11 Apr 2017 14:46:38 +0200
Subject: [PATCH] Fix createrepo issue for modular compose when multiple
threads tried to use the same tmp directory.
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
---
pungi/phases/createrepo.py | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/pungi/phases/createrepo.py b/pungi/phases/createrepo.py
index 6468229..74087eb 100644
--- a/pungi/phases/createrepo.py
+++ b/pungi/phases/createrepo.py
@@ -30,7 +30,7 @@ from kobo.shortcuts import run, relative_path
from ..wrappers.scm import get_dir_from_scm
from ..wrappers.createrepo import CreaterepoWrapper
from .base import PhaseBase
-from ..util import find_old_compose
+from ..util import find_old_compose, temp_dir
import productmd.rpms
@@ -187,17 +187,16 @@ def create_variant_repo(compose, arch, variant, pkg_type):
modules = {"modules": []}
for mmd in variant.mmds:
modules["modules"].append(yaml.safe_load(mmd.dumps()))
- tmp_dir = compose.mkdtemp(prefix="pungi_")
- modules_path = os.path.join(tmp_dir, "modules.yaml")
- with open(modules_path, "w") as outfile:
- outfile.write(yaml.safe_dump(modules))
- cmd = repo.get_modifyrepo_cmd(os.path.join(repo_dir, "repodata"),
- modules_path, mdtype="modules",
- compress_type="gz")
- log_file = compose.paths.log.log_file(
- arch, "modifyrepo-modules-%s" % variant)
- run(cmd, logfile=log_file, show_cmd=True)
- shutil.rmtree(tmp_dir)
+ with temp_dir() as tmp_dir:
+ modules_path = os.path.join(tmp_dir, "modules.yaml")
+ with open(modules_path, "w") as outfile:
+ outfile.write(yaml.safe_dump(modules))
+ cmd = repo.get_modifyrepo_cmd(os.path.join(repo_dir, "repodata"),
+ modules_path, mdtype="modules",
+ compress_type="gz")
+ log_file = compose.paths.log.log_file(
+ arch, "modifyrepo-modules-%s" % variant)
+ run(cmd, logfile=log_file, show_cmd=True)
compose.log_info("[DONE ] %s" % msg)
--
2.9.3

View File

@ -1,12 +1,13 @@
Name: pungi
Version: 4.1.14
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Distribution compose tool
Group: Development/Tools
License: GPLv2
URL: https://pagure.io/pungi
Source0: https://pagure.io/releases/%{name}/%{name}-%{version}.tar.bz2
Patch0: 0001-Fix-createrepo-issue-for-modular-compose-when-multip.patch
BuildRequires: python-nose, python-mock
BuildRequires: python-devel, python-setuptools, python2-productmd >= 1.3
@ -74,6 +75,7 @@ notification to Fedora Message Bus.
%prep
%setup -q
%patch0 -p1
%build
%{__python} setup.py build
@ -118,6 +120,9 @@ cd tests && ./test_compose.sh
%{_bindir}/%{name}-compare-depsolving
%changelog
* Tue Apr 11 2017 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.14-2
- Fix createrepo issue for modular compose
* Tue Mar 28 2017 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.14-1
- Not create empty skeleton dirs for empty variants (qwan)
- Query only active modules in PDC. (jkaluza)