mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
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>
This commit is contained in:
parent
479c6a85af
commit
04a99adc29
25
scripts/wic
25
scripts/wic
|
@ -35,6 +35,8 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from collections import namedtuple
|
||||||
from distutils import spawn
|
from distutils import spawn
|
||||||
|
|
||||||
# External modules
|
# External modules
|
||||||
|
@ -317,6 +319,29 @@ def wic_init_parser_list(subparser):
|
||||||
"defined inside the .wks file")
|
"defined inside the .wks file")
|
||||||
return
|
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):
|
def wic_init_parser_help(subparser):
|
||||||
helpparsers = subparser.add_subparsers(dest='help_topic', help=hlp.wic_usage)
|
helpparsers = subparser.add_subparsers(dest='help_topic', help=hlp.wic_usage)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user