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:20 +0100
commit8db6f74b684fecc7dd4d23d327a9b6310cdd3ec9 (patch)
tree68d9458b1f3a8d54493413338b054d3d79bccca0 /scripts/wic
parenteec6e946cce36cba304851fa4a1c1d7bfd7b0bed (diff)
downloadopenembedded-core-contrib-8db6f74b684fecc7dd4d23d327a9b6310cdd3ec9.tar.gz
wic: add wic_init_parser_ls
Added parser for 'wic ls' command. 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
import sys
import argparse
import logging
+
+from collections import namedtuple
from distutils import spawn
# External modules
@@ -317,6 +319,29 @@ def wic_init_parser_list(subparser):
"defined inside the .wks file")
return
+def imgtype(arg):
+ """
+ Custom type for ArgumentParser
+ Converts path spec to named tuple: (image, partition, path)
+ """
+ image = arg
+ part = path = None
+ if ':' in image:
+ image, part = image.split(':')
+ if '/' in part:
+ part, path = part.split('/', 1)
+
+ if not os.path.isfile(image):
+ err = "%s is not a regular file or symlink" % image
+ raise argparse.ArgumentTypeError(err)
+
+ return namedtuple('ImgType', 'image part path')(image, part, path)
+
+def wic_init_parser_ls(subparser):
+ subparser.add_argument("path", type=imgtype,
+ help="image spec: <image>[:<vfat partition>[<path>]]")
+ subparser.add_argument("-n", "--native-sysroot",
+ help="path to the native sysroot containing the tools")
def wic_init_parser_help(subparser):
helpparsers = subparser.add_subparsers(dest='help_topic', help=hlp.wic_usage)