summaryrefslogtreecommitdiff
path: root/bitbake/lib
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
parent9a262964c8b5c5a21a68d9b66ab9259b3737999f (diff)
downloadopenembedded-core-62dc8f47b3c17cf0b1a5d4bf4f0173d5d4fb4c1a.tar.gz
openembedded-core-62dc8f47b3c17cf0b1a5d4bf4f0173d5d4fb4c1a.tar.bz2
openembedded-core-62dc8f47b3c17cf0b1a5d4bf4f0173d5d4fb4c1a.tar.xz
openembedded-core-62dc8f47b3c17cf0b1a5d4bf4f0173d5d4fb4c1a.zip
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')
-rw-r--r--bitbake/lib/bb/__init__.py2
-rw-r--r--bitbake/lib/bb/parse/__init__.py9
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py19
-rw-r--r--bitbake/lib/bb/shell.py33
-rw-r--r--bitbake/lib/bb/utils.py24
5 files changed, 78 insertions, 9 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
index 00b0e8b57..f27f53b39 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
Place, Suite 330, Boston, MA 02111-1307 USA.
"""
-__version__ = "1.3.2"
+__version__ = "1.3.2.1"
__all__ = [
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py
index b8839c09f..cb2741606 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',
'supports', 'handle', 'init' ]
handlers = []
+import bb, os
+
class ParseError(Exception):
"""Exception raised when parsing fails"""
@@ -34,13 +36,14 @@ class SkipPackage(Exception):
__mtime_cache = {}
def cached_mtime(f):
- import os
if not __mtime_cache.has_key(f):
- __mtime_cache[f] = os.stat(f)[8]
+ update_mtime(f)
return __mtime_cache[f]
+def update_mtime(f):
+ __mtime_cache[f] = os.stat(f)[8]
+
def mark_dependency(d, f):
- import bb, os
if f.startswith('./'):
f = "%s/%s" % (os.getcwd(), f[2:])
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 41ef96d55..90978300a 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
#__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)$")
__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)$")
__include_regexp__ = re.compile( r"include\s+(.+)" )
+__require_regexp__ = re.compile( r"require\s+(.+)" )
def init(data):
if not bb.data.getVar('TOPDIR', data):
@@ -83,7 +84,11 @@ def obtain(fn, data = bb.data.init()):
return localfn
-def include(oldfn, fn, data = bb.data.init()):
+def include(oldfn, fn, data = bb.data.init(), error_out = False):
+ """
+
+ error_out If True a ParseError will be reaised if the to be included
+ """
if oldfn == fn: # prevent infinate recursion
return None
@@ -93,8 +98,10 @@ def include(oldfn, fn, data = bb.data.init()):
from bb.parse import handle
try:
- ret = handle(fn, data, 1)
+ ret = handle(fn, data, True)
except IOError:
+ if error_out:
+ raise ParseError("Could not include required file %(fn)s" % vars() )
debug(2, "CONF file '%s' not found" % fn)
def handle(fn, data = bb.data.init(), include = 0):
@@ -125,7 +132,7 @@ def handle(fn, data = bb.data.init(), include = 0):
debug(1, "CONF %s %s" % (inc_string, currname))
break
if f is None:
- raise IOError("file not found")
+ raise IOError("file '%s' not found" % fn)
else:
f = open(fn,'r')
debug(1, "CONF %s %s" % (inc_string,fn))
@@ -191,6 +198,12 @@ def feeder(lineno, s, fn, data = bb.data.init()):
include(fn, s, data)
return
+ m = __require_regexp__.match(s)
+ if m:
+ s = bb.data.expand(m.group(1), data)
+ include(fn, s, data, True)
+ return
+
raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s));
# Add us to the handlers list
diff --git a/bitbake/lib/bb/shell.py b/bitbake/lib/bb/shell.py
index 97e61e116..b86dc9753 100644
--- a/bitbake/lib/bb/shell.py
+++ b/bitbake/lib/bb/shell.py
@@ -18,6 +18,12 @@
# Place, Suite 330, Boston, MA 02111-1307 USA.
#
##########################################################################
+#
+# Thanks to:
+# * Holger Freyther <zecke@handhelds.org>
+# * Justin Patrin <papercrane@reversefold.com>
+#
+##########################################################################
"""
BitBake Shell
@@ -53,7 +59,7 @@ import sys, os, imp, readline, socket, httplib, urllib, commands, popen2, copy,
imp.load_source( "bitbake", os.path.dirname( sys.argv[0] )+"/bitbake" )
from bb import data, parse, build, fatal
-__version__ = "0.5.2"
+__version__ = "0.5.3"
__credits__ = """BitBake Shell Version %s (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
Type 'help' for more information, press CTRL-D to exit.""" % __version__
@@ -151,7 +157,7 @@ class BitBakeShellCommands:
for name in names:
try:
- cooker.buildProvider( name )
+ cooker.buildProvider( name, data.getVar("BUILD_ALL_DEPS", cooker.configuration.data, True) )
except build.EventException, e:
print "ERROR: Couldn't build '%s'" % name
global last_exception
@@ -252,6 +258,19 @@ class BitBakeShellCommands:
self.fileBuild( params )
fileRebuild.usage = "<bbfile>"
+ def fileReparse( self, params ):
+ """(re)Parse a bb file"""
+ bbfile = params[0]
+ print "SHELL: Parsing '%s'" % bbfile
+ parse.update_mtime( bbfile )
+ bb_data, fromCache = cooker.load_bbfile( bbfile )
+ cooker.pkgdata[bbfile] = bb_data
+ if fromCache:
+ print "SHELL: File has not been updated, not reparsing"
+ else:
+ print "SHELL: Parsed"
+ fileReparse.usage = "<bbfile>"
+
def force( self, params ):
"""Toggle force task execution flag (see bitbake -f)"""
cooker.configuration.force = not cooker.configuration.force
@@ -391,6 +410,16 @@ SRC_URI = ""
parsed = True
print
+ def reparse( self, params ):
+ """(re)Parse a providee's bb file"""
+ bbfile = self._findProvider( params[0] )
+ if bbfile is not None:
+ print "SHELL: Found bbfile '%s' for '%s'" % ( bbfile, params[0] )
+ self.fileReparse( [ bbfile ] )
+ else:
+ print "ERROR: Nothing provides '%s'" % params[0]
+ reparse.usage = "<providee>"
+
def getvar( self, params ):
"""Dump the contents of an outer BitBake environment variable"""
var = params[0]
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index ee8713a2d..e2319aa12 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -69,3 +69,27 @@ def vercmp(ta, tb):
if (r == 0):
r = vercmp_part(ra, rb)
return r
+
+def explode_deps(s):
+ """
+ Take an RDEPENDS style string of format:
+ "DEPEND1 (optional version) DEPEND2 (optional version) ..."
+ and return a list of dependencies.
+ Version information is ignored.
+ """
+ r = []
+ l = s.split()
+ flag = False
+ for i in l:
+ if i[0] == '(':
+ flag = True
+ j = []
+ if flag:
+ j.append(i)
+ if i.endswith(')'):
+ flag = False
+ # Ignore version
+ #r[-1] += ' ' + ' '.join(j)
+ else:
+ r.append(i)
+ return r