wic: argparse now used for help functionality.
v2 cover wic: argparse now used for help functionality.
The wic help output formally consisted of manually created strings mixed with argparse, which was unformatted 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).
The following changes since commit e5e89cfb7bc2231ac4fcc16f4cb4f74d806136c4:
pulseaudio: improve glibc 2.27 patch (2018-01-30 12:53:16 +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 | 50 +- scripts/lib/wic/engine.py | 87 ++- scripts/lib/wic/help.py | 1080 ++++------------------------------- scripts/wic | 168 ++---- 4 files changed, 267 insertions(+), 1118 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/1 wic: argparse now used for help functionality.
The wic help output formally consisted of manually created strings mixed with argparse, which was unformatted 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 | 50 +- scripts/lib/wic/engine.py | 87 ++- scripts/lib/wic/help.py | 1080 ++++------------------------------- scripts/wic | 168 ++---- 4 files changed, 267 insertions(+), 1118 deletions(-)
meta/lib/oeqa/selftest/cases/wic.py +24 -26
@@ -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):
@@ -1064,3 +1061,4 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r result = runCmd("wic ls %s:2/etc/ -n %s" % (images[0], sysroot)) self.assertEqual(0, result.status) self.assertTrue('fstab' not in [line.split()[-1] for line in result.output.split('\n') if line]) +
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
Hi Amber
Quoted 6 lines · On Wednesday, 31 January 2018 07:24:42 NZDT anelliot wrote:
The wic help output formally consisted of manually created strings mixed with argparse,
which was unformatted 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).
So after an inexcusably long delay on my part, I looked at this today. The move to argparse is a definite improvement, however I do have the following concerns:
* "wic help" no longer seems to accept an argument i.e. the command to show help for. I'll grant that it's not really needed if you know you can run wic <command> --help instead, but then we do still provide it so it seems to me it ought to work in a similar manner to how it did previously. I looked elsewhere and it seems "git help <command>" works that way too, FWIW.
* What's with the apparent change from "help" to "info"? That's not mentioned in the commit message.
* Some of the tests seem to be switched around in purpose but keep the same ID; some switch from --help to -h which should be the same thing. It's not clear to me what's been done there and why. I can understand the tests need updating as a result of the changes, but this seems to do more than that, and there's no explanation in the commit message.
* Newline should not be dropped at the end
(It could be that this would benefit from being split up, i.e. do the argparse switchover in one commit and then other changes in subsequent commits, but I'm willing to be convinced otherwise.)
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Quoted 13 lines · anelliot
The wic help output formally consisted of manually created strings mixed with argparse, which was unformatted 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).
The following changes since commit
e5e89cfb7bc2231ac4fcc16f4cb4f74d806136c4:pulseaudio: improve glibc 2.27 patch (2018-01-30 12:53:16 +0000)
are available in the git repository at:
git://push.yoctoproject.org/poky-contribanelliot/bug12205
Quoted 9 lines
anelliot (1):
wic: argparse now used for help functionality.meta/lib/oeqa/selftest/cases/wic.py | 50 +- scripts/lib/wic/engine.py | 87 ++- scripts/lib/wic/help.py | 1080 ++++------------------------------- scripts/wic | 168 ++---- 4 files changed, 267 insertions(+), 1118 deletions(-)
Ack'd and tested.
--S