Bug 6911

Summary: If there is a parse error in the metadata, wic fials with a strange message
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Phlip Balister <philip>
Component: deploymentAssignee: Ed Bartosh <eduard.bartosh>
Status: VERIFIED FIXED QA Contact: Daniel Istrate <daniel.alexandrux.istrate>
Severity: normal    
Priority: Medium CC: bluelightning, bogdanx.a.voiculescu
Version: unspecified   
Target Milestone: 1.9   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Phlip Balister 2014-10-29 20:31:19 UTC
I was adding IMAGE_BOOT_FILES = "foo bar <- note no close quote and ran wic to create an image. This gave:

[balister@thuvia build]$ wic create ../oe-core/scripts/lib/image/canned-wks/sdimage-bootpart.wks -e gnuradio-demo-image
Checking basic build environment...
Done.
 
Creating image(s)...
 
Couldn't get 'bitbake -e gnuradio-demo-image' output.
Couldn't get bitbake environment, exiting.

Adding the closing quote solves the problem. Tyring to run bitbake gave a parsing error.

Obviously, a more descriptive error message would be helpful.
Comment 1 Paul Eggleton 2014-10-29 20:45:03 UTC
It may help that bitbake now puts errors out to stderr, so we could pick those up a bit more easily from external scripts such as wic. (Another alternative would be to change wic to use tinfoil to query the variable values.)
Comment 2 Ed Bartosh 2015-04-04 21:06:17 UTC
Added bitbake error output to wic error message: http://lists.openembedded.org/pipermail/openembedded-core/2015-April/103345.html
Comment 4 Daniel Istrate 2015-09-10 11:16:37 UTC
Verified on master c1df471feacaf2590216aa476ce242908dac38cf:

[daniel@fedora-ws poky-build]$ tail conf/local.conf 
MACHINE="genericx86-64"
IMAGE_BOOT_FILES = "foo bar
[daniel@fedora-ws poky-build]$ 

[daniel@fedora-ws poky-build]$ bitbake wic-image-minimal
ERROR: Unable to parse /home/daniel/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py
Traceback (most recent call last):
  File "/home/daniel/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 188, in feeder(lineno=251, s='IMAGE_BOOT_FILES = "foo bar', fn='/media/ssd/poky-build/conf/local.conf', statements=[<bb.parse.ast.DataNode object at 0x7fa2212fd210>, <bb.parse.ast.DataNode object at 0x7fa2212fd1d0>, <bb.parse.ast.DataNode object at 0x7fa2212fd250>, <bb.parse.ast.DataNode object at 0x7fa2212fd310>, <bb.parse.ast.DataNode object at 0x7fa2212fd2d0>, <bb.parse.ast.DataNode object at 0x7fa2212fd390>, <bb.parse.ast.DataNode object at 0x7fa2212fd350>, <bb.parse.ast.DataNode object at 0x7fa2212fd450>, <bb.parse.ast.DataNode object at 0x7fa2212fd410>, <bb.parse.ast.DataNode object at 0x7fa2212fd3d0>, <bb.parse.ast.DataNode object at 0x7fa2212fd490>, <bb.parse.ast.DataNode object at 0x7fa2212fd4d0>, <bb.parse.ast.DataNode object at 0x7fa2212fd590>]):
     
    >    raise ParseError("unparsed line: '%s'" % s, fn, lineno);
     
ParseError: ParseError at /media/ssd/poky-build/conf/local.conf:251: unparsed line: 'IMAGE_BOOT_FILES = "foo bar'

[daniel@fedora-ws poky-build]$ 
[daniel@fedora-ws poky-build]$ 
[daniel@fedora-ws poky-build]$ wic create directdisk -e core-image-minimal
Checking basic build environment...
Done.

Couldn't get 'bitbake -e core-image-minimal' output.
Bitbake failed with error:
ERROR: Unable to parse /home/daniel/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py
Traceback (most recent call last):
  File "/home/daniel/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 188, in feeder(lineno=251, s='IMAGE_BOOT_FILES = "foo bar', fn='/media/ssd/poky-build/conf/local.conf', statements=[<bb.parse.ast.DataNode object at 0x7fd1196cbc90>, <bb.parse.ast.DataNode object at 0x7fd1196a6690>, <bb.parse.ast.DataNode object at 0x7fd1196a6e10>, <bb.parse.ast.DataNode object at 0x7fd1196a6e90>, <bb.parse.ast.DataNode object at 0x7fd119660050>, <bb.parse.ast.DataNode object at 0x7fd1196600d0>, <bb.parse.ast.DataNode object at 0x7fd119660090>, <bb.parse.ast.DataNode object at 0x7fd119660190>, <bb.parse.ast.DataNode object at 0x7fd119660150>, <bb.parse.ast.DataNode object at 0x7fd119660110>, <bb.parse.ast.DataNode object at 0x7fd1196601d0>, <bb.parse.ast.DataNode object at 0x7fd119660210>, <bb.parse.ast.DataNode object at 0x7fd1196602d0>]):
     
    >    raise ParseError("unparsed line: '%s'" % s, fn, lineno);
     
ParseError: ParseError at /media/ssd/poky-build/conf/local.conf:251: unparsed line: 'IMAGE_BOOT_FILES = "foo bar'

