From 107a9da00640a9e086a8608c20aee48aefd92893 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 11 May 2009 22:41:17 +0100 Subject: [PATCH] bitbake: Merge further fixes from upstream 1.8 branch * Make the test functionality work * Optimise BBPATH handling when changing directory * Optimise file globing for BBFILES Signed-off-by: Richard Purdie --- bitbake/lib/bb/__init__.py | 1 + bitbake/lib/bb/cooker.py | 19 +++++++++++-------- bitbake/lib/bb/data.py | 2 ++ bitbake/lib/bb/parse/parse_py/BBHandler.py | 6 ------ bitbake/lib/bb/parse/parse_py/ConfHandler.py | 7 +++++++ 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py index 7d01d52b64..b8f7c7f59e 100644 --- a/bitbake/lib/bb/__init__.py +++ b/bitbake/lib/bb/__init__.py @@ -1129,4 +1129,5 @@ def dep_opconvert(mysplit, myuse): if __name__ == "__main__": import doctest, bb + bb.msg.set_debug_level(0) doctest.testmod(bb) diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 9f8c71ff13..610824ab21 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -281,13 +281,13 @@ class BBCooker: print >> depends_file, '"%s" -> "%s"' % (pn, depend) rdepends = self.status.rundeps[fn] for package in rdepends: - for rdepend in rdepends[package]: - print >> depends_file, '"%s" -> "%s" [style=dashed]' % (package, rdepend) + for rdepend in re.findall("([\w.-]+)(\ \(.+\))?", rdepends[package]): + print >> depends_file, '"%s" -> "%s%s" [style=dashed]' % (package, rdepend[0], rdepend[1]) packages.append(package) rrecs = self.status.runrecs[fn] for package in rrecs: - for rdepend in rrecs[package]: - print >> depends_file, '"%s" -> "%s" [style=dashed]' % (package, rdepend) + for rdepend in re.findall("([\w.-]+)(\ \(.+\))?", rrecs[package]): + print >> depends_file, '"%s" -> "%s%s" [style=dashed]' % (package, rdepend[0], rdepend[1]) if not package in packages: packages.append(package) for package in packages: @@ -688,7 +688,11 @@ class BBCooker: if dirfiles: newfiles += dirfiles continue - newfiles += glob.glob(f) or [ f ] + else: + globbed = glob.glob(f) + if not globbed and os.path.exists(f): + globbed = [f] + newfiles += globbed bbmask = bb.data.getVar('BBMASK', self.configuration.data, 1) @@ -701,9 +705,8 @@ class BBCooker: bb.msg.fatal(bb.msg.domain.Collection, "BBMASK is not a valid regular expression.") finalfiles = [] - for i in xrange( len( newfiles ) ): - f = newfiles[i] - if bbmask and bbmask_compiled.search(f): + for f in newfiles: + if bbmask_compiled.search(f): bb.msg.debug(1, bb.msg.domain.Collection, "skipping masked file %s" % f) masked += 1 continue diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index cc08d69009..f424ac7a22 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py @@ -553,7 +553,9 @@ def inherits_class(klass, d): def _test(): """Start a doctest run on this module""" import doctest + import bb from bb import data + bb.msg.set_debug_level(0) doctest.testmod(data) if __name__ == "__main__": diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 97786c4202..d13428aa0b 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py @@ -155,12 +155,6 @@ def handle(fn, d, include = 0): f = open(fn,'r') abs_fn = fn - if ext != ".bbclass": - dname = os.path.dirname(abs_fn) - if bbpath[0] != dname: - bbpath.insert(0, dname) - data.setVar('BBPATH', ":".join(bbpath), d) - if include: bb.parse.mark_dependency(d, abs_fn) diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index f8a49689e2..c9f1ea13fb 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py @@ -102,6 +102,13 @@ def include(oldfn, fn, data, error_out): fn = bb.data.expand(fn, data) oldfn = bb.data.expand(oldfn, data) + if not os.path.isabs(fn): + dname = os.path.dirname(oldfn) + bbpath = "%s:%s" % (dname, bb.data.getVar("BBPATH", data, 1)) + abs_fn = bb.which(bbpath, fn) + if abs_fn: + fn = abs_fn + from bb.parse import handle try: ret = handle(fn, data, True)