summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/parse/__init__.py19
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py5
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py9
-rw-r--r--bitbake/lib/bb/utils.py8
4 files changed, 34 insertions, 7 deletions
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py
index c973f6fdbf..97983c9880 100644
--- a/bitbake/lib/bb/parse/__init__.py
+++ b/bitbake/lib/bb/parse/__init__.py
@@ -73,9 +73,17 @@ def update_mtime(f):
73def mark_dependency(d, f): 73def mark_dependency(d, f):
74 if f.startswith('./'): 74 if f.startswith('./'):
75 f = "%s/%s" % (os.getcwd(), f[2:]) 75 f = "%s/%s" % (os.getcwd(), f[2:])
76 deps = (d.getVar('__depends') or []) + [(f, cached_mtime(f))] 76 deps = (d.getVar('__depends') or [])
77 d.setVar('__depends', deps) 77 s = (f, cached_mtime_noerror(f))
78 78 if s not in deps:
79 deps.append(s)
80 d.setVar('__depends', deps)
81
82def check_dependency(d, f):
83 s = (f, cached_mtime_noerror(f))
84 deps = (d.getVar('__depends') or [])
85 return s in deps
86
79def supports(fn, data): 87def supports(fn, data):
80 """Returns true if we have a handler for this file, false otherwise""" 88 """Returns true if we have a handler for this file, false otherwise"""
81 for h in handlers: 89 for h in handlers:
@@ -102,11 +110,14 @@ def init_parser(d):
102def resolve_file(fn, d): 110def resolve_file(fn, d):
103 if not os.path.isabs(fn): 111 if not os.path.isabs(fn):
104 bbpath = d.getVar("BBPATH", True) 112 bbpath = d.getVar("BBPATH", True)
105 newfn = bb.utils.which(bbpath, fn) 113 newfn, attempts = bb.utils.which(bbpath, fn, history=True)
114 for af in attempts:
115 mark_dependency(d, af)
106 if not newfn: 116 if not newfn:
107 raise IOError("file %s not found in %s" % (fn, bbpath)) 117 raise IOError("file %s not found in %s" % (fn, bbpath))
108 fn = newfn 118 fn = newfn
109 119
120 mark_dependency(d, fn)
110 if not os.path.isfile(fn): 121 if not os.path.isfile(fn):
111 raise IOError("file %s not found" % fn) 122 raise IOError("file %s not found" % fn)
112 123
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
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 560f55a074..0be45e1af6 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -796,22 +796,28 @@ def copyfile(src, dest, newmtime = None, sstat = None):
796 newmtime = sstat[stat.ST_MTIME] 796 newmtime = sstat[stat.ST_MTIME]
797 return newmtime 797 return newmtime
798 798
799def which(path, item, direction = 0): 799def which(path, item, direction = 0, history = False):
800 """ 800 """
801 Locate a file in a PATH 801 Locate a file in a PATH
802 """ 802 """
803 803
804 hist = []
804 paths = (path or "").split(':') 805 paths = (path or "").split(':')
805 if direction != 0: 806 if direction != 0:
806 paths.reverse() 807 paths.reverse()
807 808
808 for p in paths: 809 for p in paths:
809 next = os.path.join(p, item) 810 next = os.path.join(p, item)
811 hist.append(next)
810 if os.path.exists(next): 812 if os.path.exists(next):
811 if not os.path.isabs(next): 813 if not os.path.isabs(next):
812 next = os.path.abspath(next) 814 next = os.path.abspath(next)
815 if history:
816 return next, hist
813 return next 817 return next
814 818
819 if history:
820 return "", hist
815 return "" 821 return ""
816 822
817def to_boolean(string, default=None): 823def to_boolean(string, default=None):