summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/parse/__init__.py19
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py18
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py23
3 files changed, 23 insertions, 37 deletions
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py
index 5dd96c4136..c6a925c7a8 100644
--- a/bitbake/lib/bb/parse/__init__.py
+++ b/bitbake/lib/bb/parse/__init__.py
@@ -80,5 +80,24 @@ def init(fn, data):
80 if h['supports'](fn): 80 if h['supports'](fn):
81 return h['init'](data) 81 return h['init'](data)
82 82
83def resolve_file(fn, d):
84 if not os.path.isabs(fn):
85 f = None
86 bbpath = (bb.data.getVar('BBPATH', d, 1) or '').split(':')
87 for p in bbpath:
88 j = os.path.join(p, fn)
89 if os.access(j, os.R_OK):
90 abs_fn = j
91 f = open(j, 'r')
92 break
93 if f is None:
94 raise IOError("file %s not found" % fn)
95 else:
96 f = open(fn,'r')
97 abs_fn = fn
98
99 bb.msg.debug(2, bb.msg.domain.Parsing, "LOAD %s" % abs_fn)
100 return (f, abs_fn)
101
83 102
84from parse_py import __version__, ConfHandler, BBHandler 103from parse_py import __version__, ConfHandler, BBHandler
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 7707705aaf..c6931650da 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -30,7 +30,7 @@ import bb.fetch, bb.build, bb.utils
30from bb import data, fetch, methodpool 30from bb import data, fetch, methodpool
31 31
32from ConfHandler import include, init 32from ConfHandler import include, init
33from bb.parse import ParseError 33from bb.parse import ParseError, resolve_file
34 34
35__func_start_regexp__ = re.compile( r"(((?P<py>python)|(?P<fr>fakeroot))\s*)*(?P<func>[\w\.\-\+\{\}\$]+)?\s*\(\s*\)\s*{$" ) 35__func_start_regexp__ = re.compile( r"(((?P<py>python)|(?P<fr>fakeroot))\s*)*(?P<func>[\w\.\-\+\{\}\$]+)?\s*\(\s*\)\s*{$" )
36__inherit_regexp__ = re.compile( r"inherit\s+(.+)" ) 36__inherit_regexp__ = re.compile( r"inherit\s+(.+)" )
@@ -145,20 +145,7 @@ def handle(fn, d, include = 0):
145 else: 145 else:
146 oldfile = None 146 oldfile = None
147 147
148 bbpath = (data.getVar('BBPATH', d, 1) or '').split(':') 148 (f, abs_fn) = resolve_file(fn, d)
149 if not os.path.isabs(fn):
150 f = None
151 for p in bbpath:
152 j = os.path.join(p, fn)
153 if os.access(j, os.R_OK):
154 abs_fn = j
155 f = open(j, 'r')
156 break
157 if f is None:
158 raise IOError("file %s not found" % fn)
159 else:
160 f = open(fn,'r')
161 abs_fn = fn
162 149
163 if include: 150 if include:
164 bb.parse.mark_dependency(d, abs_fn) 151 bb.parse.mark_dependency(d, abs_fn)
@@ -203,7 +190,6 @@ def handle(fn, d, include = 0):
203 darray[cls] = based 190 darray[cls] = based
204 return darray 191 return darray
205 192
206 bbpath.pop(0)
207 if oldfile: 193 if oldfile:
208 bb.data.setVar("FILE", oldfile, d) 194 bb.data.setVar("FILE", oldfile, d)
209 195
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
index fcbf6aea15..ce746106a4 100644
--- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
@@ -25,7 +25,7 @@
25# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 25# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 26
27import re, bb.data, os, sys 27import re, bb.data, os, sys
28from bb.parse import ParseError 28from bb.parse import ParseError, resolve_file
29 29
30#__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}]+)\s*(?P<colon>:)?(?P<ques>\?)?=\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") 30#__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}]+)\s*(?P<colon>:)?(?P<ques>\?)?=\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$")
31__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}/]+)(\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?\s*((?P<colon>:=)|(?P<ques>\?=)|(?P<append>\+=)|(?P<prepend>=\+)|(?P<predot>=\.)|(?P<postdot>\.=)|=)\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") 31__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}/]+)(\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?\s*((?P<colon>:=)|(?P<ques>\?=)|(?P<append>\+=)|(?P<prepend>=\+)|(?P<predot>=\.)|(?P<postdot>\.=)|=)\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$")
@@ -77,10 +77,6 @@ def include(oldfn, fn, data, error_out):
77 bb.msg.debug(2, bb.msg.domain.Parsing, "CONF file '%s' not found" % fn) 77 bb.msg.debug(2, bb.msg.domain.Parsing, "CONF file '%s' not found" % fn)
78 78
79def handle(fn, data, include = 0): 79def handle(fn, data, include = 0):
80 if include:
81 inc_string = "including"
82 else:
83 inc_string = "reading"
84 init(data) 80 init(data)
85 81
86 if include == 0: 82 if include == 0:
@@ -88,22 +84,7 @@ def handle(fn, data, include = 0):
88 else: 84 else:
89 oldfile = bb.data.getVar('FILE', data) 85 oldfile = bb.data.getVar('FILE', data)
90 86
91 if not os.path.isabs(fn): 87 (f, abs_fn) = resolve_file(fn, data)
92 f = None
93 bbpath = bb.data.getVar("BBPATH", data, 1) or []
94 for p in bbpath.split(":"):
95 currname = os.path.join(p, fn)
96 if os.access(currname, os.R_OK):
97 f = open(currname, 'r')
98 abs_fn = currname
99 bb.msg.debug(2, bb.msg.domain.Parsing, "CONF %s %s" % (inc_string, currname))
100 break
101 if f is None:
102 raise IOError("file '%s' not found" % fn)
103 else:
104 f = open(fn,'r')
105 bb.msg.debug(1, bb.msg.domain.Parsing, "CONF %s %s" % (inc_string,fn))
106 abs_fn = fn
107 88
108 if include: 89 if include:
109 bb.parse.mark_dependency(data, abs_fn) 90 bb.parse.mark_dependency(data, abs_fn)