wic: argparse now used for help functionality.
cover wic: argparse now used for help functionality.
The wic help output formally consisted of manually created strings mixed with argparse, which wasunformatted and unusable. This fix cleans up the help messages, rewrites help functionality to use argparse, and adds functionality to show information for plugins (similar to canned images).
Fixes [YOCTO #12205]
The following changes since commit cf75fd5ae07355951b1f90d13842552a99e61063:
contrib/yocto-bsp-kernel-update.sh: remove this script (2018-01-18 13:05:56 +0000)
are available in the git repository at:
git://push.yoctoproject.org/poky-contrib anelliot/bug12205
anelliot (1):
wic: argparse now used for help functionality.
meta/lib/oeqa/selftest/cases/wic.py | 58 +- scripts/lib/wic/engine.py | 87 ++- scripts/lib/wic/help.py | 1080 ++++------------------------------- scripts/wic | 168 ++---- 4 files changed, 269 insertions(+), 1124 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/1 wic: argparse now used for help functionality.
The wic help output formally consisted of manually created strings mixed with argparse, which wasunformatted and unusable. This fix cleans up the help messages, rewrites help functionality to use argparse, and adds functionality to show information for plugins (similar to canned images).
Fixes [YOCTO #12205]
--- meta/lib/oeqa/selftest/cases/wic.py | 58 +- scripts/lib/wic/engine.py | 87 ++- scripts/lib/wic/help.py | 1080 ++++------------------------------- scripts/wic | 168 ++---- 4 files changed, 269 insertions(+), 1124 deletions(-)
meta/lib/oeqa/selftest/cases/wic.py +26 -32
@@ -106,39 +106,29 @@ class Wic(OESelftestTestCase): self.assertEqual(0, runCmd('wic -h').status) @OETestID(1209) - def test_createhelp(self): - """Test wic create --help""" - self.assertEqual(0, runCmd('wic create --help').status) + def test_help_rm(self): + """Test wic rm --h""" + self.assertEqual(0, runCmd('wic rm -h').status) @OETestID(1210) - def test_listhelp(self): - """Test wic list --help""" - self.assertEqual(0, runCmd('wic list --help').status) + def test_help_cp(self): + """Test wic cp -h""" + self.assertEqual(0, runCmd('wic cp -h').status) @OETestID(1553) def test_help_create(self): - """Test wic help create""" - self.assertEqual(0, runCmd('wic help create').status) + """Test wic create -h""" + self.assertEqual(0, runCmd('wic create -h').status) @OETestID(1554) def test_help_list(self): - """Test wic help list""" - self.assertEqual(0, runCmd('wic help list').status) + """Test wic list -h""" + self.assertEqual(0, runCmd('wic list -h').status) @OETestID(1215) - def test_help_overview(self): - """Test wic help overview""" - self.assertEqual(0, runCmd('wic help overview').status) - - @OETestID(1216) - def test_help_plugins(self): - """Test wic help plugins""" - self.assertEqual(0, runCmd('wic help plugins').status) - - @OETestID(1217) - def test_help_kickstart(self): - """Test wic help kickstart""" - self.assertEqual(0, runCmd('wic help kickstart').status) + def test_help_write(self): + """Test wic write -h""" + self.assertEqual(0, runCmd('wic write -h').status) @OETestID(1555) def test_list_images(self):
@@ -151,12 +141,19 @@ class Wic(OESelftestTestCase): self.assertEqual(0, runCmd('wic list source-plugins').status) @OETestID(1557) - def test_listed_images_help(self): - """Test wic listed images help""" + def test_listed_images_info(self): + """Test wic listed images info""" output = runCmd('wic list images').output imagelist = [line.split()[0] for line in output.splitlines()] for image in imagelist: - self.assertEqual(0, runCmd('wic list %s help' % image).status) + self.assertEqual(0, runCmd('wic list %s info' % image).status) + + def test_listed_plugins_info(self): + """Test wic listed plugins info""" + output = runCmd('wic list source-plugins').output + imagelist = [line.split()[0] for line in output.splitlines()] + for image in imagelist: + self.assertEqual(0, runCmd('wic list %s info' % image).status) @OETestID(1213) def test_unsupported_subcommand(self):
@@ -623,7 +620,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r self.assertTrue(os.path.islink(path)) self.assertTrue(os.path.isfile(os.path.realpath(path))) - @OETestID(1424) + @OETestID(1422) @only_for_arch(['i586', 'i686', 'x86_64']) def test_qemu(self): """Test wic-image-minimal under qemu"""
@@ -634,13 +631,10 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r self.remove_config(config) with runqemu('wic-image-minimal', ssh=False) as qemu: - cmd = "mount |grep '^/dev/' | cut -f1,3 -d ' ' | sort" - status, output = qemu.run_serial(cmd) - self.assertEqual(output, '/dev/root /\r\n/dev/sda1 /boot\r\n/dev/sda3 /media\r\n/dev/sda4 /mnt') - cmd = "grep UUID= /etc/fstab" + cmd = "mount |grep '^/dev/' | cut -f1,3 -d ' '" status, output = qemu.run_serial(cmd) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) - self.assertEqual(output, 'UUID=2c71ef06-a81d-4735-9d3a-379b69c6bdba\t/media\text4\tdefaults\t0\t0') + self.assertEqual(output, '/dev/root /\r\n/dev/sda1 /boot\r\n/dev/sda3 /mnt') @only_for_arch(['i586', 'i686', 'x86_64']) @OETestID(1852)
scripts/lib/wic/engine.py +76 -11
136 lines not on this page · raw message
scripts/lib/wic/help.py +112 -968
1,134 lines not on this page · raw message
scripts/wic +55 -113
291 lines not on this page · raw message
Signature · 1 line
2.7.4
Quoted 10 lines · anelliot
The wic help output formally consisted of manually created strings mixed with argparse,
which wasunformatted and unusable. This fix cleans up the help messages, rewrites help
functionality to use argparse, and adds functionality to show information for
plugins (similar to canned images).Fixes [YOCTO #12205]
Quoted 8 lines
Signed-off-by anelliot <[email protected]>---
meta/lib/oeqa/selftest/cases/wic.py | 58 +- scripts/lib/wic/engine.py | 87 ++- scripts/lib/wic/help.py | 1080 ++++---------------------
----------
scripts/wic | 168 ++----4 files changed, 269 insertions(+), 1124 deletions(-)
Unfortunately this is causing a selftest regression:
https://autobuilder.yocto.io/builders/nightly-oe-selftest/builds/771
You should be able to reproduce with:
"oe-selftest -r wic.Wic.test_qemu"
Cheers,
Richard