bitbake-dev: Sync with bitbake upstream

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
Richard Purdie 2010-01-20 18:39:00 +00:00
parent d6c7a44b94
commit 1bfd6edef9
5 changed files with 80 additions and 69 deletions

View File

@ -134,7 +134,18 @@ class Cache:
self.data = data self.data = data
# Make sure __depends makes the depends_cache # Make sure __depends makes the depends_cache
self.getVar("__depends", virtualfn, True) # If we're a virtual class we need to make sure all our depends are appended
# to the depends of fn.
depends = self.getVar("__depends", virtualfn, True) or []
if "__depends" not in self.depends_cache[fn] or not self.depends_cache[fn]["__depends"]:
self.depends_cache[fn]["__depends"] = depends
for dep in depends:
if dep not in self.depends_cache[fn]["__depends"]:
self.depends_cache[fn]["__depends"].append(dep)
# Make sure BBCLASSEXTEND always makes the cache too
self.getVar('BBCLASSEXTEND', virtualfn, True)
self.depends_cache[virtualfn]["CACHETIMESTAMP"] = bb.parse.cached_mtime(fn) self.depends_cache[virtualfn]["CACHETIMESTAMP"] = bb.parse.cached_mtime(fn)
def virtualfn2realfn(self, virtualfn): def virtualfn2realfn(self, virtualfn):
@ -170,11 +181,8 @@ class Cache:
bb.msg.debug(1, bb.msg.domain.Cache, "Parsing %s (full)" % fn) bb.msg.debug(1, bb.msg.domain.Cache, "Parsing %s (full)" % fn)
bb_data, skipped = self.load_bbfile(fn, cfgData) bb_data = self.load_bbfile(fn, cfgData)
if isinstance(bb_data, dict): return bb_data[cls]
return bb_data[cls]
return bb_data
def loadData(self, fn, cfgData, cacheData): def loadData(self, fn, cfgData, cacheData):
""" """
@ -184,42 +192,39 @@ class Cache:
to record the variables accessed. to record the variables accessed.
Return the cache status and whether the file was skipped when parsed Return the cache status and whether the file was skipped when parsed
""" """
skipped = 0
virtuals = 0
if fn not in self.checked: if fn not in self.checked:
self.cacheValidUpdate(fn) self.cacheValidUpdate(fn)
if self.cacheValid(fn): if self.cacheValid(fn):
if "SKIPPED" in self.depends_cache[fn]:
return True, True
self.handle_data(fn, cacheData)
multi = self.getVar('BBCLASSEXTEND', fn, True) multi = self.getVar('BBCLASSEXTEND', fn, True)
if multi: for cls in (multi or "").split() + [""]:
for cls in multi.split(): virtualfn = self.realfn2virtual(fn, cls)
virtualfn = self.realfn2virtual(fn, cls) if self.depends_cache[virtualfn]["__SKIPPED"]:
# Pretend we're clean so getVar works skipped += 1
self.clean[virtualfn] = "" bb.msg.debug(1, bb.msg.domain.Cache, "Skipping %s" % virtualfn)
self.handle_data(virtualfn, cacheData) continue
return True, False self.handle_data(virtualfn, cacheData)
virtuals += 1
return True, skipped, virtuals
bb.msg.debug(1, bb.msg.domain.Cache, "Parsing %s" % fn) bb.msg.debug(1, bb.msg.domain.Cache, "Parsing %s" % fn)
bb_data, skipped = self.load_bbfile(fn, cfgData) bb_data = self.load_bbfile(fn, cfgData)
if skipped: for data in bb_data:
if isinstance(bb_data, dict): virtualfn = self.realfn2virtual(fn, data)
self.setData(fn, fn, bb_data[""]) self.setData(virtualfn, fn, bb_data[data])
else: if self.getVar("__SKIPPED", virtualfn, True):
self.setData(fn, fn, bb_data) skipped += 1
return False, skipped bb.msg.debug(1, bb.msg.domain.Cache, "Skipping %s" % virtualfn)
else:
if isinstance(bb_data, dict):
for data in bb_data:
virtualfn = self.realfn2virtual(fn, data)
self.setData(virtualfn, fn, bb_data[data])
self.handle_data(virtualfn, cacheData) self.handle_data(virtualfn, cacheData)
return False, skipped virtuals += 1
return False, skipped, virtuals
self.setData(fn, fn, bb_data)
self.handle_data(fn, cacheData)
return False, skipped
def cacheValid(self, fn): def cacheValid(self, fn):
""" """
@ -286,16 +291,13 @@ class Cache:
if not fn in self.clean: if not fn in self.clean:
self.clean[fn] = "" self.clean[fn] = ""
return True # Mark extended class data as clean too
multi = self.getVar('BBCLASSEXTEND', fn, True)
for cls in (multi or "").split():
virtualfn = self.realfn2virtual(fn, cls)
self.clean[virtualfn] = ""
def skip(self, fn): return True
"""
Mark a fn as skipped
Called from the parser
"""
if not fn in self.depends_cache:
self.depends_cache[fn] = {}
self.depends_cache[fn]["SKIPPED"] = "1"
def remove(self, fn): def remove(self, fn):
""" """
@ -462,10 +464,7 @@ class Cache:
try: try:
bb_data = parse.handle(bbfile, bb_data) # read .bb data bb_data = parse.handle(bbfile, bb_data) # read .bb data
os.chdir(oldpath) os.chdir(oldpath)
return bb_data, False return bb_data
except bb.parse.SkipPackage:
os.chdir(oldpath)
return bb_data, True
except: except:
os.chdir(oldpath) os.chdir(oldpath)
raise raise

