diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-06-13 14:21:53 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-14 10:18:28 +0100 |
commit | 04a99adc2935326446a3d7c7a93eed12a5280b2a (patch) | |
tree | a9f3d41440b573e78bb9617f11308be6c87755d3 /scripts/wic | |
parent | 479c6a85af2a8572f807fdd12c842880fec8b78c (diff) | |
download | poky-04a99adc2935326446a3d7c7a93eed12a5280b2a.tar.gz |
wic: add wic_init_parser_ls
Added parser for 'wic ls' command.
(From OE-Core rev: 8db6f74b684fecc7dd4d23d327a9b6310cdd3ec9)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/wic')
-rwxr-xr-x | scripts/wic | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/wic b/scripts/wic index 49cad869e2..6c9a30da7d 100755 --- a/scripts/wic +++ b/scripts/wic | |||
@@ -35,6 +35,8 @@ import os | |||
35 | import sys | 35 | import sys |
36 | import argparse | 36 | import argparse |
37 | import logging | 37 | import logging |
38 | |||
39 | from collections import namedtuple | ||
38 | from distutils import spawn | 40 | from distutils import spawn |
39 | 41 | ||
40 | # External modules | 42 | # External modules |
@@ -317,6 +319,29 @@ def wic_init_parser_list(subparser): | |||
317 | "defined inside the .wks file") | 319 | "defined inside the .wks file") |
318 | return | 320 | return |
319 | 321 | ||
322 | def imgtype(arg): | ||
323 | """ | ||
324 | Custom type for ArgumentParser | ||
325 | Converts path spec to named tuple: (image, partition, path) | ||
326 | """ | ||
327 | image = arg | ||
328 | part = path = None | ||
329 | if ':' in image: | ||
330 | image, part = image.split(':') | ||
331 | if '/' in part: | ||
332 | part, path = part.split('/', 1) | ||
333 | |||
334 | if not os.path.isfile(image): | ||
335 | err = "%s is not a regular file or symlink" % image | ||
336 | raise argparse.ArgumentTypeError(err) | ||
337 | |||
338 | return namedtuple('ImgType', 'image part path')(image, part, path) | ||
339 | |||
340 | def wic_init_parser_ls(subparser): | ||
341 | subparser.add_argument("path", type=imgtype, | ||
342 | help="image spec: <image>[:<vfat partition>[<path>]]") | ||
343 | subparser.add_argument("-n", "--native-sysroot", | ||
344 | help="path to the native sysroot containing the tools") | ||
320 | 345 | ||
321 | def wic_init_parser_help(subparser): | 346 | def wic_init_parser_help(subparser): |
322 | helpparsers = subparser.add_subparsers(dest='help_topic', help=hlp.wic_usage) | 347 | helpparsers = subparser.add_subparsers(dest='help_topic', help=hlp.wic_usage) |