summaryrefslogtreecommitdiffstats
path: root/lib/bb/parse/__init__.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-11-29 23:15:56 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-11-29 23:21:42 +0000
commit78d285871e4b8c54ccc4602d571e85f922e37ccd (patch)
treea205e73d1f64ad7fcee66ba2d818486ff1a2151a /lib/bb/parse/__init__.py
parent991cbeedbde8bd25ce08c669b1bfac8b99e33149 (diff)
downloadbitbake-contrib-78d285871e4b8c54ccc4602d571e85f922e37ccd.tar.gz
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] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/parse/__init__.py')
-rw-r--r--lib/bb/parse/__init__.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/bb/parse/__init__.py b/lib/bb/parse/__init__.py
index c973f6fdb..97983c988 100644
--- a/lib/bb/parse/__init__.py
+++ b/lib/bb/parse/__init__.py
@@ -73,9 +73,17 @@ def update_mtime(f):
def mark_dependency(d, f):
if f.startswith('./'):
f = "%s/%s" % (os.getcwd(), f[2:])
- deps = (d.getVar('__depends') or []) + [(f, cached_mtime(f))]
- d.setVar('__depends', deps)
-
+ deps = (d.getVar('__depends') or [])
+ s = (f, cached_mtime_noerror(f))
+ if s not in deps:
+ deps.append(s)
+ d.setVar('__depends', deps)
+
+def check_dependency(d, f):
+ s = (f, cached_mtime_noerror(f))
+ deps = (d.getVar('__depends') or [])
+ return s in deps
+
def supports(fn, data):
"""Returns true if we have a handler for this file, false otherwise"""
for h in handlers:
@@ -102,11 +110,14 @@ def init_parser(d):
def resolve_file(fn, d):
if not os.path.isabs(fn):
bbpath = d.getVar("BBPATH", True)
- newfn = bb.utils.which(bbpath, fn)
+ newfn, attempts = bb.utils.which(bbpath, fn, history=True)
+ for af in attempts:
+ mark_dependency(d, af)
if not newfn:
raise IOError("file %s not found in %s" % (fn, bbpath))
fn = newfn
+ mark_dependency(d, fn)
if not os.path.isfile(fn):
raise IOError("file %s not found" % fn)