summaryrefslogtreecommitdiffstats
path: root/scripts/wic
diff options
context:
space:
mode:
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)