diff options
Diffstat (limited to 'bitbake/lib/bb/cache.py')
-rw-r--r-- | bitbake/lib/bb/cache.py | 71 |
1 files changed, 5 insertions, 66 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index 988c596c39..4d715e911d 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py | |||
@@ -280,75 +280,14 @@ def variant2virtual(realfn, variant): | |||
280 | return "mc:" + elems[1] + ":" + realfn | 280 | return "mc:" + elems[1] + ":" + realfn |
281 | return "virtual:" + variant + ":" + realfn | 281 | return "virtual:" + variant + ":" + realfn |
282 | 282 | ||
283 | def parse_recipe(bb_data, bbfile, appends, mc=''): | ||
284 | """ | ||
285 | Parse a recipe | ||
286 | """ | ||
287 | |||
288 | bb_data.setVar("__BBMULTICONFIG", mc) | ||
289 | |||
290 | bbfile_loc = os.path.abspath(os.path.dirname(bbfile)) | ||
291 | bb.parse.cached_mtime_noerror(bbfile_loc) | ||
292 | |||
293 | if appends: | ||
294 | bb_data.setVar('__BBAPPEND', " ".join(appends)) | ||
295 | bb_data = bb.parse.handle(bbfile, bb_data) | ||
296 | return bb_data | ||
297 | |||
298 | |||
299 | class NoCache(object): | ||
300 | |||
301 | def __init__(self, databuilder): | ||
302 | self.databuilder = databuilder | ||
303 | self.data = databuilder.data | ||
304 | |||
305 | def loadDataFull(self, virtualfn, appends): | ||
306 | """ | ||
307 | Return a complete set of data for fn. | ||
308 | To do this, we need to parse the file. | ||
309 | """ | ||
310 | logger.debug("Parsing %s (full)" % virtualfn) | ||
311 | (fn, virtual, mc) = virtualfn2realfn(virtualfn) | ||
312 | bb_data = self.load_bbfile(virtualfn, appends, virtonly=True) | ||
313 | return bb_data[virtual] | ||
314 | |||
315 | def load_bbfile(self, bbfile, appends, virtonly = False, mc=None): | ||
316 | """ | ||
317 | Load and parse one .bb build file | ||
318 | Return the data and whether parsing resulted in the file being skipped | ||
319 | """ | ||
320 | |||
321 | if virtonly: | ||
322 | (bbfile, virtual, mc) = virtualfn2realfn(bbfile) | ||
323 | bb_data = self.databuilder.mcdata[mc].createCopy() | ||
324 | bb_data.setVar("__ONLYFINALISE", virtual or "default") | ||
325 | datastores = parse_recipe(bb_data, bbfile, appends, mc) | ||
326 | return datastores | ||
327 | |||
328 | if mc is not None: | ||
329 | bb_data = self.databuilder.mcdata[mc].createCopy() | ||
330 | return parse_recipe(bb_data, bbfile, appends, mc) | ||
331 | 283 | ||
332 | bb_data = self.data.createCopy() | 284 | class Cache(object): |
333 | datastores = parse_recipe(bb_data, bbfile, appends) | ||
334 | |||
335 | for mc in self.databuilder.mcdata: | ||
336 | if not mc: | ||
337 | continue | ||
338 | bb_data = self.databuilder.mcdata[mc].createCopy() | ||
339 | newstores = parse_recipe(bb_data, bbfile, appends, mc) | ||
340 | for ns in newstores: | ||
341 | datastores["mc:%s:%s" % (mc, ns)] = newstores[ns] | ||
342 | |||
343 | return datastores | ||
344 | |||
345 | class Cache(NoCache): | ||
346 | """ | 285 | """ |
347 | BitBake Cache implementation | 286 | BitBake Cache implementation |
348 | """ | 287 | """ |
349 | def __init__(self, databuilder, mc, data_hash, caches_array): | 288 | def __init__(self, databuilder, mc, data_hash, caches_array): |
350 | super().__init__(databuilder) | 289 | self.databuilder = databuilder |
351 | data = databuilder.data | 290 | self.data = databuilder.data |
352 | 291 | ||
353 | # Pass caches_array information into Cache Constructor | 292 | # Pass caches_array information into Cache Constructor |
354 | # It will be used later for deciding whether we | 293 | # It will be used later for deciding whether we |
@@ -356,7 +295,7 @@ class Cache(NoCache): | |||
356 | self.mc = mc | 295 | self.mc = mc |
357 | self.logger = PrefixLoggerAdapter("Cache: %s: " % (mc if mc else "default"), logger) | 296 | self.logger = PrefixLoggerAdapter("Cache: %s: " % (mc if mc else "default"), logger) |
358 | self.caches_array = caches_array | 297 | self.caches_array = caches_array |
359 | self.cachedir = data.getVar("CACHE") | 298 | self.cachedir = self.data.getVar("CACHE") |
360 | self.clean = set() | 299 | self.clean = set() |
361 | self.checked = set() | 300 | self.checked = set() |
362 | self.depends_cache = {} | 301 | self.depends_cache = {} |
@@ -486,7 +425,7 @@ class Cache(NoCache): | |||
486 | """Parse the specified filename, returning the recipe information""" | 425 | """Parse the specified filename, returning the recipe information""" |
487 | self.logger.debug("Parsing %s", filename) | 426 | self.logger.debug("Parsing %s", filename) |
488 | infos = [] | 427 | infos = [] |
489 | datastores = self.load_bbfile(filename, appends, mc=self.mc) | 428 | datastores = self.databuilder.parseRecipeVariants(filename, appends, mc=self.mc) |
490 | depends = [] | 429 | depends = [] |
491 | variants = [] | 430 | variants = [] |
492 | # Process the "real" fn last so we can store variants list | 431 | # Process the "real" fn last so we can store variants list |