diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2017-01-24 17:32:24 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-26 10:44:28 +0000 |
commit | 478644aedf04ba4d861e27e2955a6afecd1bc311 (patch) | |
tree | 475106476f860f60abc14a99ee1bb9a40f68b446 /bitbake | |
parent | 8147b84777a75b7462fb754f7619ec89483796e6 (diff) | |
download | poky-478644aedf04ba4d861e27e2955a6afecd1bc311.tar.gz |
bitbake: build.py: avoid exception when function is not defined
exc_func() fails with a hard to debug exception when the
function does not exist, for example due to a typo:
ERROR: ...: Traceback (most recent call last):
File "/work/bitbake/lib/bb/build.py", line 644, in exec_task
return _exec_task(fn, task, d, quieterr)
File "/work/bitbake/lib/bb/build.py", line 584, in _exec_task
exec_func(func, localdata)
File "/work/bitbake/lib/bb/build.py", line 198, in exec_func
cleandirs = flags.get('cleandirs')
AttributeError: 'NoneType' object has no attribute 'get'
There is code further down which will print a warning, but we don't
reach that unless we allow None as result of of d.getVarFlags() first.
The warning is further down intentionally and has to stay there, to
ensure that 'cleandirs' gets executed also for empty functions.
(Bitbake rev: 25df3db5eeda9dbf417e67e96845f376e5c8e6b3)
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/build.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index c6104a475e..c08ef8904d 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
@@ -195,13 +195,13 @@ def exec_func(func, d, dirs = None, pythonexception=False): | |||
195 | oldcwd = None | 195 | oldcwd = None |
196 | 196 | ||
197 | flags = d.getVarFlags(func) | 197 | flags = d.getVarFlags(func) |
198 | cleandirs = flags.get('cleandirs') | 198 | cleandirs = flags.get('cleandirs') if flags else None |
199 | if cleandirs: | 199 | if cleandirs: |
200 | for cdir in d.expand(cleandirs).split(): | 200 | for cdir in d.expand(cleandirs).split(): |
201 | bb.utils.remove(cdir, True) | 201 | bb.utils.remove(cdir, True) |
202 | bb.utils.mkdirhier(cdir) | 202 | bb.utils.mkdirhier(cdir) |
203 | 203 | ||
204 | if dirs is None: | 204 | if flags and dirs is None: |
205 | dirs = flags.get('dirs') | 205 | dirs = flags.get('dirs') |
206 | if dirs: | 206 | if dirs: |
207 | dirs = d.expand(dirs).split() | 207 | dirs = d.expand(dirs).split() |