Create temporary dirs under compose's workdir
Add compose.mkdtemp which creates and returns a unique temporary
directory under <compose_topdir>/work/{global,<arch>}/tmp[-<variant>]/
Change tempfile.mkdtemp in code to compose.mkdtemp, so temporary
dirs are created under the compose's workdir, this makes it more
easier to maintain the temporary dirs/files especially when compose
fails with amount of temporary files left there.
Signed-off-by: Qixiang Wan <qwan@redhat.com>
This commit is contained in:
parent
f6f84de1fb
commit
6fbf1e8f59
12 changed files with 81 additions and 37 deletions
|
|
@ -10,7 +10,7 @@ import tempfile
|
|||
import shutil
|
||||
import errno
|
||||
|
||||
from pungi.util import get_arch_variant_data
|
||||
from pungi.util import get_arch_variant_data, makedirs
|
||||
from pungi import paths, checks
|
||||
|
||||
|
||||
|
|
@ -106,6 +106,11 @@ class DummyCompose(object):
|
|||
result |= set(variant.arches)
|
||||
return sorted(result)
|
||||
|
||||
def mkdtemp(self, suffix="", prefix="tmp"):
|
||||
tmpdir = os.path.join('/tmp', "tmp_" + self.compose_id)
|
||||
makedirs(tmpdir)
|
||||
return tempfile.mkdtemp(suffix=suffix, prefix=prefix, dir=tmpdir)
|
||||
|
||||
|
||||
def touch(path, content=None):
|
||||
"""Helper utility that creates an dummy file in given location. Directories
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue