<div dir="ltr">Hi Amber,<div><br></div><div>Can you resend that using git-send-email? Copy/pasting it into a mail client has sent it as HTML, which git-apply can't read.</div><div><br></div><div>Cheers,</div><div>Ross</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 11 December 2017 at 21:25, Elliot, Amber N <span dir="ltr"><<a href="mailto:amber.n.elliot@intel.com" target="_blank">amber.n.elliot@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>
<div>The wic help output formally consisted of manually created strings mixed with argparse,</div>
<div>which was unformatted and unusable. This fix cleans up the help messages, rewrites help</div>
<div>functionality to use argparse, and adds functionality to show information for</div>
<div>plugins (similar to canned images).</div>
<div><br>
</div>
<div>Fixes [YOCTO #12205]</div>
<div><br>
</div>
<div>Signed-off-by: anelliot <<a href="mailto:amber.n.elliot@intel.com" target="_blank">amber.n.elliot@intel.com</a>></div>
<div>---</div>
<div> scripts/lib/wic/engine.py | 87 +++-</div>
<div> scripts/lib/wic/help.py | 1072 +++++-------------------------<wbr>---------------</div>
<div> scripts/wic | 169 +++----</div>
<div> 3 files changed, 243 insertions(+), 1085 deletions(-)</div>
<div><br>
</div>
<div>diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py</div>
<div>index edcfab3..5d1e1d8 100644</div>
<div>--- a/scripts/lib/wic/engine.py</div>
<div>+++ b/scripts/lib/wic/engine.py</div>
<div>@@ -58,6 +58,8 @@ def verify_build_env():</div>
<div> </div>
<div> CANNED_IMAGE_DIR = "lib/wic/canned-wks" # relative to scripts</div>
<div> SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR</div>
<div>+SOURCE_PLUGIN_DIR = "lib/wic/plugins/source"</div>
<div>+SCRIPTS_SOURCE_PLUGIN_DIR = "scripts/" + SOURCE_PLUGIN_DIR</div>
<div> WIC_DIR = "wic"</div>
<div> </div>
<div> def build_canned_image_list(path):</div>
<div>@@ -76,6 +78,23 @@ def build_canned_image_list(path):</div>
<div> </div>
<div> return canned_wks_layer_dirs</div>
<div> </div>
<div>+def build_source_plugin_list(path)<wbr>:</div>
<div>+ layers_path = get_bitbake_var("BBLAYERS")</div>
<div>+ canned_wks_layer_dirs = []</div>
<div>+</div>
<div>+ if layers_path is not None:</div>
<div>+ for layer_path in layers_path.split():</div>
<div>+ for wks_path in (WIC_DIR, SCRIPTS_SOURCE_PLUGIN_DIR):</div>
<div>+ cpath = os.path.join(layer_path, wks_path)</div>
<div>+ if os.path.isdir(cpath):</div>
<div>+ canned_wks_layer_dirs.append(<wbr>cpath)</div>
<div>+</div>
<div>+ cpath = os.path.join(path, SOURCE_PLUGIN_DIR)</div>
<div>+ canned_wks_layer_dirs.append(<wbr>cpath)</div>
<div>+</div>
<div>+ return canned_wks_layer_dirs</div>
<div>+</div>
<div>+</div>
<div> def find_canned_image(scripts_<wbr>path, wks_file):</div>
<div> """</div>
<div> Find a .wks file with the given name in the canned files dir.</div>
<div>@@ -95,6 +114,24 @@ def find_canned_image(scripts_<wbr>path, wks_file):</div>
<div> return None</div>
<div> </div>
<div> </div>
<div>+def find_source_plugin(scripts_<wbr>path, plugin_file):</div>
<div>+ """</div>
<div>+ Find a .py file with the given name in the source plugin dir.</div>
<div>+</div>
<div>+ Return False if not found</div>
<div>+ """</div>
<div>+ layers_source_plugin_dir = build_source_plugin_list(<wbr>scripts_path)</div>
<div>+</div>
<div>+ for source_plugin_dir in layers_source_plugin_dir:</div>
<div>+ for root, dirs, files in os.walk(source_plugin_dir):</div>
<div>+ for fname in files:</div>
<div>+ if fname.endswith("~") or fname.endswith("#"):</div>
<div>+ continue</div>
<div>+ if fname.endswith(".py") and plugin_file + ".py" == fname:</div>
<div>+ fullpath = os.path.join(source_plugin_<wbr>dir, fname)</div>
<div>+ return fullpath</div>
<div>+ return None</div>
<div>+</div>
<div> def list_canned_images(scripts_<wbr>path):</div>
<div> """</div>
<div> List the .wks files in the canned image dir, minus the extension.</div>
<div>@@ -119,7 +156,7 @@ def list_canned_images(scripts_<wbr>path):</div>
<div> print(" %s\t\t%s" % (basename.ljust(30), desc))</div>
<div> </div>
<div> </div>
<div>-def list_canned_image_help(<wbr>scripts_path, fullpath):</div>
<div>+def list_canned_image_help(<wbr>fullpath):</div>
<div> """</div>
<div> List the help and params in the specified canned image.</div>
<div> """</div>
<div>@@ -139,6 +176,7 @@ def list_canned_image_help(<wbr>scripts_path, fullpath):</div>
<div> if idx != -1:</div>
<div> print(line[idx + len("#:"):].rstrip())</div>
<div> else:</div>
<div>+ print()</div>
<div> break</div>
<div> </div>
<div> </div>
<div>@@ -152,6 +190,29 @@ def list_source_plugins():</div>
<div> print(" %s" % plugin)</div>
<div> </div>
<div> </div>
<div>+def list_source_plugins_help(<wbr>fullpath):</div>
<div>+ """</div>
<div>+ List the help and params in the specified canned image.</div>
<div>+ """</div>
<div>+ found = False</div>
<div>+ with open(fullpath) as plugin:</div>
<div>+ for line in plugin:</div>
<div>+ if not found:</div>
<div>+ idx = line.find("DESCRIPTION")</div>
<div>+ if idx != -1:</div>
<div>+ print(line[idx + len("DESCRIPTION"):].strip())</div>
<div>+ found = True</div>
<div>+ continue</div>
<div>+ if not line.strip():</div>
<div>+ break</div>
<div>+ idx = line.find("#")</div>
<div>+ auth = line.find("AUTHORS")</div>
<div>+ if idx != -1 and auth == -1:</div>
<div>+ print(line[idx + len("#:"):].rstrip())</div>
<div>+ else:</div>
<div>+ break</div>
<div>+</div>
<div>+</div>
<div> def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,</div>
<div> native_sysroot, options):</div>
<div> """</div>
<div>@@ -204,7 +265,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,</div>
<div> <a href="http://logger.info" target="_blank">logger.info</a>("The image(s) were created using OE kickstart file:\n %s", wks_file)</div>
<div> </div>
<div> </div>
<div>-def wic_list(args, scripts_path):</div>
<div>+def wic_list(scripts_path, args):</div>
<div> """</div>
<div> Print the list of images or source plugins.</div>
<div> """</div>
<div>@@ -218,16 +279,20 @@ def wic_list(args, scripts_path):</div>
<div> elif args.list_type == "source-plugins":</div>
<div> list_source_plugins()</div>
<div> return True</div>
<div>- elif len(args.help_for) == 1 and args.help_for[0] == 'help':</div>
<div>- wks_file = args.list_type</div>
<div>- fullpath = find_canned_image(scripts_<wbr>path, wks_file)</div>
<div>+ elif len(args.info_for) == 1 and args.info_for[0] == 'info':</div>
<div>+ input_file = args.list_type</div>
<div>+ fullpath = find_canned_image(scripts_<wbr>path, input_file)</div>
<div> if not fullpath:</div>
<div>- raise WicError("No image named %s found, exiting. "</div>
<div>- "(Use 'wic list images' to list available images, "</div>
<div>- "or specify a fully-qualified OE kickstart (.wks) "</div>
<div>- "filename)" % wks_file)</div>
<div>-</div>
<div>- list_canned_image_help(<wbr>scripts_path, fullpath)</div>
<div>+ fullpath = find_source_plugin(scripts_<wbr>path, input_file)</div>
<div>+ if not fullpath:</div>
<div>+ raise WicError("No image named %s found, exiting. "</div>
<div>+ "(Use 'wic list images' to list available images, "</div>
<div>+ "or specify a fully-qualified OE kickstart (.wks) "</div>
<div>+ "filename)" % input_file)</div>
<div>+ else:</div>
<div>+ list_source_plugins_help(<wbr>fullpath)</div>
<div>+ else:</div>
<div>+ list_canned_image_help(<wbr>fullpath)</div>
<div> return True</div>
<div> </div>
<div> return False</div>
<div>diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py</div>
<div>index 2ac45e0..8230395 100644</div>
<div>--- a/scripts/lib/wic/help.py</div>
<div>+++ b/scripts/lib/wic/help.py</div>
<div>@@ -30,1014 +30,166 @@ import logging</div>
<div> </div>
<div> from wic.pluginbase import PluginMgr, PLUGIN_TYPES</div>
<div> </div>
<div>-logger = logging.getLogger('wic')</div>
<div>-</div>
<div>-def subcommand_error(args):</div>
<div>- <a href="http://logger.info" target="_blank">logger.info</a>("invalid subcommand %s", args[0])</div>
<div>-</div>
<div>-</div>
<div>-def display_help(subcommand, subcommands):</div>
<div>- """</div>
<div>- Display help for subcommand.</div>
<div>- """</div>
<div>- if subcommand not in subcommands:</div>
<div>- return False</div>
<div>-</div>
<div>- hlp = subcommands.get(subcommand, subcommand_error)[2]</div>
<div>- if callable(hlp):</div>
<div>- hlp = hlp()</div>
<div>- pager = subprocess.Popen('less', stdin=subprocess.PIPE)</div>
<div>- pager.communicate(hlp.encode(<wbr>'utf-8'))</div>
<div>-</div>
<div>- return True</div>
<div>-</div>
<div>-</div>
<div>-def wic_help(args, usage_str, subcommands):</div>
<div>- """</div>
<div>- Subcommand help dispatcher.</div>
<div>- """</div>
<div>- if args.help_topic == None or not display_help(args.help_topic, subcommands):</div>
<div>- print(usage_str)</div>
<div>-</div>
<div>-</div>
<div>-def get_wic_plugins_help():</div>
<div>- """</div>
<div>- Combine wic_plugins_help with the help for every known</div>
<div>- source plugin.</div>
<div>- """</div>
<div>- result = wic_plugins_help</div>
<div>- for plugin_type in PLUGIN_TYPES:</div>
<div>- result += '\n\n%s PLUGINS\n\n' % plugin_type.upper()</div>
<div>- for name, plugin in PluginMgr.get_plugins(plugin_<wbr>type).items():</div>
<div>- result += "\n %s plugin:\n" % name</div>
<div>- if plugin.__doc__:</div>
<div>- result += plugin.__doc__</div>
<div>- else:</div>
<div>- result += "\n %s is missing docstring\n" % plugin</div>
<div>- return result</div>
<div>-</div>
<div>-</div>
<div>-def invoke_subcommand(args, parser, main_command_usage, subcommands):</div>
<div>- """</div>
<div>- Dispatch to subcommand handler borrowed from combo-layer.</div>
<div>- Should use argparse, but has to work in 2.6.</div>
<div>- """</div>
<div>- if not args.command:</div>
<div>- logger.error("No subcommand specified, exiting")</div>
<div>- parser.print_help()</div>
<div>- return 1</div>
<div>- elif args.command == "help":</div>
<div>- wic_help(args, main_command_usage, subcommands)</div>
<div>- elif args.command not in subcommands:</div>
<div>- logger.error("Unsupported subcommand %s, exiting\n", args.command)</div>
<div>- parser.print_help()</div>
<div>- return 1</div>
<div>- else:</div>
<div>- subcmd = subcommands.get(args.command, subcommand_error)</div>
<div>- usage = subcmd[1]</div>
<div>- subcmd[0](args, usage)</div>
<div>-</div>
<div>-</div>
<div>-##</div>
<div>+# ##</div>
<div> # wic help and usage strings</div>
<div> ##</div>
<div> </div>
<div>-wic_usage = """</div>
<div>-</div>
<div>- Create a customized OpenEmbedded image</div>
<div>-</div>
<div>- usage: wic [--version] | [--help] | [COMMAND [ARGS]]</div>
<div>-</div>
<div>- Current 'wic' commands are:</div>
<div>- help Show help for command or one of the topics (see below)</div>
<div>- create Create a new OpenEmbedded image</div>
<div>- list List available canned images and source plugins</div>
<div>-</div>
<div>- Help topics:</div>
<div>- overview wic overview - General overview of wic</div>
<div>- plugins wic plugins - Overview and API</div>
<div>- kickstart wic kickstart - wic kickstart reference</div>
<div>-"""</div>
<div>-</div>
<div>-wic_help_usage = """</div>
<div>-</div>
<div>- usage: wic help <subcommand></div>
<div>-</div>
<div>- This command displays detailed help for the specified subcommand.</div>
<div>-"""</div>
<div>-</div>
<div>-wic_create_usage = """</div>
<div>-</div>
<div>- Create a new OpenEmbedded image</div>
<div>-</div>
<div>- usage: wic create <wks file or image name> [-o <DIRNAME> | --outdir <DIRNAME>]</div>
<div>- [-e | --image-name] [-s, --skip-build-check] [-D, --debug]</div>
<div>- [-r, --rootfs-dir] [-b, --bootimg-dir]</div>
<div>- [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs]</div>
<div>- [-c, --compress-with] [-m, --bmap]</div>
<div>-</div>
<div>- This command creates an OpenEmbedded image based on the 'OE kickstart</div>
<div>- commands' found in the <wks file>.</div>
<div>-</div>
<div>- The -o option can be used to place the image in a directory with a</div>
<div>- different name and location.</div>
<div>-</div>
<div>- See 'wic help create' for more detailed instructions.</div>
<div>-"""</div>
<div>-</div>
<div>-wic_create_help = """</div>
<div>-</div>
<div>-NAME</div>
<div>- wic create - Create a new OpenEmbedded image</div>
<div>-</div>
<div>-SYNOPSIS</div>
<div>- wic create <wks file or image name> [-o <DIRNAME> | --outdir <DIRNAME>]</div>
<div>- [-e | --image-name] [-s, --skip-build-check] [-D, --debug]</div>
<div>- [-r, --rootfs-dir] [-b, --bootimg-dir]</div>
<div>- [-k, --kernel-dir] [-n, --native-sysroot] [-f, --build-rootfs]</div>
<div>- [-c, --compress-with] [-m, --bmap] [--no-fstab-update]</div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>- This command creates an OpenEmbedded image based on the 'OE</div>
<div>- kickstart commands' found in the <wks file>.</div>
<div>-</div>
<div>- In order to do this, wic needs to know the locations of the</div>
<div>- various build artifacts required to build the image.</div>
<div>-</div>
<div>- Users can explicitly specify the build artifact locations using</div>
<div>- the -r, -b, -k, and -n options. See below for details on where</div>
<div>- the corresponding artifacts are typically found in a normal</div>
<div>- OpenEmbedded build.</div>
<div>-</div>
<div>- Alternatively, users can use the -e option to have 'wic' determine</div>
<div>- those locations for a given image. If the -e option is used, the</div>
<div>- user needs to have set the appropriate MACHINE variable in</div>
<div>- local.conf, and have sourced the build environment.</div>
<div>-</div>
<div>- The -e option is used to specify the name of the image to use the</div>
<div>- artifacts from e.g. core-image-sato.</div>
<div>-</div>
<div>- The -r option is used to specify the path to the /rootfs dir to</div>
<div>- use as the .wks rootfs source.</div>
<div>-</div>
<div>- The -b option is used to specify the path to the dir containing</div>
<div>- the boot artifacts (e.g. /EFI or /syslinux dirs) to use as the</div>
<div>- .wks bootimg source.</div>
<div>-</div>
<div>- The -k option is used to specify the path to the dir containing</div>
<div>- the kernel to use in the .wks bootimg.</div>
<div>-</div>
<div>- The -n option is used to specify the path to the native sysroot</div>
<div>- containing the tools to use to build the image.</div>
<div>-</div>
<div>- The -f option is used to build rootfs by running "bitbake <image>"</div>
<div>-</div>
<div>- The -s option is used to skip the build check. The build check is</div>
<div>- a simple sanity check used to determine whether the user has</div>
<div>- sourced the build environment so that the -e option can operate</div>
<div>- correctly. If the user has specified the build artifact locations</div>
<div>- explicitly, 'wic' assumes the user knows what he or she is doing</div>
<div>- and skips the build check.</div>
<div>-</div>
<div>- The -D option is used to display debug information detailing</div>
<div>- exactly what happens behind the scenes when a create request is</div>
<div>- fulfilled (or not, as the case may be). It enumerates and</div>
<div>- displays the command sequence used, and should be included in any</div>
<div>- bug report describing unexpected results.</div>
<div>-</div>
<div>- When 'wic -e' is used, the locations for the build artifacts</div>
<div>- values are determined by 'wic -e' from the output of the 'bitbake</div>
<div>- -e' command given an image name e.g. 'core-image-minimal' and a</div>
<div>- given machine set in local.conf. In that case, the image is</div>
<div>- created as if the following 'bitbake -e' variables were used:</div>
<div>-</div>
<div>- -r: IMAGE_ROOTFS</div>
<div>- -k: STAGING_KERNEL_DIR</div>
<div>- -n: STAGING_DIR_NATIVE</div>
<div>- -b: empty (plugin-specific handlers must determine this)</div>
<div>-</div>
<div>- If 'wic -e' is not used, the user needs to select the appropriate</div>
<div>- value for -b (as well as -r, -k, and -n).</div>
<div>-</div>
<div>- The -o option can be used to place the image in a directory with a</div>
<div>- different name and location.</div>
<div>-</div>
<div>- The -c option is used to specify compressor utility to compress</div>
<div>- an image. gzip, bzip2 and xz compressors are supported.</div>
<div>-</div>
<div>- The -m option is used to produce .bmap file for the image. This file</div>
<div>- can be used to flash image using bmaptool utility.</div>
<div>-</div>
<div>- The --no-fstab-update option is used to doesn't change fstab file. When</div>
<div>- using this option the final fstab file will be same that in rootfs and</div>
<div>- wic doesn't update file, e.g adding a new mount point. User can control</div>
<div>- the fstab file content in base-files recipe.</div>
<div>-"""</div>
<div>-</div>
<div>-wic_list_usage = """</div>
<div>-</div>
<div>- List available OpenEmbedded images and source plugins</div>
<div>-</div>
<div>- usage: wic list images</div>
<div>- wic list <image> help</div>
<div>- wic list source-plugins</div>
<div>-</div>
<div>- This command enumerates the set of available canned images as well as</div>
<div>- help for those images. It also can be used to list of available source</div>
<div>- plugins.</div>
<div>-</div>
<div>- The first form enumerates all the available 'canned' images.</div>
<div>-</div>
<div>- The second form lists the detailed help information for a specific</div>
<div>- 'canned' image.</div>
<div>-</div>
<div>- The third form enumerates all the available --sources (source</div>
<div>- plugins).</div>
<div>-</div>
<div>- See 'wic help list' for more details.</div>
<div>+wic_create_short_description = """</div>
<div>+Create a new OpenEmbedded image.</div>
<div> """</div>
<div> </div>
<div>-wic_list_help = """</div>
<div>-</div>
<div>-NAME</div>
<div>- wic list - List available OpenEmbedded images and source plugins</div>
<div>-</div>
<div>-SYNOPSIS</div>
<div>- wic list images</div>
<div>- wic list <image> help</div>
<div>- wic list source-plugins</div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>- This command enumerates the set of available canned images as well</div>
<div>- as help for those images. It also can be used to list available</div>
<div>- source plugins.</div>
<div>-</div>
<div>- The first form enumerates all the available 'canned' images.</div>
<div>- These are actually just the set of .wks files that have been moved</div>
<div>- into the /scripts/lib/wic/canned-wks directory).</div>
<div>-</div>
<div>- The second form lists the detailed help information for a specific</div>
<div>- 'canned' image.</div>
<div>-</div>
<div>- The third form enumerates all the available --sources (source</div>
<div>- plugins). The contents of a given partition are driven by code</div>
<div>- defined in 'source plugins'. Users specify a specific plugin via</div>
<div>- the --source parameter of the partition .wks command. Normally</div>
<div>- this is the 'rootfs' plugin but can be any of the more specialized</div>
<div>- sources listed by the 'list source-plugins' command. Users can</div>
<div>- also add their own source plugins - see 'wic help plugins' for</div>
<div>- details.</div>
<div>+wic_rm_short_description = """</div>
<div>+Remove files or directories from the vfat or ext* partitions.</div>
<div> """</div>
<div> </div>
<div>-wic_ls_usage = """</div>
<div>-</div>
<div>- List content of a partitioned image</div>
<div>-</div>
<div>- usage: wic ls <image>[:<partition>[<path>]] [--native-sysroot <path>]</div>
<div>-</div>
<div>- This command outputs either list of image partitions or directory contents</div>
<div>- of vfat and ext* partitions.</div>
<div>-</div>
<div>- See 'wic help ls' for more detailed instructions.</div>
<div>-</div>
<div>+wic_write_short_description = """</div>
<div>+Write an image to a device.</div>
<div> """</div>
<div> </div>
<div>-wic_ls_help = """</div>
<div>-</div>
<div>-NAME</div>
<div>- wic ls - List contents of partitioned image or partition</div>
<div>-</div>
<div>-SYNOPSIS</div>
<div>- wic ls <image></div>
<div>- wic ls <image>:<vfat or ext* partition></div>
<div>- wic ls <image>:<vfat or ext* partition><path></div>
<div>- wic ls <image>:<vfat or ext* partition><path> --native-sysroot <path></div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>- This command lists either partitions of the image or directory contents</div>
<div>- of vfat or ext* partitions.</div>
<div>-</div>
<div>- The first form it lists partitions of the image.</div>
<div>- For example:</div>
<div>- $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic</div>
<div>- Num Start End Size Fstype</div>
<div>- 1 1048576 24438783 23390208 fat16</div>
<div>- 2 25165824 50315263 25149440 ext4</div>
<div>-</div>
<div>- Second and third form list directory content of the partition:</div>
<div>- $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1</div>
<div>- Volume in drive : is boot</div>
<div>- Volume Serial Number is 2DF2-5F02</div>
<div>- Directory for ::/</div>
<div>-</div>
<div>- efi <DIR> 2017-05-11 10:54</div>
<div>- startup nsh 26 2017-05-11 10:54</div>
<div>- vmlinuz 6922288 2017-05-11 10:54</div>
<div>- 3 files 6 922 314 bytes</div>
<div>- 15 818 752 bytes free</div>
<div>-</div>
<div>-</div>
<div>- $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1/EFI/boot/</div>
<div>- Volume in drive : is boot</div>
<div>- Volume Serial Number is 2DF2-5F02</div>
<div>- Directory for ::/EFI/boot</div>
<div>-</div>
<div>- . <DIR> 2017-05-11 10:54</div>
<div>- .. <DIR> 2017-05-11 10:54</div>
<div>- grub cfg 679 2017-05-11 10:54</div>
<div>- bootx64 efi 571392 2017-05-11 10:54</div>
<div>- 4 files 572 071 bytes</div>
<div>- 15 818 752 bytes free</div>
<div>-</div>
<div>- The -n option is used to specify the path to the native sysroot</div>
<div>- containing the tools(parted and mtools) to use.</div>
<div>-</div>
<div>-"""</div>
<div>-</div>
<div>-wic_cp_usage = """</div>
<div>-</div>
<div>- Copy files and directories to the vfat or ext* partition</div>
<div>-</div>
<div>- usage: wic cp <src> <image>:<partition>[<path>] [--native-sysroot <path>]</div>
<div>-</div>
<div>- This command copies local files or directories to the vfat or ext* partitions</div>
<div>-of partitioned image.</div>
<div>-</div>
<div>- See 'wic help cp' for more detailed instructions.</div>
<div>-</div>
<div>+wic_cp_short_description = """</div>
<div>+Copy files and directories to the vfat or ext* partitions.</div>
<div> """</div>
<div> </div>
<div>-wic_cp_help = """</div>
<div>-</div>
<div>-NAME</div>
<div>- wic cp - copy files and directories to the vfat or ext* partitions</div>
<div>-</div>
<div>-SYNOPSIS</div>
<div>- wic cp <src> <image>:<partition></div>
<div>- wic cp <src> <image>:<partition><path></div>
<div>- wic cp <src> <image>:<partition><path> --native-sysroot <path></div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>- This command copies files and directories to the vfat or ext* partition of</div>
<div>- the partitioned image.</div>
<div>-</div>
<div>- The first form of it copies file or directory to the root directory of</div>
<div>- the partition:</div>
<div>- $ wic cp test.wks tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1</div>
<div>- $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1</div>
<div>- Volume in drive : is boot</div>
<div>- Volume Serial Number is DB4C-FD4C</div>
<div>- Directory for ::/</div>
<div>-</div>
<div>- efi <DIR> 2017-05-24 18:15</div>
<div>- loader <DIR> 2017-05-24 18:15</div>
<div>- startup nsh 26 2017-05-24 18:15</div>
<div>- vmlinuz 6926384 2017-05-24 18:15</div>
<div>- test wks 628 2017-05-24 21:22</div>
<div>- 5 files 6 927 038 bytes</div>
<div>- 15 677 440 bytes free</div>
<div>-</div>
<div>- The second form of the command copies file or directory to the specified directory</div>
<div>- on the partition:</div>
<div>- $ wic cp test tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1/efi/</div>
<div>- $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1/efi/</div>
<div>- Volume in drive : is boot</div>
<div>- Volume Serial Number is DB4C-FD4C</div>
<div>- Directory for ::/efi</div>
<div>-</div>
<div>- . <DIR> 2017-05-24 18:15</div>
<div>- .. <DIR> 2017-05-24 18:15</div>
<div>- boot <DIR> 2017-05-24 18:15</div>
<div>- test <DIR> 2017-05-24 21:27</div>
<div>- 4 files 0 bytes</div>
<div>- 15 675 392 bytes free</div>
<div>-</div>
<div>- The -n option is used to specify the path to the native sysroot</div>
<div>- containing the tools(parted and mtools) to use.</div>
<div>+wic_ls_short_description = """</div>
<div>+Lists either partitions of the image or directory contents</div>
<div>+of vfat or ext* partitions."""</div>
<div>+wic_help_short_description = """</div>
<div>+sss</div>
<div> """</div>
<div>-</div>
<div>-wic_rm_usage = """</div>
<div>-</div>
<div>- Remove files or directories from the vfat or ext* partitions</div>
<div>-</div>
<div>- usage: wic rm <image>:<partition><path> [--native-sysroot <path>]</div>
<div>-</div>
<div>- This command removes files or directories from the vfat or ext* partitions of</div>
<div>- the partitioned image.</div>
<div>-</div>
<div>- See 'wic help rm' for more detailed instructions.</div>
<div>-</div>
<div>+wic_list_short_description = """</div>
<div>+List available canned images and source plugins</div>
<div> """</div>
<div> </div>
<div>-wic_rm_help = """</div>
<div>+wic_create_description = """</div>
<div>+This command creates an OpenEmbedded image based on the 'OE</div>
<div>+kickstart commands' found in the <wks file>.</div>
<div> </div>
<div>-NAME</div>
<div>- wic rm - remove files or directories from the vfat or ext* partitions</div>
<div>+In order to do this, wic needs to know the locations of the</div>
<div>+various build artifacts required to build the image.</div>
<div> </div>
<div>-SYNOPSIS</div>
<div>- wic rm <src> <image>:<partition><path></div>
<div>- wic rm <src> <image>:<partition><path> --native-sysroot <path></div>
<div>+Users can explicitly specify the build artifact locations using</div>
<div>+the -r, -b, -k, and -n options. See below for details on where</div>
<div>+the corresponding artifacts are typically found in a normal</div>
<div>+OpenEmbedded build.</div>
<div> </div>
<div>-DESCRIPTION</div>
<div>- This command removes files or directories from the vfat or ext* partition of the</div>
<div>- partitioned image:</div>
<div>+Alternatively, users can use the -e option to have 'wic' determine</div>
<div>+those locations for a given image. If the -e option is used, the</div>
<div>+user needs to have set the appropriate MACHINE variable in</div>
<div>+local.conf, and have sourced the build environment.</div>
<div> </div>
<div>- $ wic ls ./tmp/deploy/images/qemux86-<wbr>64/core-image-minimal-qemux86-<wbr>64.wic:1</div>
<div>- Volume in drive : is boot</div>
<div>- Volume Serial Number is 11D0-DE21</div>
<div>- Directory for ::/</div>
<div>+The -s option is used to skip the build check. The build check is</div>
<div>+a simple sanity check used to determine whether the user has</div>
<div>+sourced the build environment so that the -e option can operate</div>
<div>+correctly. If the user has specified the build artifact locations</div>
<div>+explicitly, 'wic' assumes the user knows what he or she is doing</div>
<div>+and skips the build check.</div>
<div> </div>
<div>- libcom32 c32 186500 2017-06-02 15:15</div>
<div>- libutil c32 24148 2017-06-02 15:15</div>
<div>- syslinux cfg 209 2017-06-02 15:15</div>
<div>- vesamenu c32 27104 2017-06-02 15:15</div>
<div>- vmlinuz 6926384 2017-06-02 15:15</div>
<div>- 5 files 7 164 345 bytes</div>
<div>- 16 582 656 bytes free</div>
<div>+When 'wic -e' is used, the locations for the build artifacts</div>
<div>+values are determined by 'wic -e' from the output of the 'bitbake</div>
<div>+-e' command given an image name e.g. 'core-image-minimal' and a</div>
<div>+given machine set in local.conf. In that case, the image is</div>
<div>+created as if the following 'bitbake -e' variables were used:</div>
<div> </div>
<div>- $ wic rm ./tmp/deploy/images/qemux86-<wbr>64/core-image-minimal-qemux86-<wbr>64.wic:1/libutil.c32</div>
<div>+-r: IMAGE_ROOTFS</div>
<div>+-k: STAGING_KERNEL_DIR</div>
<div>+-n: STAGING_DIR_NATIVE</div>
<div>+-b: empty (plugin-specific handlers must determine this)</div>
<div> </div>
<div>- $ wic ls ./tmp/deploy/images/qemux86-<wbr>64/core-image-minimal-qemux86-<wbr>64.wic:1</div>
<div>- Volume in drive : is boot</div>
<div>- Volume Serial Number is 11D0-DE21</div>
<div>- Directory for ::/</div>
<div>+If 'wic -e' is not used, the user needs to select the appropriate</div>
<div>+value for -b (as well as -r, -k, and -n).</div>
<div> </div>
<div>- libcom32 c32 186500 2017-06-02 15:15</div>
<div>- syslinux cfg 209 2017-06-02 15:15</div>
<div>- vesamenu c32 27104 2017-06-02 15:15</div>
<div>- vmlinuz 6926384 2017-06-02 15:15</div>
<div>- 4 files 7 140 197 bytes</div>
<div>- 16 607 232 bytes free</div>
<div>+Here's an example that doesn't take the easy way out and manually</div>
<div>+specifies each build artifact, along with a non-canned .wks file,</div>
<div>+and also uses the -o option to have wic create the output</div>
<div>+somewhere other than the default /var/tmp/wic:</div>
<div> </div>
<div>- The -n option is used to specify the path to the native sysroot</div>
<div>- containing the tools(parted and mtools) to use.</div>
<div>+ $ wic create ./test.wks -o ./out --rootfs-dir</div>
<div>+ tmp/work/qemux86_64-poky-<wbr>linux/core-image-minimal/1.0-<wbr>r0/rootfs</div>
<div>+ --bootimg-dir tmp/sysroots/qemux86-64/usr/<wbr>share</div>
<div>+ --kernel-dir tmp/deploy/images/qemux86-64</div>
<div>+ --native-sysroot tmp/sysroots/x86_64-linux</div>
<div> """</div>
<div> </div>
<div>-wic_write_usage = """</div>
<div> </div>
<div>- Write image to a device</div>
<div>+wic_list_description = """</div>
<div>+This command enumerates the set of available canned images as well</div>
<div>+as help for those images. It also can be used to list available</div>
<div>+source plugins.</div>
<div> </div>
<div>- usage: wic write <image> <target device> [--expand [rules]] [--native-sysroot <path>]</div>
<div>+The first form enumerates all the available 'canned' images.</div>
<div>+These are actually just the set of .wks files that have been moved</div>
<div>+into the /scripts/lib/wic/canned-wks directory).</div>
<div> </div>
<div>- This command writes partitioned image to a target device (USB stick, SD card etc).</div>
<div>-</div>
<div>- See 'wic help write' for more detailed instructions.</div>
<div>+The second form lists the detailed help information for a specific</div>
<div>+'canned' image.</div>
<div> </div>
<div>+The third form enumerates all the available --sources (source</div>
<div>+plugins). The contents of a given partition are driven by code</div>
<div>+defined in 'source plugins'. Users specify a specific plugin via</div>
<div>+the --source parameter of the partition .wks command. Normally</div>
<div>+this is the 'rootfs' plugin but can be any of the more specialized</div>
<div>+sources listed by the 'list source-plugins' command. Users can</div>
<div>+also add their own source plugins - see 'wic help plugins' for</div>
<div>+details.</div>
<div> """</div>
<div> </div>
<div>-wic_write_help = """</div>
<div> </div>
<div>-NAME</div>
<div>- wic write - write an image to a device</div>
<div>+wic_ls_description = """</div>
<div>+This command lists either partitions of the image or directory contents</div>
<div>+of vfat or ext* partitions.</div>
<div> </div>
<div>-SYNOPSIS</div>
<div>- wic write <image> <target></div>
<div>- wic write <image> <target> --expand auto</div>
<div>- wic write <image> <target> --expand 1:100M-2:300M</div>
<div>- wic write <image> <target> --native-sysroot <path></div>
<div>+The first form lists partitions of the image.</div>
<div>+For example:</div>
<div>+ $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic</div>
<div>+ Num Start End Size Fstype</div>
<div>+ 1 1048576 24438783 23390208 fat16</div>
<div>+ 2 25165824 50315263 25149440 ext4</div>
<div> </div>
<div>-DESCRIPTION</div>
<div>- This command writes an image to a target device (USB stick, SD card etc)</div>
<div>+The second form lists directory contents of the first partition:</div>
<div> </div>
<div>- $ wic write ./tmp/deploy/images/qemux86-<wbr>64/core-image-minimal-qemux86-<wbr>64.wic /dev/sdb</div>
<div>+ $ wic ls tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1/EFI/boot/</div>
<div>+ Volume in drive : is boot</div>
<div>+ Volume Serial Number is 2DF2-5F02</div>
<div>+ Directory for ::/EFI/boot</div>
<div> </div>
<div>- The --expand option is used to resize image partitions.</div>
<div>- --expand auto expands partitions to occupy all free space available on the target device.</div>
<div>- It's also possible to specify expansion rules in a format</div>
<div>- <partition>:<size>[-<<wbr>partition>:<size>...] for one or more partitions.</div>
<div>- Specifying size 0 will keep partition unmodified.</div>
<div>- Note: Resizing boot partition can result in non-bootable image for non-EFI images. It is</div>
<div>- recommended to use size 0 for boot partition to keep image bootable.</div>
<div>+ . <DIR> 2017-05-11 10:54</div>
<div>+ .. <DIR> 2017-05-11 10:54</div>
<div>+ grub cfg 679 2017-05-11 10:54</div>
<div>+ bootx64 efi 571392 2017-05-11 10:54</div>
<div>+ 4 files 572 071 bytes</div>
<div>+ 15 818 752 bytes free</div>
<div> </div>
<div>- The --native-sysroot option is used to specify the path to the native sysroot</div>
<div>- containing the tools(parted, resize2fs) to use.</div>
<div> """</div>
<div> </div>
<div>-wic_plugins_help = """</div>
<div>-</div>
<div>-NAME</div>
<div>- wic plugins - Overview and API</div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>- plugins allow wic functionality to be extended and specialized by</div>
<div>- users. This section documents the plugin interface, which is</div>
<div>- currently restricted to 'source' plugins.</div>
<div>-</div>
<div>- 'Source' plugins provide a mechanism to customize various aspects</div>
<div>- of the image generation process in wic, mainly the contents of</div>
<div>- partitions.</div>
<div>-</div>
<div>- Source plugins provide a mechanism for mapping values specified in</div>
<div>- .wks files using the --source keyword to a particular plugin</div>
<div>- implementation that populates a corresponding partition.</div>
<div>-</div>
<div>- A source plugin is created as a subclass of SourcePlugin (see</div>
<div>- scripts/lib/wic/pluginbase.<wbr>py) and the plugin file containing it</div>
<div>- is added to scripts/lib/wic/plugins/<wbr>source/ to make the plugin</div>
<div>- implementation available to the wic implementation.</div>
<div>-</div>
<div>- Source plugins can also be implemented and added by external</div>
<div>- layers - any plugins found in a scripts/lib/wic/plugins/<wbr>source/</div>
<div>- directory in an external layer will also be made available.</div>
<div>-</div>
<div>- When the wic implementation needs to invoke a partition-specific</div>
<div>- implementation, it looks for the plugin that has the same name as</div>
<div>- the --source param given to that partition. For example, if the</div>
<div>- partition is set up like this:</div>
<div>-</div>
<div>- part /boot --source bootimg-pcbios ...</div>
<div>-</div>
<div>- then the methods defined as class members of the plugin having the</div>
<div>- matching bootimg-pcbios .name class member would be used.</div>
<div>-</div>
<div>- To be more concrete, here's the plugin definition that would match</div>
<div>- a '--source bootimg-pcbios' usage, along with an example method</div>
<div>- that would be called by the wic implementation when it needed to</div>
<div>- invoke an implementation-specific partition-preparation function:</div>
<div>-</div>
<div>- class BootimgPcbiosPlugin(<wbr>SourcePlugin):</div>
<div>- name = 'bootimg-pcbios'</div>
<div>+wic_cp_description = """</div>
<div>+This command copies files and directories to the vfat or ext* partition of</div>
<div>+the partitioned image.</div>
<div> </div>
<div>- @classmethod</div>
<div>- def do_prepare_partition(self, part, ...)</div>
<div>-</div>
<div>- If the subclass itself doesn't implement a function, a 'default'</div>
<div>- version in a superclass will be located and used, which is why all</div>
<div>- plugins must be derived from SourcePlugin.</div>
<div>-</div>
<div>- The SourcePlugin class defines the following methods, which is the</div>
<div>- current set of methods that can be implemented/overridden by</div>
<div>- --source plugins. Any methods not implemented by a SourcePlugin</div>
<div>- subclass inherit the implementations present in the SourcePlugin</div>
<div>- class (see the SourcePlugin source for details):</div>
<div>-</div>
<div>- do_prepare_partition()</div>
<div>- Called to do the actual content population for a</div>
<div>- partition. In other words, it 'prepares' the final partition</div>
<div>- image which will be incorporated into the disk image.</div>
<div>-</div>
<div>- do_configure_partition()</div>
<div>- Called before do_prepare_partition(), typically used to</div>
<div>- create custom configuration files for a partition, for</div>
<div>- example syslinux or grub config files.</div>
<div>-</div>
<div>- do_install_disk()</div>
<div>- Called after all partitions have been prepared and assembled</div>
<div>- into a disk image. This provides a hook to allow</div>
<div>- finalization of a disk image, for example to write an MBR to</div>
<div>- it.</div>
<div>-</div>
<div>- do_stage_partition()</div>
<div>- Special content-staging hook called before</div>
<div>- do_prepare_partition(), normally empty.</div>
<div>-</div>
<div>- Typically, a partition will just use the passed-in</div>
<div>- parameters, for example the unmodified value of bootimg_dir.</div>
<div>- In some cases however, things may need to be more tailored.</div>
<div>- As an example, certain files may additionally need to be</div>
<div>- take from bootimg_dir + /boot. This hook allows those files</div>
<div>- to be staged in a customized fashion. Note that</div>
<div>- get_bitbake_var() allows you to access non-standard</div>
<div>- variables that you might want to use for these types of</div>
<div>- situations.</div>
<div>-</div>
<div>- This scheme is extensible - adding more hooks is a simple matter</div>
<div>- of adding more plugin methods to SourcePlugin and derived classes.</div>
<div>- Please see the implementation for details.</div>
<div>+Copies file or directory to the specified directory</div>
<div>+on the partition:</div>
<div>+ $ wic cp test tmp/deploy/images/qemux86-64/<wbr>core-image-minimal-qemux86-64.<wbr>wic:1/efi/</div>
<div> """</div>
<div> </div>
<div>-wic_overview_help = """</div>
<div>-</div>
<div>-NAME</div>
<div>- wic overview - General overview of wic</div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>- The 'wic' command generates partitioned images from existing</div>
<div>- OpenEmbedded build artifacts. Image generation is driven by</div>
<div>- partitioning commands contained in an 'Openembedded kickstart'</div>
<div>- (.wks) file (see 'wic help kickstart') specified either directly</div>
<div>- on the command-line or as one of a selection of canned .wks files</div>
<div>- (see 'wic list images'). When applied to a given set of build</div>
<div>- artifacts, the result is an image or set of images that can be</div>
<div>- directly written onto media and used on a particular system.</div>
<div>-</div>
<div>- The 'wic' command and the infrastructure it's based on is by</div>
<div>- definition incomplete - its purpose is to allow the generation of</div>
<div>- customized images, and as such was designed to be completely</div>
<div>- extensible via a plugin interface (see 'wic help plugins').</div>
<div>-</div>
<div>- Background and Motivation</div>
<div>-</div>
<div>- wic is meant to be a completely independent standalone utility</div>
<div>- that initially provides easier-to-use and more flexible</div>
<div>- replacements for a couple bits of existing functionality in</div>
<div>- oe-core: directdisk.bbclass and mkefidisk.sh. The difference</div>
<div>- between wic and those examples is that with wic the functionality</div>
<div>- of those scripts is implemented by a general-purpose partitioning</div>
<div>- 'language' based on Redhat kickstart syntax).</div>
<div>-</div>
<div>- The initial motivation and design considerations that lead to the</div>
<div>- current tool are described exhaustively in Yocto Bug #3847</div>
<div>- (<a href="https://bugzilla.yoctoproject.org/show_bug.cgi?id=3847" target="_blank">https://bugzilla.<wbr>yoctoproject.org/show_bug.cgi?<wbr>id=3847</a>).</div>
<div>-</div>
<div>- Implementation and Examples</div>
<div>-</div>
<div>- wic can be used in two different modes, depending on how much</div>
<div>- control the user needs in specifying the Openembedded build</div>
<div>- artifacts that will be used in creating the image: 'raw' and</div>
<div>- 'cooked'.</div>
<div>-</div>
<div>- If used in 'raw' mode, artifacts are explicitly specified via</div>
<div>- command-line arguments (see example below).</div>
<div>-</div>
<div>- The more easily usable 'cooked' mode uses the current MACHINE</div>
<div>- setting and a specified image name to automatically locate the</div>
<div>- artifacts used to create the image.</div>
<div>-</div>
<div>- OE kickstart files (.wks) can of course be specified directly on</div>
<div>- the command-line, but the user can also choose from a set of</div>
<div>- 'canned' .wks files available via the 'wic list images' command</div>
<div>- (example below).</div>
<div>-</div>
<div>- In any case, the prerequisite for generating any image is to have</div>
<div>- the build artifacts already available. The below examples assume</div>
<div>- the user has already build a 'core-image-minimal' for a specific</div>
<div>- machine (future versions won't require this redundant step, but</div>
<div>- for now that's typically how build artifacts get generated).</div>
<div>-</div>
<div>- The other prerequisite is to source the build environment:</div>
<div>-</div>
<div>- $ source oe-init-build-env</div>
<div>-</div>
<div>- To start out with, we'll generate an image from one of the canned</div>
<div>- .wks files. The following generates a list of availailable</div>
<div>- images:</div>
<div>-</div>
<div>- $ wic list images</div>
<div>- mkefidisk Create an EFI disk image</div>
<div>- directdisk Create a 'pcbios' direct disk image</div>
<div>-</div>
<div>- You can get more information about any of the available images by</div>
<div>- typing 'wic list xxx help', where 'xxx' is one of the image names:</div>
<div>-</div>
<div>- $ wic list mkefidisk help</div>
<div>-</div>
<div>- Creates a partitioned EFI disk image that the user can directly dd</div>
<div>- to boot media.</div>
<div>-</div>
<div>- At any time, you can get help on the 'wic' command or any</div>
<div>- subcommand (currently 'list' and 'create'). For instance, to get</div>
<div>- the description of 'wic create' command and its parameters:</div>
<div>-</div>
<div>- $ wic create</div>
<div>-</div>
<div>- Usage:</div>
<div>-</div>
<div>- Create a new OpenEmbedded image</div>
<div>-</div>
<div>- usage: wic create <wks file or image name> [-o <DIRNAME> | ...]</div>
<div>- [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]</div>
<div>- [-e | --image-name] [-s, --skip-build-check] [-D, --debug]</div>
<div>- [-r, --rootfs-dir] [-b, --bootimg-dir] [-k, --kernel-dir]</div>
<div>- [-n, --native-sysroot] [-f, --build-rootfs]</div>
<div>-</div>
<div>- This command creates an OpenEmbedded image based on the 'OE</div>
<div>- kickstart commands' found in the <wks file>.</div>
<div>-</div>
<div>- The -o option can be used to place the image in a directory</div>
<div>- with a different name and location.</div>
<div>-</div>
<div>- See 'wic help create' for more detailed instructions.</div>
<div>- ...</div>
<div>-</div>
<div>- As mentioned in the command, you can get even more detailed</div>
<div>- information by adding 'help' to the above:</div>
<div>-</div>
<div>- $ wic help create</div>
<div>-</div>
<div>- So, the easiest way to create an image is to use the -e option</div>
<div>- with a canned .wks file. To use the -e option, you need to</div>
<div>- specify the image used to generate the artifacts and you actually</div>
<div>- need to have the MACHINE used to build them specified in your</div>
<div>- local.conf (these requirements aren't necessary if you aren't</div>
<div>- using the -e options.) Below, we generate a directdisk image,</div>
<div>- pointing the process at the core-image-minimal artifacts for the</div>
<div>- current MACHINE:</div>
<div>-</div>
<div>- $ wic create directdisk -e core-image-minimal</div>
<div>-</div>
<div>- Checking basic build environment...</div>
<div>- Done.</div>
<div>-</div>
<div>- Creating image(s)...</div>
<div>-</div>
<div>- Info: The new image(s) can be found here:</div>
<div>- /var/tmp/wic/build/<wbr>directdisk-201309252350-sda.<wbr>direct</div>
<div>-</div>
<div>- The following build artifacts were used to create the image(s):</div>
<div>-</div>
<div>- ROOTFS_DIR: ...</div>
<div>- BOOTIMG_DIR: ...</div>
<div>- KERNEL_DIR: ...</div>
<div>- NATIVE_SYSROOT: ...</div>
<div>-</div>
<div>- The image(s) were created using OE kickstart file:</div>
<div>- .../scripts/lib/wic/canned-<wbr>wks/directdisk.wks</div>
<div>-</div>
<div>- The output shows the name and location of the image created, and</div>
<div>- so that you know exactly what was used to generate the image, each</div>
<div>- of the artifacts and the kickstart file used.</div>
<div>-</div>
<div>- Similarly, you can create a 'mkefidisk' image in the same way</div>
<div>- (notice that this example uses a different machine - because it's</div>
<div>- using the -e option, you need to change the MACHINE in your</div>
<div>- local.conf):</div>
<div>-</div>
<div>- $ wic create mkefidisk -e core-image-minimal</div>
<div>- Checking basic build environment...</div>
<div>- Done.</div>
<div>-</div>
<div>- Creating image(s)...</div>
<div>-</div>
<div>- Info: The new image(s) can be found here:</div>
<div>- /var/tmp/wic/build/mkefidisk-<wbr>201309260027-sda.direct</div>
<div>-</div>
<div>- ...</div>
<div>-</div>
<div>- Here's an example that doesn't take the easy way out and manually</div>
<div>- specifies each build artifact, along with a non-canned .wks file,</div>
<div>- and also uses the -o option to have wic create the output</div>
<div>- somewhere other than the default /var/tmp/wic:</div>
<div>-</div>
<div>- $ wic create ./test.wks -o ./out --rootfs-dir</div>
<div>- tmp/work/qemux86_64-poky-<wbr>linux/core-image-minimal/1.0-<wbr>r0/rootfs</div>
<div>- --bootimg-dir tmp/sysroots/qemux86-64/usr/<wbr>share</div>
<div>- --kernel-dir tmp/deploy/images/qemux86-64</div>
<div>- --native-sysroot tmp/sysroots/x86_64-linux</div>
<div>-</div>
<div>- Creating image(s)...</div>
<div>-</div>
<div>- Info: The new image(s) can be found here:</div>
<div>- out/build/test-201507211313-<wbr>sda.direct</div>
<div>-</div>
<div>- The following build artifacts were used to create the image(s):</div>
<div>- ROOTFS_DIR: tmp/work/qemux86_64-poky-<wbr>linux/core-image-minimal/1.0-<wbr>r0/rootfs</div>
<div>- BOOTIMG_DIR: tmp/sysroots/qemux86-64/usr/<wbr>share</div>
<div>- KERNEL_DIR: tmp/deploy/images/qemux86-64</div>
<div>- NATIVE_SYSROOT: tmp/sysroots/x86_64-linux</div>
<div>-</div>
<div>- The image(s) were created using OE kickstart file:</div>
<div>- ./test.wks</div>
<div>-</div>
<div>- Here is a content of test.wks:</div>
<div> </div>
<div>- part /boot --source bootimg-pcbios --ondisk sda --label boot --active --align 1024</div>
<div>- part / --source rootfs --ondisk sda --fstype=ext3 --label platform --align 1024</div>
<div>+wic_rm_description = """</div>
<div>+This command removes files or directories from the vfat or ext* partition of the</div>
<div>+partitioned image: wic rm <wic image>:<partition><path> </div>
<div> </div>
<div>- bootloader --timeout=0 --append="rootwait rootfstype=ext3 video=vesafb vga=0x318 console=tty0"</div>
<div>+$wic rm ./tmp/deploy/images/qemux86-<wbr>64/core-image-minimal-qemux86-<wbr>64.wic:1/libutil.c32 </div>
<div> </div>
<div>-</div>
<div>- Finally, here's an example of the actual partition language</div>
<div>- commands used to generate the mkefidisk image i.e. these are the</div>
<div>- contents of the mkefidisk.wks OE kickstart file:</div>
<div>-</div>
<div>- # short-description: Create an EFI disk image</div>
<div>- # long-description: Creates a partitioned EFI disk image that the user</div>
<div>- # can directly dd to boot media.</div>
<div>-</div>
<div>- part /boot --source bootimg-efi --ondisk sda --fstype=efi --active</div>
<div>-</div>
<div>- part / --source rootfs --ondisk sda --fstype=ext3 --label platform</div>
<div>-</div>
<div>- part swap --ondisk sda --size 44 --label swap1 --fstype=swap</div>
<div>-</div>
<div>- bootloader --timeout=10 --append="rootwait console=ttyPCH0,115200"</div>
<div>-</div>
<div>- You can get a complete listing and description of all the</div>
<div>- kickstart commands available for use in .wks files from 'wic help</div>
<div>- kickstart'.</div>
<div> """</div>
<div> </div>
<div>-wic_kickstart_help = """</div>
<div>-</div>
<div>-NAME</div>
<div>- wic kickstart - wic kickstart reference</div>
<div>-</div>
<div>-DESCRIPTION</div>
<div>- This section provides the definitive reference to the wic</div>
<div>- kickstart language. It also provides documentation on the list of</div>
<div>- --source plugins available for use from the 'part' command (see</div>
<div>- the 'Platform-specific Plugins' section below).</div>
<div>-</div>
<div>- The current wic implementation supports only the basic kickstart</div>
<div>- partitioning commands: partition (or part for short) and</div>
<div>- bootloader.</div>
<div>-</div>
<div>- The following is a listing of the commands, their syntax, and</div>
<div>- meanings. The commands are based on the Fedora kickstart</div>
<div>- documentation but with modifications to reflect wic capabilities.</div>
<div>-</div>
<div>- <a href="http://fedoraproject.org/wiki/Anaconda/Kickstart#part_or_partition" target="_blank">http://fedoraproject.org/<wbr>wiki/Anaconda/Kickstart#part_<wbr>or_partition</a></div>
<div>- <a href="http://fedoraproject.org/wiki/Anaconda/Kickstart#bootloader" target="_blank">http://fedoraproject.org/<wbr>wiki/Anaconda/Kickstart#<wbr>bootloader</a></div>
<div>-</div>
<div>- Commands</div>
<div>-</div>
<div>- * 'part' or 'partition'</div>
<div>-</div>
<div>- This command creates a partition on the system and uses the</div>
<div>- following syntax:</div>
<div>-</div>
<div>- part [<mountpoint>]</div>
<div>-</div>
<div>- The <mountpoint> is where the partition will be mounted and</div>
<div>- must take of one of the following forms:</div>
<div>-</div>
<div>- /<path>: For example: /, /usr, or /home</div>
<div>-</div>
<div>- swap: The partition will be used as swap space.</div>
<div>-</div>
<div>- If a <mountpoint> is not specified the partition will be created</div>
<div>- but will not be mounted.</div>
<div>-</div>
<div>- Partitions with a <mountpoint> specified will be automatically mounted.</div>
<div>- This is achieved by wic adding entries to the fstab during image</div>
<div>- generation. In order for a valid fstab to be generated one of the</div>
<div>- --ondrive, --ondisk or --use-uuid partition options must be used for</div>
<div>- each partition that specifies a mountpoint.</div>
<div>-</div>
<div>-</div>
<div>- The following are supported 'part' options:</div>
<div>-</div>
<div>- --size: The minimum partition size. Specify an integer value</div>
<div>- such as 500. Multipliers k, M ang G can be used. If</div>
<div>- not specified, the size is in MB.</div>
<div>- You do not need this option if you use --source.</div>
<div>-</div>
<div>- --fixed-size: Exact partition size. Value format is the same</div>
<div>- as for --size option. This option cannot be</div>
<div>- specified along with --size. If partition data</div>
<div>- is larger than --fixed-size and error will be</div>
<div>- raised when assembling disk image.</div>
<div>-</div>
<div>- --source: This option is a wic-specific option that names the</div>
<div>- source of the data that will populate the</div>
<div>- partition. The most common value for this option</div>
<div>- is 'rootfs', but can be any value which maps to a</div>
<div>- valid 'source plugin' (see 'wic help plugins').</div>
<div>-</div>
<div>- If '--source rootfs' is used, it tells the wic</div>
<div>- command to create a partition as large as needed</div>
<div>- and to fill it with the contents of the root</div>
<div>- filesystem pointed to by the '-r' wic command-line</div>
<div>- option (or the equivalent rootfs derived from the</div>
<div>- '-e' command-line option). The filesystem type</div>
<div>- that will be used to create the partition is driven</div>
<div>- by the value of the --fstype option specified for</div>
<div>- the partition (see --fstype below).</div>
<div>-</div>
<div>- If --source <plugin-name>' is used, it tells the</div>
<div>- wic command to create a partition as large as</div>
<div>- needed and to fill with the contents of the</div>
<div>- partition that will be generated by the specified</div>
<div>- plugin name using the data pointed to by the '-r'</div>
<div>- wic command-line option (or the equivalent rootfs</div>
<div>- derived from the '-e' command-line option).</div>
<div>- Exactly what those contents and filesystem type end</div>
<div>- up being are dependent on the given plugin</div>
<div>- implementation.</div>
<div>-</div>
<div>- If --source option is not used, the wic command</div>
<div>- will create empty partition. --size parameter has</div>
<div>- to be used to specify size of empty partition.</div>
<div>+wic_write_description = """</div>
<div>+This command writes an image to a target device (USB stick, SD card etc)</div>
<div> </div>
<div>- --ondisk or --ondrive: Forces the partition to be created on</div>
<div>- a particular disk.</div>
<div>-</div>
<div>- --fstype: Sets the file system type for the partition. These</div>
<div>- apply to partitions created using '--source rootfs' (see</div>
<div>- --source above). Valid values are:</div>
<div>-</div>
<div>- vfat</div>
<div>- msdos</div>
<div>- ext2</div>
<div>- ext3</div>
<div>- ext4</div>
<div>- btrfs</div>
<div>- squashfs</div>
<div>- swap</div>
<div>-</div>
<div>- --fsoptions: Specifies a free-form string of options to be</div>
<div>- used when mounting the filesystem. This string</div>
<div>- will be copied into the /etc/fstab file of the</div>
<div>- installed system and should be enclosed in</div>
<div>- quotes. If not specified, the default string is</div>
<div>- "defaults".</div>
<div>-</div>
<div>- --label label: Specifies the label to give to the filesystem</div>
<div>- to be made on the partition. If the given</div>
<div>- label is already in use by another filesystem,</div>
<div>- a new label is created for the partition.</div>
<div>-</div>
<div>- --active: Marks the partition as active.</div>
<div>-</div>
<div>- --align (in KBytes): This option is specific to wic and says</div>
<div>- to start a partition on an x KBytes</div>
<div>- boundary.</div>
<div>-</div>
<div>- --no-table: This option is specific to wic. Space will be</div>
<div>- reserved for the partition and it will be</div>
<div>- populated but it will not be added to the</div>
<div>- partition table. It may be useful for</div>
<div>- bootloaders.</div>
<div>-</div>
<div>- --exclude-path: This option is specific to wic. It excludes the given</div>
<div>- relative path from the resulting image. If the path</div>
<div>- ends with a slash, only the content of the directory</div>
<div>- is omitted, not the directory itself. This option only</div>
<div>- has an effect with the rootfs source plugin.</div>
<div>-</div>
<div>- --extra-space: This option is specific to wic. It adds extra</div>
<div>- space after the space filled by the content</div>
<div>- of the partition. The final size can go</div>
<div>- beyond the size specified by --size.</div>
<div>- By default, 10MB. This option cannot be used</div>
<div>- with --fixed-size option.</div>
<div>-</div>
<div>- --overhead-factor: This option is specific to wic. The</div>
<div>- size of the partition is multiplied by</div>
<div>- this factor. It has to be greater than or</div>
<div>- equal to 1. The default value is 1.3.</div>
<div>- This option cannot be used with --fixed-size</div>
<div>- option.</div>
<div>-</div>
<div>- --part-name: This option is specific to wic. It specifies name for GPT partitions.</div>
<div>-</div>
<div>- --part-type: This option is specific to wic. It specifies partition</div>
<div>- type GUID for GPT partitions.</div>
<div>- List of partition type GUIDS can be found here:</div>
<div>- <a href="http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs" target="_blank">http://en.wikipedia.org/wiki/<wbr>GUID_Partition_Table#<wbr>Partition_type_GUIDs</a></div>
<div>-</div>
<div>- --use-uuid: This option is specific to wic. It makes wic to generate</div>
<div>- random globally unique identifier (GUID) for the partition</div>
<div>- and use it in bootloader configuration to specify root partition.</div>
<div>-</div>
<div>- --uuid: This option is specific to wic. It specifies partition UUID.</div>
<div>- It's useful if preconfigured partition UUID is added to kernel command line</div>
<div>- in bootloader configuration before running wic. In this case .wks file can</div>
<div>- be generated or modified to set preconfigured parition UUID using this option.</div>
<div>-</div>
<div>- --system-id: This option is specific to wic. It specifies partition system id. It's useful</div>
<div>- for the harware that requires non-default partition system ids. The parameter</div>
<div>- in one byte long hex number either with 0x prefix or without it.</div>
<div>-</div>
<div>- --mkfs-extraopts: This option specifies extra options to pass to mkfs utility.</div>
<div>- NOTE, that wic uses default options for some filesystems, for example</div>
<div>- '-S 512' for mkfs.fat or '-F -i 8192' for mkfs.ext. Those options will</div>
<div>- not take effect when --mkfs-extraopts is used. This should be taken into</div>
<div>- account when using --mkfs-extraopts.</div>
<div>-</div>
<div>- * bootloader</div>
<div>-</div>
<div>- This command allows the user to specify various bootloader</div>
<div>- options. The following are supported 'bootloader' options:</div>
<div>-</div>
<div>- --timeout: Specifies the number of seconds before the</div>
<div>- bootloader times out and boots the default option.</div>
<div>-</div>
<div>- --append: Specifies kernel parameters. These will be added to</div>
<div>- bootloader command-line - for example, the syslinux</div>
<div>- APPEND or grub kernel command line.</div>
<div>-</div>
<div>- --configfile: Specifies a user defined configuration file for</div>
<div>- the bootloader. This file must be located in the</div>
<div>- canned-wks folder or could be the full path to the</div>
<div>- file. Using this option will override any other</div>
<div>- bootloader option.</div>
<div>-</div>
<div>- Note that bootloader functionality and boot partitions are</div>
<div>- implemented by the various --source plugins that implement</div>
<div>- bootloader functionality; the bootloader command essentially</div>
<div>- provides a means of modifying bootloader configuration.</div>
<div>-</div>
<div>- * include</div>
<div>-</div>
<div>- This command allows the user to include the content of .wks file</div>
<div>- into original .wks file.</div>
<div>-</div>
<div>- Command uses the following syntax:</div>
<div>-</div>
<div>- include <file></div>
<div>-</div>
<div>- The <file> is either path to the file or its name. If name is</div>
<div>- specified wic will try to find file in the directories with canned</div>
<div>- .wks files.</div>
<div>-</div>
<div>-"""</div>
<div>+ $ wic write ./tmp/deploy/images/qemux86-<wbr>64/core-image-minimal-qemux86-<wbr>64.wic /dev/sdb</div>
<div> </div>
<div>-wic_help_help = """</div>
<div>-NAME</div>
<div>- wic help - display a help topic</div>
<div>+The --expand option is used to resize image partitions.</div>
<div>+--expand auto expands partitions to occupy all free space available on the target device.</div>
<div>+It's also possible to specify expansion rules in a format</div>
<div>+<partition>:<size>[-<<wbr>partition>:<size>...] for one or more partitions.</div>
<div>+Specifying size 0 will keep partition unmodified.</div>
<div>+Note: Resizing boot partition can result in non-bootable image for non-EFI images. It is</div>
<div>+recommended to use size 0 for boot partition to keep image bootable.</div>
<div> </div>
<div>-DESCRIPTION</div>
<div>- Specify a help topic to display it. Topics are shown above.</div>
<div> """</div>
<div>diff --git a/scripts/wic b/scripts/wic</div>
<div>index 097084a..cb348e3 100755</div>
<div>--- a/scripts/wic</div>
<div>+++ b/scripts/wic</div>
<div>@@ -106,7 +106,7 @@ class RootfsArgAction(argparse.<wbr>Action):</div>
<div> namespace.__dict__['rootfs_<wbr>dir'][key] = rootfs_dir</div>
<div> </div>
<div> </div>
<div>-def wic_create_subcommand(options, usage_str):</div>
<div>+def wic_create_subcommand(options)<wbr>:</div>
<div> """</div>
<div> Command-line handling for image creation. The real work is done</div>
<div> by image.engine.wic_create()</div>
<div>@@ -177,7 +177,7 @@ def wic_create_subcommand(options, usage_str):</div>
<div> wks_file = options.wks_file</div>
<div> </div>
<div> if not wks_file.endswith(".wks"):</div>
<div>- wks_file = engine.find_canned_image(<wbr>scripts_path, wks_file)</div>
<div>+ wks_file = engine.find_canned_image(wks_<wbr>file)</div>
<div> if not wks_file:</div>
<div> raise WicError("No image named %s found, exiting. (Use 'wic list images' "</div>
<div> "to list available images, or specify a fully-qualified OE "</div>
<div>@@ -227,91 +227,44 @@ def wic_create_subcommand(options, usage_str):</div>
<div> native_sysroot, options)</div>
<div> </div>
<div> </div>
<div>-def wic_list_subcommand(args, usage_str):</div>
<div>+def wic_list_subcommand(args):</div>
<div> """</div>
<div> Command-line handling for listing available images.</div>
<div> The real work is done by image.engine.wic_list()</div>
<div> """</div>
<div>- if not engine.wic_list(args, scripts_path):</div>
<div>+ if not engine.wic_list(scripts_path, args):</div>
<div> raise WicError("Bad list arguments, exiting")</div>
<div> </div>
<div> </div>
<div>-def wic_ls_subcommand(args, usage_str):</div>
<div>+def wic_ls_subcommand(args):</div>
<div> """</div>
<div> Command-line handling for list content of images.</div>
<div> The real work is done by engine.wic_ls()</div>
<div> """</div>
<div> engine.wic_ls(args, args.native_sysroot)</div>
<div> </div>
<div>-def wic_cp_subcommand(args, usage_str):</div>
<div>+def wic_cp_subcommand(args):</div>
<div> """</div>
<div> Command-line handling for copying files/dirs to images.</div>
<div> The real work is done by engine.wic_cp()</div>
<div> """</div>
<div> engine.wic_cp(args, args.native_sysroot)</div>
<div> </div>
<div>-def wic_rm_subcommand(args, usage_str):</div>
<div>+def wic_rm_subcommand(args):</div>
<div> """</div>
<div> Command-line handling for removing files/dirs from images.</div>
<div> The real work is done by engine.wic_rm()</div>
<div> """</div>
<div> engine.wic_rm(args, args.native_sysroot)</div>
<div> </div>
<div>-def wic_write_subcommand(args, usage_str):</div>
<div>+def wic_write_subcommand(args):</div>
<div> """</div>
<div> Command-line handling for writing images.</div>
<div> The real work is done by engine.wic_write()</div>
<div> """</div>
<div> engine.wic_write(args, args.native_sysroot)</div>
<div> </div>
<div>-def wic_help_subcommand(args, usage_str):</div>
<div>- """</div>
<div>- Command-line handling for help subcommand to keep the current</div>
<div>- structure of the function definitions.</div>
<div>- """</div>
<div>- pass</div>
<div>-</div>
<div> </div>
<div>-def wic_help_topic_subcommand(<wbr>usage_str, help_str):</div>
<div>- """</div>
<div>- Display function for help 'sub-subcommands'.</div>
<div>- """</div>
<div>- print(help_str)</div>
<div>- return</div>
<div>-</div>
<div>-</div>
<div>-wic_help_topic_usage = """</div>
<div>-"""</div>
<div>-</div>
<div>-helptopics = {</div>
<div>- "plugins": [wic_help_topic_subcommand,</div>
<div>- wic_help_topic_usage,</div>
<div>- hlp.wic_plugins_help],</div>
<div>- "overview": [wic_help_topic_subcommand,</div>
<div>- wic_help_topic_usage,</div>
<div>- hlp.wic_overview_help],</div>
<div>- "kickstart": [wic_help_topic_subcommand,</div>
<div>- wic_help_topic_usage,</div>
<div>- hlp.wic_kickstart_help],</div>
<div>- "create": [wic_help_topic_subcommand,</div>
<div>- wic_help_topic_usage,</div>
<div>- hlp.wic_create_help],</div>
<div>- "ls": [wic_help_topic_subcommand,</div>
<div>- wic_help_topic_usage,</div>
<div>- hlp.wic_ls_help],</div>
<div>- "cp": [wic_help_topic_subcommand,</div>
<div>- wic_help_topic_usage,</div>
<div>- hlp.wic_cp_help],</div>
<div>- "rm": [wic_help_topic_subcommand,</div>
<div>- wic_help_topic_usage,</div>
<div>- hlp.wic_rm_help],</div>
<div>- "write": [wic_help_topic_subcommand,</div>
<div>- wic_help_topic_usage,</div>
<div>- hlp.wic_write_help],</div>
<div>- "list": [wic_help_topic_subcommand,</div>
<div>- wic_help_topic_usage,</div>
<div>- hlp.wic_list_help]</div>
<div>-}</div>
<div> </div>
<div> </div>
<div> def wic_init_parser_create(<wbr>subparser):</div>
<div>@@ -333,17 +286,15 @@ def wic_init_parser_create(<wbr>subparser):</div>
<div> help="path to the dir containing the kernel to use "</div>
<div> "in the .wks bootimg")</div>
<div> subparser.add_argument("-n", "--native-sysroot", dest="native_sysroot",</div>
<div>- help="path to the native sysroot containing the tools "</div>
<div>- "to use to build the image")</div>
<div>+ help="path to the native sysroot containing the tools (parted and mtools) to use.")</div>
<div> subparser.add_argument("-s", "--skip-build-check", dest="build_check",</div>
<div> action="store_false", default=True, help="skip the build check")</div>
<div> subparser.add_argument("-f", "--build-rootfs", action="store_true", help="build rootfs")</div>
<div> subparser.add_argument("-c", "--compress-with", choices=("gzip", "bzip2", "xz"),</div>
<div> dest='compressor',</div>
<div> help="compress image with specified compressor")</div>
<div>- subparser.add_argument("-m", "--bmap", action="store_true", help="generate .bmap")</div>
<div>- subparser.add_argument("--no-<wbr>fstab-update" ,action="store_true",</div>
<div>- help="Do not change fstab file.")</div>
<div>+ subparser.add_argument("-m", "--bmap", action="store_true", help="used to produce .bmap file for the image."</div>
<div>+ "This file can be used to flash image using bmaptool utility")</div>
<div> subparser.add_argument("-v", "--vars", dest='vars_dir',</div>
<div> help="directory with <image>.env files that store "</div>
<div> "bitbake variables")</div>
<div>@@ -357,10 +308,10 @@ def wic_init_parser_list(<wbr>subparser):</div>
<div> help="can be 'images' or 'source-plugins' "</div>
<div> "to obtain a list. "</div>
<div> "If value is a valid .wks image file")</div>
<div>- subparser.add_argument("help_<wbr>for", default=[], nargs='*',</div>
<div>+ subparser.add_argument("info_<wbr>for", default=[], nargs='*',</div>
<div> help="If 'list_type' is a valid .wks image file "</div>
<div>- "this value can be 'help' to show the help information "</div>
<div>- "defined inside the .wks file")</div>
<div>+ "this value can be 'info' to show the image or plugin information ")</div>
<div>+</div>
<div> return</div>
<div> </div>
<div> def imgtype(arg):</div>
<div>@@ -385,9 +336,9 @@ def imgtype(arg):</div>
<div> </div>
<div> def wic_init_parser_ls(subparser):</div>
<div> subparser.add_argument("path"<wbr>, type=imgtype,</div>
<div>- help="image spec: <image>[:<vfat partition>[<path>]]")</div>
<div>+ help="image spec: <image>[:<partition>[<path>]]"<wbr>)</div>
<div> subparser.add_argument("-n", "--native-sysroot",</div>
<div>- help="path to the native sysroot containing the tools")</div>
<div>+ help="path to the native sysroot containing the tools (parted and mtools) to use.")</div>
<div> </div>
<div> def imgpathtype(arg):</div>
<div> img = imgtype(arg)</div>
<div>@@ -399,15 +350,15 @@ def wic_init_parser_cp(subparser):</div>
<div> subparser.add_argument("src",</div>
<div> help="source spec")</div>
<div> subparser.add_argument("dest"<wbr>, type=imgpathtype,</div>
<div>- help="image spec: <image>:<vfat partition>[<path>]")</div>
<div>+ help="image spec: <image>:<partition>[<path>]")</div>
<div> subparser.add_argument("-n", "--native-sysroot",</div>
<div>- help="path to the native sysroot containing the tools")</div>
<div>+ help="path to the native sysroot containing the tools (parted and mtools) to use.")</div>
<div> </div>
<div> def wic_init_parser_rm(subparser):</div>
<div> subparser.add_argument("path"<wbr>, type=imgpathtype,</div>
<div>- help="path: <image>:<vfat partition><path>")</div>
<div>+ help="image spec: <image>[:<partition>[<path>]")</div>
<div> subparser.add_argument("-n", "--native-sysroot",</div>
<div>- help="path to the native sysroot containing the tools")</div>
<div>+ help="path to the native sysroot containing the tools (parted and mtools) to use.")</div>
<div> </div>
<div> def expandtype(rules):</div>
<div> """</div>
<div>@@ -448,59 +399,56 @@ def wic_init_parser_write(<wbr>subparser):</div>
<div> subparser.add_argument("-e", "--expand", type=expandtype,</div>
<div> help="expand rules: auto or <partition>:<size>[,<<wbr>partition>:<size>]")</div>
<div> subparser.add_argument("-n", "--native-sysroot",</div>
<div>- help="path to the native sysroot containing the tools")</div>
<div>-</div>
<div>-def wic_init_parser_help(<wbr>subparser):</div>
<div>- helpparsers = subparser.add_subparsers(dest=<wbr>'help_topic', help=hlp.wic_usage)</div>
<div>- for helptopic in helptopics:</div>
<div>- helpparsers.add_parser(<wbr>helptopic, help=helptopics[helptopic][2])</div>
<div>- return</div>
<div>+ help="path to the native sysroot containing the tools (parted and mtools) to use.")</div>
<div> </div>
<div> </div>
<div> subcommands = {</div>
<div> "create": [wic_create_subcommand,</div>
<div>- hlp.wic_create_usage,</div>
<div>- hlp.wic_create_help,</div>
<div>- wic_init_parser_create],</div>
<div>+ hlp.wic_create_description,</div>
<div>+ wic_init_parser_create,</div>
<div>+ hlp.wic_create_short_<wbr>description],</div>
<div> "list": [wic_list_subcommand,</div>
<div>- hlp.wic_list_usage,</div>
<div>- hlp.wic_list_help,</div>
<div>- wic_init_parser_list],</div>
<div>+ hlp.wic_list_description,</div>
<div>+ wic_init_parser_list,</div>
<div>+ hlp.wic_list_short_<wbr>description],</div>
<div> "ls": [wic_ls_subcommand,</div>
<div>- hlp.wic_ls_usage,</div>
<div>- hlp.wic_ls_help,</div>
<div>- wic_init_parser_ls],</div>
<div>+ hlp.wic_ls_description,</div>
<div>+ wic_init_parser_ls,</div>
<div>+ hlp.wic_ls_short_description]<wbr>,</div>
<div> "cp": [wic_cp_subcommand,</div>
<div>- hlp.wic_cp_usage,</div>
<div>- hlp.wic_cp_help,</div>
<div>- wic_init_parser_cp],</div>
<div>+ hlp.wic_cp_description,</div>
<div>+ wic_init_parser_cp,</div>
<div>+ hlp.wic_cp_short_description]<wbr>,</div>
<div> "rm": [wic_rm_subcommand,</div>
<div>- hlp.wic_rm_usage,</div>
<div>- hlp.wic_rm_help,</div>
<div>- wic_init_parser_rm],</div>
<div>+ hlp.wic_rm_description,</div>
<div>+ wic_init_parser_rm,</div>
<div>+ hlp.wic_rm_short_description]<wbr>,</div>
<div> "write": [wic_write_subcommand,</div>
<div>- hlp.wic_write_usage,</div>
<div>- hlp.wic_write_help,</div>
<div>- wic_init_parser_write],</div>
<div>- "help": [wic_help_subcommand,</div>
<div>- wic_help_topic_usage,</div>
<div>- hlp.wic_help_help,</div>
<div>- wic_init_parser_help]</div>
<div>+ hlp.wic_write_description,</div>
<div>+ wic_init_parser_write,</div>
<div>+ hlp.wic_write_short_<wbr>description],</div>
<div> }</div>
<div> </div>
<div>+def invoke_subcommand(args, parser, main_command_usage, subcommands):</div>
<div>+ subcmd = subcommands.get(args.command, subcommand_error)</div>
<div>+ usage = subcmd[1]</div>
<div>+ subcmd[0](args, usage)</div>
<div>+</div>
<div> </div>
<div> def init_parser(parser):</div>
<div> parser.add_argument("--<wbr>version", action="version",</div>
<div> version="%(prog)s {version}".format(version=__<wbr>version__))</div>
<div>- subparsers = parser.add_subparsers(dest='<wbr>command', help=hlp.wic_usage)</div>
<div>+ subparsers = parser.add_subparsers(dest='<wbr>command')</div>
<div>+ helpparser = subparsers.add_parser("help", help="Display usages")</div>
<div> for subcmd in subcommands:</div>
<div>- subparser = subparsers.add_parser(subcmd, help=subcommands[subcmd][2])</div>
<div>- subcommands[subcmd][3](<wbr>subparser)</div>
<div>+ subparser = subparsers.add_parser(subcmd, help=subcommands[subcmd][3], formatter_class=argparse.<wbr>RawDescriptionHelpFormatter, description=subcommands[<wbr>subcmd][1])</div>
<div>+ subcommands[subcmd][2](<wbr>subparser)</div>
<div>+</div>
<div> </div>
<div> </div>
<div> def main(argv):</div>
<div> parser = argparse.ArgumentParser(</div>
<div>- description="wic version %s" % __version__)</div>
<div>+ description="Create a customized OpenEmbedded image. Wic version %s" % __version__)</div>
<div> </div>
<div> init_parser(parser)</div>
<div> </div>
<div>@@ -508,22 +456,15 @@ def main(argv):</div>
<div> </div>
<div> if "command" in vars(args):</div>
<div> if args.command == "help":</div>
<div>- if args.help_topic is None:</div>
<div>- parser.print_help()</div>
<div>- print()</div>
<div>- print("Please specify a help topic")</div>
<div>- elif args.help_topic in helptopics:</div>
<div>- hlpt = helptopics[args.help_topic]</div>
<div>- hlpt[0](hlpt[1], hlpt[2])</div>
<div>- return 0</div>
<div>-</div>
<div>- return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands)</div>
<div>-</div>
<div>+ parser.print_help()</div>
<div>+ print()</div>
<div>+ else:</div>
<div>+ subcmd = subcommands.get(args.command)</div>
<div>+ subcmd[0](args)</div>
<div> </div>
<div> if __name__ == "__main__":</div>
<div> try:</div>
<div> sys.exit(main(sys.argv[1:]))</div>
<div> except WicError as err:</div>
<div>- print()</div>
<div> logger.error(err)</div>
<div> sys.exit(1)</div><span class="HOEnZb"><font color="#888888">
<div>-- </div>
<div>2.7.4</div>
<div><br>
</div>
</font></span></div>
<div>
<div id="m_4720050032115839289MAC_OUTLOOK_SIGNATURE"></div>
</div>
</div>
<br>--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
<br></blockquote></div><br></div>