Couldn't get 'bitbake -e core-image-minimal' output.
Bitbake failed with error:
ERROR: Unable to parse /home/daniel/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py
Traceback (most recent call last):
  File "/home/daniel/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 188, in feeder(lineno=251, s='IMAGE_BOOT_FILES = "foo bar', fn='/media/ssd/poky-build/conf/local.conf', statements=[<bb.parse.ast.DataNode object at 0x7fda2a45ac90>, <bb.parse.ast.DataNode object at 0x7fda2a435690>, <bb.parse.ast.DataNode object at 0x7fda2a435e10>, <bb.parse.ast.DataNode object at 0x7fda2a435e90>, <bb.parse.ast.DataNode object at 0x7fda2a3ef050>, <bb.parse.ast.DataNode object at 0x7fda2a3ef0d0>, <bb.parse.ast.DataNode object at 0x7fda2a3ef090>, <bb.parse.ast.DataNode object at 0x7fda2a3ef190>, <bb.parse.ast.DataNode object at 0x7fda2a3ef150>, <bb.parse.ast.DataNode object at 0x7fda2a3ef110>, <bb.parse.ast.DataNode object at 0x7fda2a3ef1d0>, <bb.parse.ast.DataNode object at 0x7fda2a3ef210>, <bb.parse.ast.DataNode object at 0x7fda2a3ef2d0>]):
     
    >    raise ParseError("unparsed line: '%s'" % s, fn, lineno);
     
ParseError: ParseError at /media/ssd/poky-build/conf/local.conf:251: unparsed line: 'IMAGE_BOOT_FILES = "foo bar'

Couldn't get 'bitbake -e core-image-minimal' output.
Bitbake failed with error:
ERROR: Unable to parse /home/daniel/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py
Traceback (most recent call last):
  File "/home/daniel/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 188, in feeder(lineno=251, s='IMAGE_BOOT_FILES = "foo bar', fn='/media/ssd/poky-build/conf/local.conf', statements=[<bb.parse.ast.DataNode object at 0x7f0c36d74c90>, <bb.parse.ast.DataNode object at 0x7f0c36d4f690>, <bb.parse.ast.DataNode object at 0x7f0c36d4fe10>, <bb.parse.ast.DataNode object at 0x7f0c36d4fe90>, <bb.parse.ast.DataNode object at 0x7f0c36d09050>, <bb.parse.ast.DataNode object at 0x7f0c36d090d0>, <bb.parse.ast.DataNode object at 0x7f0c36d09090>, <bb.parse.ast.DataNode object at 0x7f0c36d09190>, <bb.parse.ast.DataNode object at 0x7f0c36d09150>, <bb.parse.ast.DataNode object at 0x7f0c36d09110>, <bb.parse.ast.DataNode object at 0x7f0c36d091d0>, <bb.parse.ast.DataNode object at 0x7f0c36d09210>, <bb.parse.ast.DataNode object at 0x7f0c36d092d0>]):
     
    >    raise ParseError("unparsed line: '%s'" % s, fn, lineno);
     
ParseError: ParseError at /media/ssd/poky-build/conf/local.conf:251: unparsed line: 'IMAGE_BOOT_FILES = "foo bar'

Couldn't get 'bitbake -e core-image-minimal' output.
Bitbake failed with error:
ERROR: Unable to parse /home/daniel/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py
Traceback (most recent call last):
  File "/home/daniel/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 188, in feeder(lineno=251, s='IMAGE_BOOT_FILES = "foo bar', fn='/media/ssd/poky-build/conf/local.conf', statements=[<bb.parse.ast.DataNode object at 0x7fc9b781fc90>, <bb.parse.ast.DataNode object at 0x7fc9b77fa690>, <bb.parse.ast.DataNode object at 0x7fc9b77fae10>, <bb.parse.ast.DataNode object at 0x7fc9b77fae90>, <bb.parse.ast.DataNode object at 0x7fc9b77b4050>, <bb.parse.ast.DataNode object at 0x7fc9b77b40d0>, <bb.parse.ast.DataNode object at 0x7fc9b77b4090>, <bb.parse.ast.DataNode object at 0x7fc9b77b4190>, <bb.parse.ast.DataNode object at 0x7fc9b77b4150>, <bb.parse.ast.DataNode object at 0x7fc9b77b4110>, <bb.parse.ast.DataNode object at 0x7fc9b77b41d0>, <bb.parse.ast.DataNode object at 0x7fc9b77b4210>, <bb.parse.ast.DataNode object at 0x7fc9b77b42d0>]):
     
    >    raise ParseError("unparsed line: '%s'" % s, fn, lineno);
     
ParseError: ParseError at /media/ssd/poky-build/conf/local.conf:251: unparsed line: 'IMAGE_BOOT_FILES = "foo bar'

Traceback (most recent call last):
  File "/home/daniel/poky/scripts/wic", line 319, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/home/daniel/poky/scripts/wic", line 314, in main
    return hlp.invoke_subcommand(args, parser, hlp.wic_help_usage, subcommands)
  File "/home/daniel/poky/scripts/lib/wic/help.py", line 95, in invoke_subcommand
    subcommands.get(args[0], subcommand_error)[0](args[1:], usage)
  File "/home/daniel/poky/scripts/wic", line 220, in wic_create_subcommand
    if not os.path.isdir(rootfs_dir):
  File "/usr/lib64/python2.7/genericpath.py", line 41, in isdir
    st = os.stat(s)
TypeError: coercing to Unicode: need string or buffer, NoneType found
[daniel@fedora-ws poky-build]$ 


Bitbake error output passed to wic error message.