]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: direct: fix creation of work directory
authorEd Bartosh <ed.bartosh@linux.intel.com>
Thu, 2 Feb 2017 13:32:58 +0000 (15:32 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 2 Feb 2017 17:37:36 +0000 (17:37 +0000)
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.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/lib/wic/plugins/imager/direct.py

index 4637fbf302f720a6b3145d09789afd5ea1f0f8c6..b38e8767586bec1fe9516e7cbc8d1ce24ea70f26 100644 (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