summaryrefslogtreecommitdiffstats
path: root/scripts/wic
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-06-13 14:21:53 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-14 10:18:28 +0100
commit04a99adc2935326446a3d7c7a93eed12a5280b2a (patch)
treea9f3d41440b573e78bb9617f11308be6c87755d3 /scripts/wic
parent479c6a85af2a8572f807fdd12c842880fec8b78c (diff)
downloadpoky-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-xscripts/wic25
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
35import sys 35import sys
36import argparse 36import argparse
37import logging 37import logging
38
39from collections import namedtuple
38from distutils import spawn 40from 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
322def 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
340def 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
321def wic_init_parser_help(subparser): 346def 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)