* [PATCH 0/3] wic: fix creation of working directory
@ 2017-02-02 13:32 Ed Bartosh
2017-02-02 13:32 ` [PATCH 1/3] wic: engine: create output dir Ed Bartosh
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ed Bartosh @ 2017-02-02 13:32 UTC (permalink / raw)
To: openembedded-core
Hi,
Changed working directory to be subdirectory of output dir.
This should fix several possible issues:
- current code uses mktemp which doesn't create anything
- default temporary directory is created in /tmp, which can
cause wic to take long time to move result image as output
directory can be on another partition
- possible disk space issues due to the /tmp usage
The following changes since commit 7d75fd29296a9c411881b4288bff2e02cb145a25:
wic: remove syslinux.py (2017-02-01 12:46:17 +0200)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib ed/wic/refactoring-10619
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/wic/refactoring-10619
Ed Bartosh (3):
wic: engine: create output dir
wic: direct: fix creation of work directory
wic: get rid of image_output_dir variable
scripts/lib/wic/engine.py | 3 +++
scripts/lib/wic/plugins/imager/direct.py | 2 +-
scripts/wic | 6 +-----
3 files changed, 5 insertions(+), 6 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [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
end of thread, other threads:[~2017-02-02 13:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 3/3] wic: get rid of image_output_dir variable Ed Bartosh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox