mirror of
https://git.yoctoproject.org/poky
synced 2026-06-03 13:49:49 +00:00
bitbake: parse: Return IOError when including file with absolute path
* resolve_file was behaving different when relative and absolute paths were passed to it * include relative-path/non-existent-file.inc works correctly resolve_file throws IOError, BBHandler.py:handle() doesn't catch it, ConfHandler.py:include() catches IOError and shows: DEBUG: CONF file 'relative-path/non-existent-file.inc' not found * include /absolute-path/non-existent-file.inc was failing, because resolve_file just returns fn, BBHandler.py:handle() calls bb.parse.mark_dependency(d, abs_fn) which throws: OSError: [Errno 2] No such file or directory: '/absolute-path/non-existent-file.inc' and parsing fails. Ad isfile() test for absolute fn and throw IOError to make resolve_file behavior consistent for both paths. * I know we had some issues with -b relative-path-to-recipe.bb and absolute path, so consider this patch only as RFC and documentation of this problem * Catch OSError too in ConfHandler.py:include() e.g. in case the file exists, but user cannot read it or something like that. (Bitbake rev: b0bbd89a4f0b98fa1ab28b8e0526cd9ddb76fa57) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
503daf245e
commit
aa0b237144
@@ -107,6 +107,9 @@ def resolve_file(fn, d):
|
|||||||
raise IOError("file %s not found in %s" % (fn, bbpath))
|
raise IOError("file %s not found in %s" % (fn, bbpath))
|
||||||
fn = newfn
|
fn = newfn
|
||||||
|
|
||||||
|
if not os.path.isfile(fn):
|
||||||
|
raise IOError("file %s not found" % fn)
|
||||||
|
|
||||||
logger.debug(2, "LOAD %s", fn)
|
logger.debug(2, "LOAD %s", fn)
|
||||||
return fn
|
return fn
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ def include(oldfn, fn, lineno, data, error_out):
|
|||||||
from bb.parse import handle
|
from bb.parse import handle
|
||||||
try:
|
try:
|
||||||
ret = handle(fn, data, True)
|
ret = handle(fn, data, True)
|
||||||
except IOError:
|
except (IOError, OSError):
|
||||||
if error_out:
|
if error_out:
|
||||||
raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno)
|
raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno)
|
||||||
logger.debug(2, "CONF file '%s' not found", fn)
|
logger.debug(2, "CONF file '%s' not found", fn)
|
||||||
|
|||||||
Reference in New Issue
Block a user