diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-11-29 23:15:56 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-11-30 22:26:30 +0000 |
commit | f5f3ef7b09ab3790da92f8bef83835033bbeb0ac (patch) | |
tree | 29738d839ecaa60576babcfbbdda836dc489bce3 /bitbake/lib/bb/parse/parse_py | |
parent | ea03ed0e8da1110e5cd27365f7b1f3f071572d02 (diff) | |
download | poky-f5f3ef7b09ab3790da92f8bef83835033bbeb0ac.tar.gz |
bitbake: parse/ConfHander/BBHandler/utils: Fix cache dependency bugs
Currently bitbake only adds files to its dependency list if they exist.
If you add 'include foo.inc' to your recipe and the file doesn't exist,
then later you add the file, the cache will not be invalidated.
This leads to another bug which is that if files don't exist and then
you add them and they should be found first due to BBPATH, again the
cache won't invalidate.
This patch adds in tracking of files we check for the existence of so
that if they are added later, the cache correctly invalidates. This
necessitated a new version of bb.utils.which which returns a list of
files tested for.
The patch also adds in checks for duplicate file includes and for now
prints a warning about this. That will likely become a fatal error at
some point since its never usually desired to include a file twice.
The same issue is also fixed for class inheritance. Now when a class
is added which would be found in the usual search path, it will cause
the cache to be invalidated.
Unfortunately this is old code in bitbake and the patch isn't the
neatest since we have to work within that framework.
[YOCTO #5611]
[YOCTO #4425]
(Bitbake rev: 78d285871e4b8c54ccc4602d571e85f922e37ccd)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py')
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 5 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 01f22d3b24..7cba649595 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py | |||
@@ -77,7 +77,10 @@ def inherit(files, fn, lineno, d): | |||
77 | if not os.path.isabs(file): | 77 | if not os.path.isabs(file): |
78 | dname = os.path.dirname(fn) | 78 | dname = os.path.dirname(fn) |
79 | bbpath = "%s:%s" % (dname, d.getVar("BBPATH", True)) | 79 | bbpath = "%s:%s" % (dname, d.getVar("BBPATH", True)) |
80 | abs_fn = bb.utils.which(bbpath, file) | 80 | abs_fn, attempts = bb.utils.which(bbpath, file, history=True) |
81 | for af in attempts: | ||
82 | if af != abs_fn: | ||
83 | bb.parse.mark_dependency(d, af) | ||
81 | if abs_fn: | 84 | if abs_fn: |
82 | file = abs_fn | 85 | file = abs_fn |
83 | 86 | ||
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index 7b30c8acb3..f4fb2aa45c 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py | |||
@@ -82,9 +82,15 @@ def include(oldfn, fn, lineno, data, error_out): | |||
82 | if not os.path.isabs(fn): | 82 | if not os.path.isabs(fn): |
83 | dname = os.path.dirname(oldfn) | 83 | dname = os.path.dirname(oldfn) |
84 | bbpath = "%s:%s" % (dname, data.getVar("BBPATH", True)) | 84 | bbpath = "%s:%s" % (dname, data.getVar("BBPATH", True)) |
85 | abs_fn = bb.utils.which(bbpath, fn) | 85 | abs_fn, attempts = bb.utils.which(bbpath, fn, history=True) |
86 | if abs_fn and bb.parse.check_dependency(data, abs_fn): | ||
87 | bb.warn("Duplicate inclusion for %s in %s" % (abs_fn, data.getVar('FILE', True))) | ||
88 | for af in attempts: | ||
89 | bb.parse.mark_dependency(data, af) | ||
86 | if abs_fn: | 90 | if abs_fn: |
87 | fn = abs_fn | 91 | fn = abs_fn |
92 | elif bb.parse.check_dependency(data, fn): | ||
93 | bb.warn("Duplicate inclusion for %s in %s" % (fn, data.getVar('FILE', True))) | ||
88 | 94 | ||
89 | from bb.parse import handle | 95 | from bb.parse import handle |
90 | try: | 96 | try: |
@@ -93,6 +99,7 @@ def include(oldfn, fn, lineno, data, error_out): | |||
93 | if error_out: | 99 | if error_out: |
94 | raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno) | 100 | raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno) |
95 | logger.debug(2, "CONF file '%s' not found", fn) | 101 | logger.debug(2, "CONF file '%s' not found", fn) |
102 | bb.parse.mark_dependency(data, fn) | ||
96 | 103 | ||
97 | # We have an issue where a UI might want to enforce particular settings such as | 104 | # We have an issue where a UI might want to enforce particular settings such as |
98 | # an empty DISTRO variable. If configuration files do something like assigning | 105 | # an empty DISTRO variable. If configuration files do something like assigning |