diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-01-30 23:31:53 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-02 17:37:44 +0000 |
commit | 0ff04e1e956d6c2aab6ae5fb7c25b8327e99edc9 (patch) | |
tree | ea85ecfb4d52268827bddfa579c741473cca7946 | |
parent | 65a99448a4b044ccde005247d54de6172ee25172 (diff) | |
download | poky-0ff04e1e956d6c2aab6ae5fb7c25b8327e99edc9.tar.gz |
wic: direct_plugin: stop using config manager
This is a preparation to removing conf.py and config/wic.conf
from the codebase.
Got rid of using configmgr global object in direct_plugin and direct
modules. It was used to implicitly parse kickstart file and set
couple of variables.
Replaced usage of configmgr by passing parameters directly to the
DirectImageCreator.
[YOCTO #10619]
(From OE-Core rev: 79191119de010acb107f9392a991108728858441)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/wic/imager/direct.py | 10 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/imager/direct_plugin.py | 22 |
2 files changed, 20 insertions, 12 deletions
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 575fd95f11..ff06b504ce 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py | |||
@@ -72,18 +72,18 @@ class DirectImageCreator: | |||
72 | media and used on actual hardware. | 72 | media and used on actual hardware. |
73 | """ | 73 | """ |
74 | 74 | ||
75 | def __init__(self, oe_builddir, image_output_dir, rootfs_dir, | 75 | def __init__(self, image_name, ksobj, oe_builddir, image_output_dir, |
76 | bootimg_dir, kernel_dir, native_sysroot, compressor, | 76 | rootfs_dir, bootimg_dir, kernel_dir, native_sysroot, |
77 | creatoropts, bmap=False): | 77 | compressor, bmap=False): |
78 | """ | 78 | """ |
79 | Initialize a DirectImageCreator instance. | 79 | Initialize a DirectImageCreator instance. |
80 | 80 | ||
81 | This method takes the same arguments as ImageCreator.__init__() | 81 | This method takes the same arguments as ImageCreator.__init__() |
82 | """ | 82 | """ |
83 | self.name = creatoropts['name'] | 83 | self.name = image_name |
84 | self.outdir = image_output_dir | 84 | self.outdir = image_output_dir |
85 | self.workdir = tempfile.mktemp(prefix='wic') | 85 | self.workdir = tempfile.mktemp(prefix='wic') |
86 | self.ks = creatoropts['ks'] | 86 | self.ks = ksobj |
87 | 87 | ||
88 | self.__image = None | 88 | self.__image = None |
89 | self.__disks = {} | 89 | self.__disks = {} |
diff --git a/scripts/lib/wic/plugins/imager/direct_plugin.py b/scripts/lib/wic/plugins/imager/direct_plugin.py index 8fe3930804..e839d2feae 100644 --- a/scripts/lib/wic/plugins/imager/direct_plugin.py +++ b/scripts/lib/wic/plugins/imager/direct_plugin.py | |||
@@ -24,8 +24,12 @@ | |||
24 | # Tom Zanussi <tom.zanussi (at] linux.intel.com> | 24 | # Tom Zanussi <tom.zanussi (at] linux.intel.com> |
25 | # | 25 | # |
26 | 26 | ||
27 | from time import strftime | ||
28 | |||
29 | from os.path import basename, splitext | ||
27 | from wic.utils import errors | 30 | from wic.utils import errors |
28 | from wic.conf import configmgr | 31 | from wic.ksparser import KickStart, KickStartError |
32 | from wic import msger | ||
29 | 33 | ||
30 | import wic.imager.direct as direct | 34 | import wic.imager.direct as direct |
31 | from wic.pluginbase import ImagerPlugin | 35 | from wic.pluginbase import ImagerPlugin |
@@ -68,27 +72,31 @@ class DirectPlugin(ImagerPlugin): | |||
68 | bootimg_dir = args[2] | 72 | bootimg_dir = args[2] |
69 | rootfs_dir = args[3] | 73 | rootfs_dir = args[3] |
70 | 74 | ||
71 | creatoropts = configmgr.create | ||
72 | ksconf = args[4] | 75 | ksconf = args[4] |
73 | 76 | ||
74 | image_output_dir = args[5] | 77 | image_output_dir = args[5] |
75 | oe_builddir = args[6] | 78 | oe_builddir = args[6] |
76 | compressor = args[7] | 79 | compressor = args[7] |
77 | 80 | ||
78 | krootfs_dir = cls.__rootfs_dir_to_dict(rootfs_dir) | 81 | try: |
82 | ksobj = KickStart(ksconf) | ||
83 | except KickStartError as err: | ||
84 | msger.error(str(err)) | ||
79 | 85 | ||
80 | configmgr._ksconf = ksconf | 86 | image_name = "%s-%s" % (splitext(basename(ksconf))[0], |
87 | strftime("%Y%m%d%H%M")) | ||
88 | krootfs_dir = cls.__rootfs_dir_to_dict(rootfs_dir) | ||
81 | 89 | ||
82 | creator = direct.DirectImageCreator(oe_builddir, | 90 | creator = direct.DirectImageCreator(image_name, |
91 | ksobj, | ||
92 | oe_builddir, | ||
83 | image_output_dir, | 93 | image_output_dir, |
84 | krootfs_dir, | 94 | krootfs_dir, |
85 | bootimg_dir, | 95 | bootimg_dir, |
86 | kernel_dir, | 96 | kernel_dir, |
87 | native_sysroot, | 97 | native_sysroot, |
88 | compressor, | 98 | compressor, |
89 | creatoropts, | ||
90 | opts.bmap) | 99 | opts.bmap) |
91 | |||
92 | try: | 100 | try: |
93 | creator.create() | 101 | creator.create() |
94 | creator.assemble() | 102 | creator.assemble() |