diff options
author | Richard Purdie <richard@openedhand.com> | 2006-02-10 10:11:32 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2006-02-10 10:11:32 +0000 |
commit | 62dc8f47b3c17cf0b1a5d4bf4f0173d5d4fb4c1a (patch) | |
tree | 947a632b694a9a6d561f0df0a768a622e1364570 /bitbake/lib/bb | |
parent | 9a262964c8b5c5a21a68d9b66ab9259b3737999f (diff) | |
download | poky-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')
-rw-r--r-- | bitbake/lib/bb/__init__.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/__init__.py | 9 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 19 | ||||
-rw-r--r-- | bitbake/lib/bb/shell.py | 33 | ||||
-rw-r--r-- | bitbake/lib/bb/utils.py | 24 |
5 files changed, 78 insertions, 9 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py index 00b0e8b57f..f27f53b39d 100644 --- a/bitbake/lib/bb/__init__.py +++ b/bitbake/lib/bb/__init__.py | |||
@@ -23,7 +23,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |||
23 | Place, Suite 330, Boston, MA 02111-1307 USA. | 23 | Place, Suite 330, Boston, MA 02111-1307 USA. |
24 | """ | 24 | """ |
25 | 25 | ||
26 | __version__ = "1.3.2" | 26 | __version__ = "1.3.2.1" |
27 | 27 | ||
28 | __all__ = [ | 28 | __all__ = [ |
29 | 29 | ||
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' ] |
27 | handlers = [] | 27 | handlers = [] |
28 | 28 | ||
29 | import bb, os | ||
30 | |||
29 | class ParseError(Exception): | 31 | class 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 = {} |
36 | def cached_mtime(f): | 38 | def 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 | ||
43 | def update_mtime(f): | ||
44 | __mtime_cache[f] = os.stat(f)[8] | ||
45 | |||
42 | def mark_dependency(d, f): | 46 | def 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 | ||
32 | def init(data): | 33 | def 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 | ||
86 | def include(oldfn, fn, data = bb.data.init()): | 87 | def 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 | ||
100 | def handle(fn, data = bb.data.init(), include = 0): | 107 | def 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 |
diff --git a/bitbake/lib/bb/shell.py b/bitbake/lib/bb/shell.py index 97e61e1169..b86dc9753c 100644 --- a/bitbake/lib/bb/shell.py +++ b/bitbake/lib/bb/shell.py | |||
@@ -18,6 +18,12 @@ | |||
18 | # Place, Suite 330, Boston, MA 02111-1307 USA. | 18 | # Place, Suite 330, Boston, MA 02111-1307 USA. |
19 | # | 19 | # |
20 | ########################################################################## | 20 | ########################################################################## |
21 | # | ||
22 | # Thanks to: | ||
23 | # * Holger Freyther <zecke@handhelds.org> | ||
24 | # * Justin Patrin <papercrane@reversefold.com> | ||
25 | # | ||
26 | ########################################################################## | ||
21 | 27 | ||
22 | """ | 28 | """ |
23 | BitBake Shell | 29 | BitBake Shell |
@@ -53,7 +59,7 @@ import sys, os, imp, readline, socket, httplib, urllib, commands, popen2, copy, | |||
53 | imp.load_source( "bitbake", os.path.dirname( sys.argv[0] )+"/bitbake" ) | 59 | imp.load_source( "bitbake", os.path.dirname( sys.argv[0] )+"/bitbake" ) |
54 | from bb import data, parse, build, fatal | 60 | from bb import data, parse, build, fatal |
55 | 61 | ||
56 | __version__ = "0.5.2" | 62 | __version__ = "0.5.3" |
57 | __credits__ = """BitBake Shell Version %s (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 63 | __credits__ = """BitBake Shell Version %s (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
58 | Type 'help' for more information, press CTRL-D to exit.""" % __version__ | 64 | Type 'help' for more information, press CTRL-D to exit.""" % __version__ |
59 | 65 | ||
@@ -151,7 +157,7 @@ class BitBakeShellCommands: | |||
151 | 157 | ||
152 | for name in names: | 158 | for name in names: |
153 | try: | 159 | try: |
154 | cooker.buildProvider( name ) | 160 | cooker.buildProvider( name, data.getVar("BUILD_ALL_DEPS", cooker.configuration.data, True) ) |
155 | except build.EventException, e: | 161 | except build.EventException, e: |
156 | print "ERROR: Couldn't build '%s'" % name | 162 | print "ERROR: Couldn't build '%s'" % name |
157 | global last_exception | 163 | global last_exception |
@@ -252,6 +258,19 @@ class BitBakeShellCommands: | |||
252 | self.fileBuild( params ) | 258 | self.fileBuild( params ) |
253 | fileRebuild.usage = "<bbfile>" | 259 | fileRebuild.usage = "<bbfile>" |
254 | 260 | ||
261 | def fileReparse( self, params ): | ||
262 | """(re)Parse a bb file""" | ||
263 | bbfile = params[0] | ||
264 | print "SHELL: Parsing '%s'" % bbfile | ||
265 | parse.update_mtime( bbfile ) | ||
266 | bb_data, fromCache = cooker.load_bbfile( bbfile ) | ||
267 | cooker.pkgdata[bbfile] = bb_data | ||
268 | if fromCache: | ||
269 | print "SHELL: File has not been updated, not reparsing" | ||
270 | else: | ||
271 | print "SHELL: Parsed" | ||
272 | fileReparse.usage = "<bbfile>" | ||
273 | |||
255 | def force( self, params ): | 274 | def force( self, params ): |
256 | """Toggle force task execution flag (see bitbake -f)""" | 275 | """Toggle force task execution flag (see bitbake -f)""" |
257 | cooker.configuration.force = not cooker.configuration.force | 276 | cooker.configuration.force = not cooker.configuration.force |
@@ -391,6 +410,16 @@ SRC_URI = "" | |||
391 | parsed = True | 410 | parsed = True |
392 | 411 | ||
393 | 412 | ||
413 | def reparse( self, params ): | ||
414 | """(re)Parse a providee's bb file""" | ||
415 | bbfile = self._findProvider( params[0] ) | ||
416 | if bbfile is not None: | ||
417 | print "SHELL: Found bbfile '%s' for '%s'" % ( bbfile, params[0] ) | ||
418 | self.fileReparse( [ bbfile ] ) | ||
419 | else: | ||
420 | print "ERROR: Nothing provides '%s'" % params[0] | ||
421 | reparse.usage = "<providee>" | ||
422 | |||
394 | def getvar( self, params ): | 423 | def getvar( self, params ): |
395 | """Dump the contents of an outer BitBake environment variable""" | 424 | """Dump the contents of an outer BitBake environment variable""" |
396 | var = params[0] | 425 | var = params[0] |
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index ee8713a2d0..e2319aa123 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -69,3 +69,27 @@ def vercmp(ta, tb): | |||
69 | if (r == 0): | 69 | if (r == 0): |
70 | r = vercmp_part(ra, rb) | 70 | r = vercmp_part(ra, rb) |
71 | return r | 71 | return r |
72 | |||
73 | def explode_deps(s): | ||
74 | """ | ||
75 | Take an RDEPENDS style string of format: | ||
76 | "DEPEND1 (optional version) DEPEND2 (optional version) ..." | ||
77 | and return a list of dependencies. | ||
78 | Version information is ignored. | ||
79 | """ | ||
80 | r = [] | ||
81 | l = s.split() | ||
82 | flag = False | ||
83 | for i in l: | ||
84 | if i[0] == '(': | ||
85 | flag = True | ||
86 | j = [] | ||
87 | if flag: | ||
88 | j.append(i) | ||
89 | if i.endswith(')'): | ||
90 | flag = False | ||
91 | # Ignore version | ||
92 | #r[-1] += ' ' + ' '.join(j) | ||
93 | else: | ||
94 | r.append(i) | ||
95 | return r | ||