summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-15 18:03:29 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-18 10:06:26 +0100
commitb50b14e37249fb23b8e4f3a86f9b245cba85ca86 (patch)
tree9e7becee9892a76b9468513414c2e257290fde22 /bitbake/lib/bb/cooker.py
parentb176189df1163d92aaec8b565bf69dcf76bab458 (diff)
downloadpoky-b50b14e37249fb23b8e4f3a86f9b245cba85ca86.tar.gz
bitbake: cache: Build datastores from databuilder object
Rather than passing in a datastore to build on top of, use the data builder object in the cache and base the parsed recipe from this. This turns things into proper objects building from one another rather than messy mixes of static and class functions. This sets things up so we can support parsing and building multiple configurations. (Bitbake rev: fef18b445c0cb6b266cd939b9c78d7cbce38663f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 43c4f78dbc..fe95e73a12 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -617,7 +617,8 @@ class BBCooker:
617 617
618 if fn: 618 if fn:
619 try: 619 try:
620 envdata = bb.cache.Cache.loadDataFull(fn, self.collection.get_file_appends(fn), self.data) 620 bb_cache = bb.cache.Cache(self.databuilder, self.data_hash, self.caches_array)
621 envdata = bb_cache.loadDataFull(fn, self.collection.get_file_appends(fn))
621 except Exception as e: 622 except Exception as e:
622 parselog.exception("Unable to read %s", fn) 623 parselog.exception("Unable to read %s", fn)
623 raise 624 raise
@@ -1254,9 +1255,9 @@ class BBCooker:
1254 1255
1255 self.buildSetVars() 1256 self.buildSetVars()
1256 1257
1257 infos = bb.cache.Cache.parse(fn, self.collection.get_file_appends(fn), \ 1258 bb_cache = bb.cache.Cache(self.databuilder, self.data_hash, self.caches_array)
1258 self.data, 1259
1259 self.caches_array) 1260 infos = bb_cache.parse(fn, self.collection.get_file_appends(fn))
1260 infos = dict(infos) 1261 infos = dict(infos)
1261 1262
1262 fn = bb.cache.realfn2virtual(fn, cls) 1263 fn = bb.cache.realfn2virtual(fn, cls)
@@ -1943,7 +1944,7 @@ class Parser(multiprocessing.Process):
1943 except queue.Full: 1944 except queue.Full:
1944 pending.append(result) 1945 pending.append(result)
1945 1946
1946 def parse(self, filename, appends, caches_array): 1947 def parse(self, filename, appends):
1947 try: 1948 try:
1948 # Record the filename we're parsing into any events generated 1949 # Record the filename we're parsing into any events generated
1949 def parse_filter(self, record): 1950 def parse_filter(self, record):
@@ -1956,7 +1957,7 @@ class Parser(multiprocessing.Process):
1956 bb.event.set_class_handlers(self.handlers.copy()) 1957 bb.event.set_class_handlers(self.handlers.copy())
1957 bb.event.LogHandler.filter = parse_filter 1958 bb.event.LogHandler.filter = parse_filter
1958 1959
1959 return True, bb.cache.Cache.parse(filename, appends, self.cfg, caches_array) 1960 return True, self.bb_cache.parse(filename, appends)
1960 except Exception as exc: 1961 except Exception as exc:
1961 tb = sys.exc_info()[2] 1962 tb = sys.exc_info()[2]
1962 exc.recipe = filename 1963 exc.recipe = filename
@@ -1995,7 +1996,7 @@ class CookerParser(object):
1995 for filename in self.filelist: 1996 for filename in self.filelist:
1996 appends = self.cooker.collection.get_file_appends(filename) 1997 appends = self.cooker.collection.get_file_appends(filename)
1997 if not self.bb_cache.cacheValid(filename, appends): 1998 if not self.bb_cache.cacheValid(filename, appends):
1998 self.willparse.append((filename, appends, cooker.caches_array)) 1999 self.willparse.append((filename, appends))
1999 else: 2000 else:
2000 self.fromcache.append((filename, appends)) 2001 self.fromcache.append((filename, appends))
2001 self.toparse = self.total - len(self.fromcache) 2002 self.toparse = self.total - len(self.fromcache)
@@ -2013,7 +2014,7 @@ class CookerParser(object):
2013 if self.toparse: 2014 if self.toparse:
2014 bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata) 2015 bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata)
2015 def init(): 2016 def init():
2016 Parser.cfg = self.cfgdata 2017 Parser.bb_cache = self.bb_cache
2017 bb.utils.set_process_name(multiprocessing.current_process().name) 2018 bb.utils.set_process_name(multiprocessing.current_process().name)
2018 multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, exitpriority=1) 2019 multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, exitpriority=1)
2019 multiprocessing.util.Finalize(None, bb.fetch.fetcher_parse_save, exitpriority=1) 2020 multiprocessing.util.Finalize(None, bb.fetch.fetcher_parse_save, exitpriority=1)
@@ -2084,7 +2085,7 @@ class CookerParser(object):
2084 2085
2085 def load_cached(self): 2086 def load_cached(self):
2086 for filename, appends in self.fromcache: 2087 for filename, appends in self.fromcache:
2087 cached, infos = self.bb_cache.load(filename, appends, self.cfgdata) 2088 cached, infos = self.bb_cache.load(filename, appends)
2088 yield not cached, infos 2089 yield not cached, infos
2089 2090
2090 def parse_generator(self): 2091 def parse_generator(self):
@@ -2168,8 +2169,6 @@ class CookerParser(object):
2168 return True 2169 return True
2169 2170
2170 def reparse(self, filename): 2171 def reparse(self, filename):
2171 infos = self.bb_cache.parse(filename, 2172 infos = self.bb_cache.parse(filename, self.cooker.collection.get_file_appends(filename))
2172 self.cooker.collection.get_file_appends(filename),
2173 self.cfgdata, self.cooker.caches_array)
2174 for vfn, info_array in infos: 2173 for vfn, info_array in infos:
2175 self.cooker.recipecache.add_from_recipeinfo(vfn, info_array) 2174 self.cooker.recipecache.add_from_recipeinfo(vfn, info_array)