View File

@ -923,11 +923,13 @@ class CookerParser:
# Accounting statistics # Accounting statistics
self.parsed = 0 self.parsed = 0
self.cached = 0 self.cached = 0
self.skipped = 0
self.error = 0 self.error = 0
self.masked = masked self.masked = masked
self.total = len(filelist) self.total = len(filelist)
self.skipped = 0
self.virtuals = 0
# Pointer to the next file to parse # Pointer to the next file to parse
self.pointer = 0 self.pointer = 0
@ -937,13 +939,14 @@ class CookerParser:
cooker = self.cooker cooker = self.cooker
try: try:
fromCache, skip = cooker.bb_cache.loadData(f, cooker.configuration.data, cooker.status) fromCache, skipped, virtuals = cooker.bb_cache.loadData(f, cooker.configuration.data, cooker.status)
if skip: if fromCache:
self.skipped += 1 self.cached += 1
bb.msg.debug(2, bb.msg.domain.Collection, "skipping %s" % f) else:
cooker.bb_cache.skip(f) self.parsed += 1
elif fromCache: self.cached += 1
else: self.parsed += 1 self.skipped += skipped
self.virtuals += virtuals
except IOError, e: except IOError, e:
self.error += 1 self.error += 1
@ -962,7 +965,7 @@ class CookerParser:
cooker.bb_cache.remove(f) cooker.bb_cache.remove(f)
raise raise
finally: finally:
bb.event.fire(bb.event.ParseProgress(self.cached, self.parsed, self.skipped, self.masked, self.error, self.total), cooker.configuration.event_data) bb.event.fire(bb.event.ParseProgress(self.cached, self.parsed, self.skipped, self.masked, self.virtuals, self.error, self.total), cooker.configuration.event_data)
self.pointer += 1 self.pointer += 1

View File

@ -253,14 +253,15 @@ class ParseProgress(Event):
Parsing Progress Event Parsing Progress Event
""" """
def __init__(self, cached, parsed, skipped, masked, errors, total): def __init__(self, cached, parsed, skipped, masked, virtuals, errors, total):
Event.__init__(self) Event.__init__(self)
self.cached = cached self.cached = cached
self.parsed = parsed self.parsed = parsed
self.skipped = skipped self.skipped = skipped
self.virtuals = virtuals
self.masked = masked self.masked = masked
self.errors = errors self.errors = errors
self.sofar = cached + parsed + skipped self.sofar = cached + parsed
self.total = total self.total = total
class DepTreeGenerated(Event): class DepTreeGenerated(Event):

View File

@ -185,18 +185,26 @@ def handle(fn, d, include = 0):
multi = data.getVar('BBCLASSEXTEND', d, 1) multi = data.getVar('BBCLASSEXTEND', d, 1)
if multi: if multi:
based = bb.data.createCopy(d) based = bb.data.createCopy(d)
finalise(fn, based)
darray = {"": based}
for cls in multi.split():
pn = data.getVar('PN', d, True)
based = bb.data.createCopy(d)
data.setVar('PN', pn + '-' + cls, based)
inherit([cls], based)
finalise(fn, based)
darray[cls] = based
return darray
else: else:
finalise(fn, d) based = d
try:
finalise(fn, based)
except bb.parse.SkipPackage:
bb.data.setVar("__SKIPPED", True, based)
darray = {"": based}
for cls in (multi or "").split():
pn = data.getVar('PN', d, True)
based = bb.data.createCopy(d)
data.setVar('PN', pn + '-' + cls, based)
inherit([cls], based)
try:
finalise(fn, based)
except bb.parse.SkipPackage:
bb.data.setVar("__SKIPPED", True, based)
darray[cls] = based
return darray
bbpath.pop(0) bbpath.pop(0)
if oldfile: if oldfile:
bb.data.setVar("FILE", oldfile, d) bb.data.setVar("FILE", oldfile, d)

View File

@ -114,8 +114,8 @@ def init(server, eventHandler):
sys.stdout.write("done.") sys.stdout.write("done.")
sys.stdout.flush() sys.stdout.flush()
if x == y: if x == y:
print("\nParsing finished. %d cached, %d parsed, %d skipped, %d masked, %d errors." print("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors."
% ( event.cached, event.parsed, event.skipped, event.masked, event.errors)) % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))
continue continue
if isinstance(event, bb.command.CookerCommandCompleted): if isinstance(event, bb.command.CookerCommandCompleted):