summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2013-08-23 19:06:26 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-26 11:29:46 +0100
commitaa0b23714499143e4eec2f919fddd377bdc182e7 (patch)
tree95da9daf735b2cd0fc3687f44fdb12d53b597983 /bitbake/lib
parent503daf245eb0b060fd4f1bff4499bf2207bef55d (diff)
downloadpoky-aa0b23714499143e4eec2f919fddd377bdc182e7.tar.gz
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>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/parse/__init__.py3
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py2
2 files changed, 4 insertions, 1 deletions
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py
index 3f93ad2e6a..c973f6fdbf 100644
--- a/bitbake/lib/bb/parse/__init__.py
+++ b/bitbake/lib/bb/parse/__init__.py
@@ -107,6 +107,9 @@ def resolve_file(fn, d):
107 raise IOError("file %s not found in %s" % (fn, bbpath)) 107 raise IOError("file %s not found in %s" % (fn, bbpath))
108 fn = newfn 108 fn = newfn
109 109
110 if not os.path.isfile(fn):
111 raise IOError("file %s not found" % fn)
112
110 logger.debug(2, "LOAD %s", fn) 113 logger.debug(2, "LOAD %s", fn)
111 return fn 114 return fn
112 115
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
index 7d4a5b14a7..7b30c8acb3 100644
--- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
@@ -89,7 +89,7 @@ def include(oldfn, fn, lineno, data, error_out):
89 from bb.parse import handle 89 from bb.parse import handle
90 try: 90 try:
91 ret = handle(fn, data, True) 91 ret = handle(fn, data, True)
92 except IOError: 92 except (IOError, OSError):
93 if error_out: 93 if error_out:
94 raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno) 94 raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno)
95 logger.debug(2, "CONF file '%s' not found", fn) 95 logger.debug(2, "CONF file '%s' not found", fn)