summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-02-10 10:11:32 +0000
committerRichard Purdie <richard@openedhand.com>2006-02-10 10:11:32 +0000
commit62dc8f47b3c17cf0b1a5d4bf4f0173d5d4fb4c1a (patch)
tree947a632b694a9a6d561f0df0a768a622e1364570 /bitbake/lib/bb/parse
parent9a262964c8b5c5a21a68d9b66ab9259b3737999f (diff)
downloadpoky-62dc8f47b3c17cf0b1a5d4bf4f0173d5d4fb4c1a.tar.gz
Update bitbake to latest bitbake svn
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@262 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib/bb/parse')
-rw-r--r--bitbake/lib/bb/parse/__init__.py9
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py19
2 files changed, 22 insertions, 6 deletions
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py
index b8839c09fd..cb27416061 100644
--- a/bitbake/lib/bb/parse/__init__.py
+++ b/bitbake/lib/bb/parse/__init__.py
@@ -26,6 +26,8 @@ __all__ = [ 'ParseError', 'SkipPackage', 'cached_mtime', 'mark_dependency',
26 'supports', 'handle', 'init' ] 26 'supports', 'handle', 'init' ]
27handlers = [] 27handlers = []
28 28
29import bb, os
30
29class ParseError(Exception): 31class ParseError(Exception):
30 """Exception raised when parsing fails""" 32 """Exception raised when parsing fails"""
31 33
@@ -34,13 +36,14 @@ class SkipPackage(Exception):
34 36
35__mtime_cache = {} 37__mtime_cache = {}
36def cached_mtime(f): 38def cached_mtime(f):
37 import os
38 if not __mtime_cache.has_key(f): 39 if not __mtime_cache.has_key(f):
39 __mtime_cache[f] = os.stat(f)[8] 40 update_mtime(f)
40 return __mtime_cache[f] 41 return __mtime_cache[f]
41 42
43def update_mtime(f):
44 __mtime_cache[f] = os.stat(f)[8]
45
42def mark_dependency(d, f): 46def mark_dependency(d, f):
43 import bb, os
44 if f.startswith('./'): 47 if f.startswith('./'):
45 f = "%s/%s" % (os.getcwd(), f[2:]) 48 f = "%s/%s" % (os.getcwd(), f[2:])
46 deps = (bb.data.getVar('__depends', d) or "").split() 49 deps = (bb.data.getVar('__depends', d) or "").split()
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
index 41ef96d557..90978300af 100644
--- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
@@ -28,6 +28,7 @@ from bb.parse import ParseError
28#__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)$") 28#__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)$")
29__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)$") 29__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)$")
30__include_regexp__ = re.compile( r"include\s+(.+)" ) 30__include_regexp__ = re.compile( r"include\s+(.+)" )
31__require_regexp__ = re.compile( r"require\s+(.+)" )
31 32
32def init(data): 33def init(data):
33 if not bb.data.getVar('TOPDIR', data): 34 if not bb.data.getVar('TOPDIR', data):
@@ -83,7 +84,11 @@ def obtain(fn, data = bb.data.init()):
83 return localfn 84 return localfn
84 85
85 86
86def include(oldfn, fn, data = bb.data.init()): 87def include(oldfn, fn, data = bb.data.init(), error_out = False):
88 """
89
90 error_out If True a ParseError will be reaised if the to be included
91 """
87 if oldfn == fn: # prevent infinate recursion 92 if oldfn == fn: # prevent infinate recursion
88 return None 93 return None
89 94
@@ -93,8 +98,10 @@ def include(oldfn, fn, data = bb.data.init()):
93 98
94 from bb.parse import handle 99 from bb.parse import handle
95 try: 100 try:
96 ret = handle(fn, data, 1) 101 ret = handle(fn, data, True)
97 except IOError: 102 except IOError:
103 if error_out:
104 raise ParseError("Could not include required file %(fn)s" % vars() )
98 debug(2, "CONF file '%s' not found" % fn) 105 debug(2, "CONF file '%s' not found" % fn)
99 106
100def handle(fn, data = bb.data.init(), include = 0): 107def handle(fn, data = bb.data.init(), include = 0):
@@ -125,7 +132,7 @@ def handle(fn, data = bb.data.init(), include = 0):
125 debug(1, "CONF %s %s" % (inc_string, currname)) 132 debug(1, "CONF %s %s" % (inc_string, currname))
126 break 133 break
127 if f is None: 134 if f is None:
128 raise IOError("file not found") 135 raise IOError("file '%s' not found" % fn)
129 else: 136 else:
130 f = open(fn,'r') 137 f = open(fn,'r')
131 debug(1, "CONF %s %s" % (inc_string,fn)) 138 debug(1, "CONF %s %s" % (inc_string,fn))
@@ -191,6 +198,12 @@ def feeder(lineno, s, fn, data = bb.data.init()):
191 include(fn, s, data) 198 include(fn, s, data)
192 return 199 return
193 200
201 m = __require_regexp__.match(s)
202 if m:
203 s = bb.data.expand(m.group(1), data)
204 include(fn, s, data, True)
205 return
206
194 raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); 207 raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s));
195 208
196# Add us to the handlers list 209# Add us to the handlers list