summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-06-13 14:21:58 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-14 10:18:29 +0100
commit13bf0f4faf2afb26c0d73ecb9db3215b4cba6717 (patch)
treefd5db9755ad5d2878a653f2f419cf65c655d63cb
parent491779839573105287634ccf7ff261a89fc904f8 (diff)
downloadpoky-13bf0f4faf2afb26c0d73ecb9db3215b4cba6717.tar.gz
wic: add wic_init_parser_cp
Add parser for 'wic cp' subcommand and a custom argument type. (From OE-Core rev: df5152c834ef58036b41ad51b19eda6abecd9543) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/wic16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/wic b/scripts/wic
index 4161f80367..945dda82e3 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -341,6 +341,8 @@ def imgtype(arg):
341 image, part = image.split(':') 341 image, part = image.split(':')
342 if '/' in part: 342 if '/' in part:
343 part, path = part.split('/', 1) 343 part, path = part.split('/', 1)
344 if not path:
345 path = '/'
344 346
345 if not os.path.isfile(image): 347 if not os.path.isfile(image):
346 err = "%s is not a regular file or symlink" % image 348 err = "%s is not a regular file or symlink" % image
@@ -354,6 +356,20 @@ def wic_init_parser_ls(subparser):
354 subparser.add_argument("-n", "--native-sysroot", 356 subparser.add_argument("-n", "--native-sysroot",
355 help="path to the native sysroot containing the tools") 357 help="path to the native sysroot containing the tools")
356 358
359def imgpathtype(arg):
360 img = imgtype(arg)
361 if img.part is None:
362 raise argparse.ArgumentTypeError("partition number is not specified")
363 return img
364
365def wic_init_parser_cp(subparser):
366 subparser.add_argument("src",
367 help="source spec")
368 subparser.add_argument("dest", type=imgpathtype,
369 help="image spec: <image>:<vfat partition>[<path>]")
370 subparser.add_argument("-n", "--native-sysroot",
371 help="path to the native sysroot containing the tools")
372
357def wic_init_parser_help(subparser): 373def wic_init_parser_help(subparser):
358 helpparsers = subparser.add_subparsers(dest='help_topic', help=hlp.wic_usage) 374 helpparsers = subparser.add_subparsers(dest='help_topic', help=hlp.wic_usage)
359 for helptopic in helptopics: 375 for helptopic in helptopics: