* [PATCH 1/3] wic: engine: create output dir
2017-02-02 13:32 [PATCH 0/3] wic: fix creation of working directory Ed Bartosh
@ 2017-02-02 13:32 ` Ed Bartosh
2017-02-02 13:32 ` [PATCH 2/3] wic: direct: fix creation of work directory Ed Bartosh
2017-02-02 13:32 ` [PATCH 3/3] wic: get rid of image_output_dir variable Ed Bartosh
2 siblings, 0 replies; 4+ messages in thread
From: Ed Bartosh @ 2017-02-02 13:32 UTC (permalink / raw)
To: openembedded-core
Make sure output directory exists before creating an image.
Create it if it doesn't exist.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
scripts/lib/wic/engine.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 592ef77..7fb6f13 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -187,6 +187,9 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
if debug:
msger.set_loglevel('debug')
+ if not os.path.exists(image_output_dir):
+ os.makedirs(image_output_dir)
+
crobj = creator.Creator()
cmdline = ["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir,
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/3] wic: direct: fix creation of work directory
2017-02-02 13:32 [PATCH 0/3] wic: fix creation of working directory Ed Bartosh
2017-02-02 13:32 ` [PATCH 1/3] wic: engine: create output dir Ed Bartosh
@ 2017-02-02 13:32 ` Ed Bartosh
2017-02-02 13:32 ` [PATCH 3/3] wic: get rid of image_output_dir variable Ed Bartosh
2 siblings, 0 replies; 4+ messages in thread
From: Ed Bartosh @ 2017-02-02 13:32 UTC (permalink / raw)
To: openembedded-core
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>
---
scripts/lib/wic/plugins/imager/direct.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 4637fbf3..b38e876 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -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
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 3/3] wic: get rid of image_output_dir variable
2017-02-02 13:32 [PATCH 0/3] wic: fix creation of working directory Ed Bartosh
2017-02-02 13:32 ` [PATCH 1/3] wic: engine: create output dir Ed Bartosh
2017-02-02 13:32 ` [PATCH 2/3] wic: direct: fix creation of work directory Ed Bartosh
@ 2017-02-02 13:32 ` Ed Bartosh
2 siblings, 0 replies; 4+ messages in thread
From: Ed Bartosh @ 2017-02-02 13:32 UTC (permalink / raw)
To: openembedded-core
Used options.outdir instead of image_output_dir.
There is no sense to use extra variable for this.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
scripts/wic | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/scripts/wic b/scripts/wic
index 33355ee..17e8231 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -203,10 +203,6 @@ def wic_create_subcommand(args, usage_str):
"kickstart (.wks) filename)\n" % args[0])
sys.exit(1)
- image_output_dir = ""
- if options.outdir:
- image_output_dir = options.outdir
-
if not options.image_name:
rootfs_dir = ''
if 'ROOTFS_DIR' in options.rootfs_dir:
@@ -254,7 +250,7 @@ def wic_create_subcommand(args, usage_str):
print("Creating image(s)...\n")
engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
- native_sysroot, scripts_path, image_output_dir,
+ native_sysroot, scripts_path, options.outdir,
options.compressor, options.bmap, options.debug)
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread