Bug 9972 - recipetool: setvar fails on empty bbappend file
Summary: recipetool: setvar fails on empty bbappend file
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: Scripts and Tools (show other bugs)
Version: 2.0
Hardware: All Multiple
: Medium normal
Target Milestone: 2.2 M3
Assignee: Paul Eggleton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-07-19 09:22 UTC by Paul Eggleton
Modified: 2016-07-26 10:11 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Eggleton 2016-07-19 09:22:06 UTC
If you use recipetool setvar on an empty bbappend file you get a traceback:

--------- snip ---------
$ recipetool newappend ../meta-poky kbd
../meta-poky/recipes-core/kbd/kbd_2.0.3.bbappend
$ recipetool setvar -r ../meta-poky/recipes-core/kbd/kbd_2.0.3.bbappend SOMEVAR "value"

Traceback (most recent call last):
  File "/home/paul/poky/poky/scripts/recipetool", line 117, in <module>
    ret = main()
  File "/home/paul/poky/poky/scripts/recipetool", line 108, in main
    ret = args.func(args)
  File "/home/paul/poky/poky/scripts/lib/recipetool/setvar.py", line 52, in setvar
    patches = [oe.recipeutils.patch_recipe_file(args.recipefile, varvalues, patch=args.patch)]
  File "/home/paul/poky/poky/meta/lib/oe/recipeutils.py", line 279, in patch_recipe_file
    _, tolines = patch_recipe_lines(fromlines, values)
  File "/home/paul/poky/poky/meta/lib/oe/recipeutils.py", line 261, in patch_recipe_lines
    if tolines[-1].strip() != '':
IndexError: list index out of range
--------- snip ---------

If the file has one or more lines no error is produced.