[OE-core] [wic patch 0/5] Add option to wic and use argparse

Andreas J. Reichel andreas.reichel at tngtech.com
Fri Apr 21 12:11:40 UTC 2017


This series consists of the following changes to wic:

    * wic previously introduced deletion of all single partition
        image files. In some cases, this deletion can fail, however
        this is no reason for wic to fail. Thus, exception handling
        was added to the clean-up function of the direct imager
        plugin.
    
    * wic uses optparse and a rather complicated approach of its
        initialization. It is much easier to switch from the
        deprecated optparse to the argparse library, which also
        supports sub-commands, which wic heavily makes use of.
        The second patch replaces optparse by argparse.

    * For some embedded projects it is necessary to keep the single
        partition image files to further process them. This is
        the case if a user has no rights to mount and cannot extract
        the images from the already merged .direct file, for example.

        For this purpose, a new option is introduced:

            -P, --keep-partition-images

        which prevents deletion of .p* files created by the direct
        imager plugin.

    * Maintainability improvement in engine.py by comparing parameters
        with enum-like string constants rather than repeating the
        strings and fixes in help texts.

The new argument parser was tested with random sampling manually, since
variable names were not changed inside the core of the subcommands and
transition from optparse to argparse is straight forward regarding access
to argument values.

Signed-off-by: Andreas Reichel <andreas.reichel.ext at siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
Signed-off-by: Daniel Wagner <daniel.wagner at siemens.com>

Reichel Andreas (5):
  wic: Catch errors during image files clean-up
  wic: Use argparse instead of optparse
  wic: Add missing text to usage and help strings
  wic: Add option to keep partition images
  wic: Use enum like dicts for string constants

 scripts/lib/wic/engine.py                |  21 ++-
 scripts/lib/wic/help.py                  |  30 +++--
 scripts/lib/wic/plugins/imager/direct.py |  23 +++-
 scripts/wic                              | 215 +++++++++++++++++++------------
 4 files changed, 191 insertions(+), 98 deletions(-)

-- 
2.11.0



More information about the Openembedded-core mailing list