diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-01-31 13:32:03 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-02 17:37:44 +0000 |
commit | 2d6f96048eb698f741b33c533b8eb15c19cc1f1d (patch) | |
tree | 8eab74694969f7f17aff4034ec2ca2b01dee1ecd /scripts/lib/wic/engine.py | |
parent | 759c24c404509b9d415d6f05e316553503b376b4 (diff) | |
download | poky-2d6f96048eb698f741b33c533b8eb15c19cc1f1d.tar.gz |
wic: move 2 APIs to wic.engine
Moved find_canned and get_custom_config APIs to engine module.
Removed empty wic.utils.misc module.
[YOCTO #10619]
(From OE-Core rev: 10e9afac46575d3f557b7cb505daa31ce9ce85fa)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/engine.py')
-rw-r--r-- | scripts/lib/wic/engine.py | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 2adef2f99f..4abea87273 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py | |||
@@ -32,7 +32,6 @@ import os | |||
32 | import sys | 32 | import sys |
33 | 33 | ||
34 | from wic import msger, creator | 34 | from wic import msger, creator |
35 | from wic.utils import misc | ||
36 | from wic.plugin import pluginmgr | 35 | from wic.plugin import pluginmgr |
37 | from wic.utils.oe import misc | 36 | from wic.utils.oe import misc |
38 | 37 | ||
@@ -226,3 +225,35 @@ def wic_list(args, scripts_path): | |||
226 | return True | 225 | return True |
227 | 226 | ||
228 | return False | 227 | return False |
228 | |||
229 | def find_canned(scripts_path, file_name): | ||
230 | """ | ||
231 | Find a file either by its path or by name in the canned files dir. | ||
232 | |||
233 | Return None if not found | ||
234 | """ | ||
235 | if os.path.exists(file_name): | ||
236 | return file_name | ||
237 | |||
238 | layers_canned_wks_dir = build_canned_image_list(scripts_path) | ||
239 | for canned_wks_dir in layers_canned_wks_dir: | ||
240 | for root, dirs, files in os.walk(canned_wks_dir): | ||
241 | for fname in files: | ||
242 | if fname == file_name: | ||
243 | fullpath = os.path.join(canned_wks_dir, fname) | ||
244 | return fullpath | ||
245 | |||
246 | def get_custom_config(boot_file): | ||
247 | """ | ||
248 | Get the custom configuration to be used for the bootloader. | ||
249 | |||
250 | Return None if the file can't be found. | ||
251 | """ | ||
252 | # Get the scripts path of poky | ||
253 | scripts_path = os.path.abspath("%s/../.." % os.path.dirname(__file__)) | ||
254 | |||
255 | cfg_file = find_canned(scripts_path, boot_file) | ||
256 | if cfg_file: | ||
257 | with open(cfg_file, "r") as f: | ||
258 | config = f.read() | ||
259 | return config | ||