wic: direct: fix creation of work directory

It was a typo in current code: mktemp was used instead of
mkdtemp to create work directory. This is fixed by using
mkdtemp.

Create work directory as a subdirectory of output directory
to make sure both are on the same partition to make moving
of result image faster.

This also fixes possible disk space issues as mkdtemp uses
TMPDIR, TEMP or TMP environment variables to get default value
of its 'dir' parameter. Those variables are usually pointing
to /tmp, which is not the best location to create huge images.

(From OE-Core rev: e6579b4e007ce89000c46c09917fbd3c72f18a73)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ed Bartosh 2017-02-02 15:32:58 +02:00 committed by Richard Purdie
parent 81ef850314
commit 14652a42d8
1 changed files with 1 additions and 1 deletions

View File

@ -122,7 +122,7 @@ class DirectImageCreator:
"""
self.name = name
self.outdir = outdir
self.workdir = tempfile.mktemp(prefix='wic')
self.workdir = tempfile.mkdtemp(dir=outdir, prefix='tmp.wic.')
self.ks = ksobj
self._image = None