aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-11-19 11:46:42 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:43 +0000
commit739bb5a2d1c821b8e44c0551bdd0fd323000b6af (patch)
treec07440b40343cf4b807618f0eae7e5dd1739bda8 /bitbake/lib/bb/cooker.py
parent065da895d2b5eced3e444b20627f8f460e6d14c7 (diff)
downloadopenembedded-core-contrib-739bb5a2d1c821b8e44c0551bdd0fd323000b6af.tar.gz
cooker: stop loading the cache for -b
Previously, the cache was actually being loaded from disk twice whenever using -b or -e -b. This also moves the bb_cache instance into the CookerParser, as it's not needed by the cooker itself at all. (Bitbake rev: dd0ec2f7b18e2a9ab06c499b775670516bd06ac8) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py53
1 files changed, 28 insertions, 25 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 53f88b253c..b573c32ed9 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -75,9 +75,7 @@ class BBCooker:
def __init__(self, configuration, server):
self.status = None
-
- self.cache = None
- self.bb_cache = None
+ self.appendlist = {}
if server:
self.server = server.BitBakeServer(self)
@@ -217,8 +215,6 @@ class BBCooker:
envdata = None
if buildfile:
- self.cb = None
- self.bb_cache = bb.cache.init(self)
fn = self.matchFile(buildfile)
elif len(pkgs_to_build) == 1:
self.updateCache()
@@ -239,7 +235,7 @@ class BBCooker:
if fn:
try:
- envdata = self.bb_cache.loadDataFull(fn, self.get_file_appends(fn), self.configuration.data)
+ envdata = bb.cache.Cache.loadDataFull(fn, self.get_file_appends(fn), self.configuration.data)
except Exception, e:
parselog.exception("Unable to read %s", fn)
raise
@@ -601,7 +597,7 @@ class BBCooker:
"""
bf = os.path.abspath(buildfile)
- (filelist, masked) = self.collect_bbfiles()
+ filelist, masked = self.collect_bbfiles()
try:
os.stat(bf)
return [bf]
@@ -640,21 +636,25 @@ class BBCooker:
if (task == None):
task = self.configuration.cmd
- self.bb_cache = bb.cache.init(self)
self.status = bb.cache.CacheData()
- (fn, cls) = self.bb_cache.virtualfn2realfn(buildfile)
+ (fn, cls) = bb.cache.Cache.virtualfn2realfn(buildfile)
buildfile = self.matchFile(fn)
- fn = self.bb_cache.realfn2virtual(buildfile, cls)
+ fn = bb.cache.Cache.realfn2virtual(buildfile, cls)
self.buildSetVars()
- # Load data into the cache for fn and parse the loaded cache data
- the_data = self.bb_cache.loadDataFull(fn, self.get_file_appends(fn), self.configuration.data)
- self.bb_cache.add(fn, the_data, self.status)
+ self.status = bb.cache.CacheData()
+ infos = bb.cache.Cache.parse(fn, self.get_file_appends(fn), \
+ self.configuration.data)
+ maininfo = None
+ for vfn, info in infos:
+ self.status.add_from_recipeinfo(vfn, info)
+ if vfn == fn:
+ maininfo = info
# Tweak some variables
- item = self.bb_cache.getVar('PN', fn, True)
+ item = maininfo.pn
self.status.ignored_dependencies = set()
self.status.bbfile_priority[fn] = 1
@@ -852,7 +852,6 @@ class BBCooker:
def collect_bbfiles( self ):
"""Collect all available .bb build files"""
parsed, cached, skipped, masked = 0, 0, 0, 0
- self.bb_cache = bb.cache.init(self)
collectlog.debug(1, "collecting .bb files")
@@ -901,7 +900,6 @@ class BBCooker:
collectlog.debug(1, "skipping %s: unknown file extension", f)
# Build a list of .bbappend files for each .bb file
- self.appendlist = {}
for f in bbappend:
base = os.path.basename(f).replace('.bbappend', '.bb')
if not base in self.appendlist:
@@ -913,7 +911,7 @@ class BBCooker:
def get_file_appends(self, fn):
"""
Returns a list of .bbappend files to apply to fn
- NB: collect_files() must have been called prior to this
+ NB: collect_bbfiles() must have been called prior to this
"""
f = os.path.basename(fn)
if f in self.appendlist:
@@ -981,10 +979,10 @@ class CookerExit(bb.event.Event):
class CookerParser(object):
def __init__(self, cooker, filelist, masked):
- # Internal data
self.filelist = filelist
self.cooker = cooker
self.cfgdata = cooker.configuration.data
+ self.bb_cache = bb.cache.Cache(self.cfgdata)
# Accounting statistics
self.parsed = 0
@@ -996,7 +994,6 @@ class CookerParser(object):
self.virtuals = 0
self.total = len(filelist)
- # current to the next file to parse
self.current = 0
self.result_queue = None
self.fromcache = None
@@ -1010,7 +1007,7 @@ class CookerParser(object):
self.fromcache = []
for filename in self.filelist:
appends = self.cooker.get_file_appends(filename)
- if not self.cooker.bb_cache.cacheValid(filename):
+ if not self.bb_cache.cacheValid(filename):
self.task_queue.put((filename, appends))
else:
self.fromcache.append((filename, appends))
@@ -1042,13 +1039,19 @@ class CookerParser(object):
self.task_queue.close()
for process in self.processes:
process.join()
- threading.Thread(target=self.cooker.bb_cache.sync).start()
+ threading.Thread(target=self.bb_cache.sync).start()
threading.Thread(target=bb.codeparser.parser_cache_save(self.cooker.configuration.data)).start()
if self.error > 0:
raise ParsingErrorsFound()
+ def reparse(self, filename):
+ infos = self.bb_cache.parse(filename,
+ self.cooker.get_file_appends(filename),
+ self.cfgdata)
+ for vfn, info in infos:
+ self.cooker.status.add_from_recipeinfo(vfn, info)
+
def parse_next(self):
- cooker = self.cooker
if self.current >= self.total:
event = bb.event.ParseCompleted(self.cached, self.parsed,
self.skipped, self.masked,
@@ -1064,7 +1067,7 @@ class CookerParser(object):
try:
if self.result_queue.empty() and self.fromcache:
filename, appends = self.fromcache.pop()
- _, infos = cooker.bb_cache.load(filename, appends, self.cfgdata)
+ _, infos = self.bb_cache.load(filename, appends, self.cfgdata)
parsed = False
else:
infos = self.result_queue.get()
@@ -1083,8 +1086,8 @@ class CookerParser(object):
self.virtuals += len(infos)
for virtualfn, info in infos:
- cooker.bb_cache.add_info(virtualfn, info, cooker.status,
- parsed=parsed)
+ self.bb_cache.add_info(virtualfn, info, self.cooker.status,
+ parsed=parsed)
if info.skipped:
self.skipped += 1
finally: