1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 00:59:48 +00:00

Update bitbake to latest bitbake svn

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@262 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie
2006-02-10 10:11:32 +00:00
parent 9a262964c8
commit 62dc8f47b3
11 changed files with 325 additions and 39 deletions
+1 -1
View File
@@ -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__ = [
+6 -3
View File
@@ -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()
+16 -3
View File
@@ -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
+31 -2
View File
@@ -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]
+24
View File
@@ -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