summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cache.py
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2021-02-09 09:50:21 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-02-10 23:48:16 +0000
commit75f87db413f3659fee18eff389b7b339b01cce15 (patch)
treee733135549b516c72c4f34172b6bbf865377fc76 /bitbake/lib/bb/cache.py
parent7283a0b3b6ca49d0d2e13593333a580ef10439a8 (diff)
downloadpoky-75f87db413f3659fee18eff389b7b339b01cce15.tar.gz
bitbake: logging: Make bitbake logger compatible with python logger
The bitbake logger overrode the definition of the debug() logging call to include a debug level, but this causes problems with code that may be using standard python logging, since the extra argument is interpreted differently. Instead, change the bitbake loggers debug() call to match the python logger call and add a debug2() and debug3() API to replace calls that were logging to a different debug level. [RP: Small fix to ensure bb.debug calls bbdebug()] (Bitbake rev: f68682a79d83e6399eb403f30a1f113516575f51) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cache.py')
-rw-r--r--bitbake/lib/bb/cache.py52
1 files changed, 26 insertions, 26 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index c85effd6f0..aea2b8bc11 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -215,7 +215,7 @@ class CoreRecipeInfo(RecipeInfoCommon):
215 if not self.not_world: 215 if not self.not_world:
216 cachedata.possible_world.append(fn) 216 cachedata.possible_world.append(fn)
217 #else: 217 #else:
218 # logger.debug(2, "EXCLUDE FROM WORLD: %s", fn) 218 # logger.debug2("EXCLUDE FROM WORLD: %s", fn)
219 219
220 # create a collection of all targets for sanity checking 220 # create a collection of all targets for sanity checking
221 # tasks, such as upstream versions, license, and tools for 221 # tasks, such as upstream versions, license, and tools for
@@ -323,7 +323,7 @@ class NoCache(object):
323 Return a complete set of data for fn. 323 Return a complete set of data for fn.
324 To do this, we need to parse the file. 324 To do this, we need to parse the file.
325 """ 325 """
326 logger.debug(1, "Parsing %s (full)" % virtualfn) 326 logger.debug("Parsing %s (full)" % virtualfn)
327 (fn, virtual, mc) = virtualfn2realfn(virtualfn) 327 (fn, virtual, mc) = virtualfn2realfn(virtualfn)
328 bb_data = self.load_bbfile(virtualfn, appends, virtonly=True) 328 bb_data = self.load_bbfile(virtualfn, appends, virtonly=True)
329 return bb_data[virtual] 329 return bb_data[virtual]
@@ -400,7 +400,7 @@ class Cache(NoCache):
400 400
401 self.cachefile = self.getCacheFile("bb_cache.dat") 401 self.cachefile = self.getCacheFile("bb_cache.dat")
402 402
403 self.logger.debug(1, "Cache dir: %s", self.cachedir) 403 self.logger.debug("Cache dir: %s", self.cachedir)
404 bb.utils.mkdirhier(self.cachedir) 404 bb.utils.mkdirhier(self.cachedir)
405 405
406 cache_ok = True 406 cache_ok = True
@@ -408,7 +408,7 @@ class Cache(NoCache):
408 for cache_class in self.caches_array: 408 for cache_class in self.caches_array:
409 cachefile = self.getCacheFile(cache_class.cachefile) 409 cachefile = self.getCacheFile(cache_class.cachefile)
410 cache_exists = os.path.exists(cachefile) 410 cache_exists = os.path.exists(cachefile)
411 self.logger.debug(2, "Checking if %s exists: %r", cachefile, cache_exists) 411 self.logger.debug2("Checking if %s exists: %r", cachefile, cache_exists)
412 cache_ok = cache_ok and cache_exists 412 cache_ok = cache_ok and cache_exists
413 cache_class.init_cacheData(self) 413 cache_class.init_cacheData(self)
414 if cache_ok: 414 if cache_ok:
@@ -416,7 +416,7 @@ class Cache(NoCache):
416 elif os.path.isfile(self.cachefile): 416 elif os.path.isfile(self.cachefile):
417 self.logger.info("Out of date cache found, rebuilding...") 417 self.logger.info("Out of date cache found, rebuilding...")
418 else: 418 else:
419 self.logger.debug(1, "Cache file %s not found, building..." % self.cachefile) 419 self.logger.debug("Cache file %s not found, building..." % self.cachefile)
420 420
421 # We don't use the symlink, its just for debugging convinience 421 # We don't use the symlink, its just for debugging convinience
422 if self.mc: 422 if self.mc:
@@ -453,7 +453,7 @@ class Cache(NoCache):
453 453
454 for cache_class in self.caches_array: 454 for cache_class in self.caches_array:
455 cachefile = self.getCacheFile(cache_class.cachefile) 455 cachefile = self.getCacheFile(cache_class.cachefile)
456 self.logger.debug(1, 'Loading cache file: %s' % cachefile) 456 self.logger.debug('Loading cache file: %s' % cachefile)
457 with open(cachefile, "rb") as cachefile: 457 with open(cachefile, "rb") as cachefile:
458 pickled = pickle.Unpickler(cachefile) 458 pickled = pickle.Unpickler(cachefile)
459 # Check cache version information 459 # Check cache version information
@@ -500,7 +500,7 @@ class Cache(NoCache):
500 500
501 def parse(self, filename, appends): 501 def parse(self, filename, appends):
502 """Parse the specified filename, returning the recipe information""" 502 """Parse the specified filename, returning the recipe information"""
503 self.logger.debug(1, "Parsing %s", filename) 503 self.logger.debug("Parsing %s", filename)
504 infos = [] 504 infos = []
505 datastores = self.load_bbfile(filename, appends, mc=self.mc) 505 datastores = self.load_bbfile(filename, appends, mc=self.mc)
506 depends = [] 506 depends = []
@@ -554,7 +554,7 @@ class Cache(NoCache):
554 cached, infos = self.load(fn, appends) 554 cached, infos = self.load(fn, appends)
555 for virtualfn, info_array in infos: 555 for virtualfn, info_array in infos:
556 if info_array[0].skipped: 556 if info_array[0].skipped:
557 self.logger.debug(1, "Skipping %s: %s", virtualfn, info_array[0].skipreason) 557 self.logger.debug("Skipping %s: %s", virtualfn, info_array[0].skipreason)
558 skipped += 1 558 skipped += 1
559 else: 559 else:
560 self.add_info(virtualfn, info_array, cacheData, not cached) 560 self.add_info(virtualfn, info_array, cacheData, not cached)
@@ -590,21 +590,21 @@ class Cache(NoCache):
590 590
591 # File isn't in depends_cache 591 # File isn't in depends_cache
592 if not fn in self.depends_cache: 592 if not fn in self.depends_cache:
593 self.logger.debug(2, "%s is not cached", fn) 593 self.logger.debug2("%s is not cached", fn)
594 return False 594 return False
595 595
596 mtime = bb.parse.cached_mtime_noerror(fn) 596 mtime = bb.parse.cached_mtime_noerror(fn)
597 597
598 # Check file still exists 598 # Check file still exists
599 if mtime == 0: 599 if mtime == 0:
600 self.logger.debug(2, "%s no longer exists", fn) 600 self.logger.debug2("%s no longer exists", fn)
601 self.remove(fn) 601 self.remove(fn)
602 return False 602 return False
603 603
604 info_array = self.depends_cache[fn] 604 info_array = self.depends_cache[fn]
605 # Check the file's timestamp 605 # Check the file's timestamp
606 if mtime != info_array[0].timestamp: 606 if mtime != info_array[0].timestamp:
607 self.logger.debug(2, "%s changed", fn) 607 self.logger.debug2("%s changed", fn)
608 self.remove(fn) 608 self.remove(fn)
609 return False 609 return False
610 610
@@ -615,13 +615,13 @@ class Cache(NoCache):
615 fmtime = bb.parse.cached_mtime_noerror(f) 615 fmtime = bb.parse.cached_mtime_noerror(f)
616 # Check if file still exists 616 # Check if file still exists
617 if old_mtime != 0 and fmtime == 0: 617 if old_mtime != 0 and fmtime == 0:
618 self.logger.debug(2, "%s's dependency %s was removed", 618 self.logger.debug2("%s's dependency %s was removed",
619 fn, f) 619 fn, f)
620 self.remove(fn) 620 self.remove(fn)
621 return False 621 return False
622 622
623 if (fmtime != old_mtime): 623 if (fmtime != old_mtime):
624 self.logger.debug(2, "%s's dependency %s changed", 624 self.logger.debug2("%s's dependency %s changed",
625 fn, f) 625 fn, f)
626 self.remove(fn) 626 self.remove(fn)
627 return False 627 return False
@@ -638,14 +638,14 @@ class Cache(NoCache):
638 continue 638 continue
639 f, exist = f.split(":") 639 f, exist = f.split(":")
640 if (exist == "True" and not os.path.exists(f)) or (exist == "False" and os.path.exists(f)): 640 if (exist == "True" and not os.path.exists(f)) or (exist == "False" and os.path.exists(f)):
641 self.logger.debug(2, "%s's file checksum list file %s changed", 641 self.logger.debug2("%s's file checksum list file %s changed",
642 fn, f) 642 fn, f)
643 self.remove(fn) 643 self.remove(fn)
644 return False 644 return False
645 645
646 if tuple(appends) != tuple(info_array[0].appends): 646 if tuple(appends) != tuple(info_array[0].appends):
647 self.logger.debug(2, "appends for %s changed", fn) 647 self.logger.debug2("appends for %s changed", fn)
648 self.logger.debug(2, "%s to %s" % (str(appends), str(info_array[0].appends))) 648 self.logger.debug2("%s to %s" % (str(appends), str(info_array[0].appends)))
649 self.remove(fn) 649 self.remove(fn)
650 return False 650 return False
651 651
@@ -654,10 +654,10 @@ class Cache(NoCache):
654 virtualfn = variant2virtual(fn, cls) 654 virtualfn = variant2virtual(fn, cls)
655 self.clean.add(virtualfn) 655 self.clean.add(virtualfn)
656 if virtualfn not in self.depends_cache: 656 if virtualfn not in self.depends_cache:
657 self.logger.debug(2, "%s is not cached", virtualfn) 657 self.logger.debug2("%s is not cached", virtualfn)
658 invalid = True 658 invalid = True
659 elif len(self.depends_cache[virtualfn]) != len(self.caches_array): 659 elif len(self.depends_cache[virtualfn]) != len(self.caches_array):
660 self.logger.debug(2, "Extra caches missing for %s?" % virtualfn) 660 self.logger.debug2("Extra caches missing for %s?" % virtualfn)
661 invalid = True 661 invalid = True
662 662
663 # If any one of the variants is not present, mark as invalid for all 663 # If any one of the variants is not present, mark as invalid for all
@@ -665,10 +665,10 @@ class Cache(NoCache):
665 for cls in info_array[0].variants: 665 for cls in info_array[0].variants:
666 virtualfn = variant2virtual(fn, cls) 666 virtualfn = variant2virtual(fn, cls)
667 if virtualfn in self.clean: 667 if virtualfn in self.clean:
668 self.logger.debug(2, "Removing %s from cache", virtualfn) 668 self.logger.debug2("Removing %s from cache", virtualfn)
669 self.clean.remove(virtualfn) 669 self.clean.remove(virtualfn)
670 if fn in self.clean: 670 if fn in self.clean:
671 self.logger.debug(2, "Marking %s as not clean", fn) 671 self.logger.debug2("Marking %s as not clean", fn)
672 self.clean.remove(fn) 672 self.clean.remove(fn)
673 return False 673 return False
674 674
@@ -681,10 +681,10 @@ class Cache(NoCache):
681 Called from the parser in error cases 681 Called from the parser in error cases
682 """ 682 """
683 if fn in self.depends_cache: 683 if fn in self.depends_cache:
684 self.logger.debug(1, "Removing %s from cache", fn) 684 self.logger.debug("Removing %s from cache", fn)
685 del self.depends_cache[fn] 685 del self.depends_cache[fn]
686 if fn in self.clean: 686 if fn in self.clean:
687 self.logger.debug(1, "Marking %s as unclean", fn) 687 self.logger.debug("Marking %s as unclean", fn)
688 self.clean.remove(fn) 688 self.clean.remove(fn)
689 689
690 def sync(self): 690 def sync(self):
@@ -697,13 +697,13 @@ class Cache(NoCache):
697 return 697 return
698 698
699 if self.cacheclean: 699 if self.cacheclean:
700 self.logger.debug(2, "Cache is clean, not saving.") 700 self.logger.debug2("Cache is clean, not saving.")
701 return 701 return
702 702
703 for cache_class in self.caches_array: 703 for cache_class in self.caches_array:
704 cache_class_name = cache_class.__name__ 704 cache_class_name = cache_class.__name__
705 cachefile = self.getCacheFile(cache_class.cachefile) 705 cachefile = self.getCacheFile(cache_class.cachefile)
706 self.logger.debug(2, "Writing %s", cachefile) 706 self.logger.debug2("Writing %s", cachefile)
707 with open(cachefile, "wb") as f: 707 with open(cachefile, "wb") as f:
708 p = pickle.Pickler(f, pickle.HIGHEST_PROTOCOL) 708 p = pickle.Pickler(f, pickle.HIGHEST_PROTOCOL)
709 p.dump(__cache_version__) 709 p.dump(__cache_version__)
@@ -879,7 +879,7 @@ class MultiProcessCache(object):
879 bb.utils.mkdirhier(cachedir) 879 bb.utils.mkdirhier(cachedir)
880 self.cachefile = os.path.join(cachedir, 880 self.cachefile = os.path.join(cachedir,
881 cache_file_name or self.__class__.cache_file_name) 881 cache_file_name or self.__class__.cache_file_name)
882 logger.debug(1, "Using cache in '%s'", self.cachefile) 882 logger.debug("Using cache in '%s'", self.cachefile)
883 883
884 glf = bb.utils.lockfile(self.cachefile + ".lock") 884 glf = bb.utils.lockfile(self.cachefile + ".lock")
885 885
@@ -985,7 +985,7 @@ class SimpleCache(object):
985 bb.utils.mkdirhier(cachedir) 985 bb.utils.mkdirhier(cachedir)
986 self.cachefile = os.path.join(cachedir, 986 self.cachefile = os.path.join(cachedir,
987 cache_file_name or self.__class__.cache_file_name) 987 cache_file_name or self.__class__.cache_file_name)
988 logger.debug(1, "Using cache in '%s'", self.cachefile) 988 logger.debug("Using cache in '%s'", self.cachefile)
989 989
990 glf = bb.utils.lockfile(self.cachefile + ".lock") 990 glf = bb.utils.lockfile(self.cachefile + ".lock")
991 991