From 62dc8f47b3c17cf0b1a5d4bf4f0173d5d4fb4c1a Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard@openedhand.com>
Date: Fri, 10 Feb 2006 10:11:32 +0000
Subject: Update bitbake to latest bitbake svn

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@262 311d38ba-8fff-0310-9ca6-ca027cbcb966
---
 bitbake/lib/bb/__init__.py                   |  2 +-
 bitbake/lib/bb/parse/__init__.py             |  9 +++++---
 bitbake/lib/bb/parse/parse_py/ConfHandler.py | 19 +++++++++++++---
 bitbake/lib/bb/shell.py                      | 33 ++++++++++++++++++++++++++--
 bitbake/lib/bb/utils.py                      | 24 ++++++++++++++++++++
 5 files changed, 78 insertions(+), 9 deletions(-)

(limited to 'bitbake/lib/bb')

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
 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 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',
             '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 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
 #__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 97e61e1169..b86dc9753c 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 ee8713a2d0..e2319aa123 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
-- 
cgit v1.2.3-54-g00ecf