diff options
| -rw-r--r-- | bitbake/lib/bb/cache.py | 15 | ||||
| -rw-r--r-- | bitbake/lib/bb/cooker.py | 52 | ||||
| -rw-r--r-- | bitbake/lib/bb/shell.py | 2 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/hob.py | 2 |
4 files changed, 57 insertions, 14 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index 09691d98cc..0620621d0b 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py | |||
| @@ -245,7 +245,11 @@ class Cache(object): | |||
| 245 | BitBake Cache implementation | 245 | BitBake Cache implementation |
| 246 | """ | 246 | """ |
| 247 | 247 | ||
| 248 | def __init__(self, data): | 248 | def __init__(self, data, caches_array): |
| 249 | # Pass caches_array information into Cache Constructor | ||
| 250 | # It will be used in later for deciding whether we | ||
| 251 | # need extra cache file dump/load support | ||
| 252 | self.caches_array = caches_array | ||
| 249 | self.cachedir = bb.data.getVar("CACHE", data, True) | 253 | self.cachedir = bb.data.getVar("CACHE", data, True) |
| 250 | self.clean = set() | 254 | self.clean = set() |
| 251 | self.checked = set() | 255 | self.checked = set() |
| @@ -360,7 +364,7 @@ class Cache(object): | |||
| 360 | return bb_data[virtual] | 364 | return bb_data[virtual] |
| 361 | 365 | ||
| 362 | @classmethod | 366 | @classmethod |
| 363 | def parse(cls, filename, appends, configdata): | 367 | def parse(cls, filename, appends, configdata, caches_array): |
| 364 | """Parse the specified filename, returning the recipe information""" | 368 | """Parse the specified filename, returning the recipe information""" |
| 365 | infos = [] | 369 | infos = [] |
| 366 | datastores = cls.load_bbfile(filename, appends, configdata) | 370 | datastores = cls.load_bbfile(filename, appends, configdata) |
| @@ -393,7 +397,7 @@ class Cache(object): | |||
| 393 | infos.append((virtualfn, self.depends_cache[virtualfn])) | 397 | infos.append((virtualfn, self.depends_cache[virtualfn])) |
| 394 | else: | 398 | else: |
| 395 | logger.debug(1, "Parsing %s", filename) | 399 | logger.debug(1, "Parsing %s", filename) |
| 396 | return self.parse(filename, appends, configdata) | 400 | return self.parse(filename, appends, configdata, self.caches_array) |
| 397 | 401 | ||
| 398 | return cached, infos | 402 | return cached, infos |
| 399 | 403 | ||
| @@ -623,8 +627,9 @@ class CacheData(object): | |||
| 623 | The data structures we compile from the cached data | 627 | The data structures we compile from the cached data |
| 624 | """ | 628 | """ |
| 625 | 629 | ||
| 626 | def __init__(self): | 630 | def __init__(self, caches_array): |
| 627 | CoreRecipeInfo.init_cacheData(self) | 631 | self.caches_array = caches_array |
| 632 | CoreRecipeInfo.init_cacheData(self) | ||
| 628 | # Direct cache variables | 633 | # Direct cache variables |
| 629 | self.task_queues = {} | 634 | self.task_queues = {} |
| 630 | self.preferred = {} | 635 | self.preferred = {} |
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 0b52f182ea..89da7e99cf 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
| @@ -72,6 +72,41 @@ class BBCooker: | |||
| 72 | 72 | ||
| 73 | self.configuration = configuration | 73 | self.configuration = configuration |
| 74 | 74 | ||
| 75 | self.caches_array = [] | ||
| 76 | # Currently, only Image Creator hob ui needs extra cache. | ||
| 77 | # So, we save Extra Cache class name and container file | ||
| 78 | # information into a extraCaches field in hob UI. | ||
| 79 | # TODO: In future, bin/bitbake should pass information into cooker, | ||
| 80 | # instead of getting information from configuration.ui. Also, some | ||
| 81 | # UI start up issues need to be addressed at the same time. | ||
| 82 | caches_name_array = ['bb.cache:CoreRecipeInfo'] | ||
| 83 | if configuration.ui: | ||
| 84 | try: | ||
| 85 | module = __import__('bb.ui', fromlist=[configuration.ui]) | ||
| 86 | name_array = (getattr(module, configuration.ui)).extraCaches | ||
| 87 | for recipeInfoName in name_array: | ||
| 88 | caches_name_array.append(recipeInfoName) | ||
| 89 | except ImportError, exc: | ||
| 90 | # bb.ui.XXX is not defined and imported. It's an error! | ||
| 91 | logger.critical("Unable to import '%s' interface from bb.ui: %s" % (configuration.ui, exc)) | ||
| 92 | sys.exit("FATAL: Failed to import '%s' interface." % configuration.ui) | ||
| 93 | except AttributeError: | ||
| 94 | # This is not an error. If the field is not defined in the ui, | ||
| 95 | # this interface might need no extra cache fields, so | ||
| 96 | # just skip this error! | ||
| 97 | logger.debug("UI '%s' does not require extra cache!" % (configuration.ui)) | ||
| 98 | |||
| 99 | # At least CoreRecipeInfo will be loaded, so caches_array will never be empty! | ||
| 100 | # This is the entry point, no further check needed! | ||
| 101 | for var in caches_name_array: | ||
| 102 | try: | ||
| 103 | module_name, cache_name = var.split(':') | ||
| 104 | module = __import__(module_name, fromlist=(cache_name,)) | ||
| 105 | self.caches_array.append(getattr(module, cache_name)) | ||
| 106 | except ImportError, exc: | ||
| 107 | logger.critical("Unable to import extra RecipeInfo '%s' from '%s': %s" % (cache_name, module_name, exc)) | ||
| 108 | sys.exit("FATAL: Failed to import extra cache class '%s'." % cache_name) | ||
| 109 | |||
| 75 | self.configuration.data = bb.data.init() | 110 | self.configuration.data = bb.data.init() |
| 76 | 111 | ||
| 77 | if not server: | 112 | if not server: |
| @@ -730,9 +765,10 @@ class BBCooker: | |||
| 730 | 765 | ||
| 731 | self.buildSetVars() | 766 | self.buildSetVars() |
| 732 | 767 | ||
| 733 | self.status = bb.cache.CacheData() | 768 | self.status = bb.cache.CacheData(self.caches_array) |
| 734 | infos = bb.cache.Cache.parse(fn, self.get_file_appends(fn), \ | 769 | infos = bb.cache.Cache.parse(fn, self.get_file_appends(fn), \ |
| 735 | self.configuration.data) | 770 | self.configuration.data, |
| 771 | self.caches_array) | ||
| 736 | infos = dict(infos) | 772 | infos = dict(infos) |
| 737 | 773 | ||
| 738 | fn = bb.cache.Cache.realfn2virtual(fn, cls) | 774 | fn = bb.cache.Cache.realfn2virtual(fn, cls) |
| @@ -876,7 +912,7 @@ class BBCooker: | |||
| 876 | else: | 912 | else: |
| 877 | collectlog.info("You have disabled Psyco. This decreases performance.") | 913 | collectlog.info("You have disabled Psyco. This decreases performance.") |
| 878 | 914 | ||
| 879 | self.status = bb.cache.CacheData() | 915 | self.status = bb.cache.CacheData(self.caches_array) |
| 880 | 916 | ||
| 881 | ignore = bb.data.getVar("ASSUME_PROVIDED", self.configuration.data, 1) or "" | 917 | ignore = bb.data.getVar("ASSUME_PROVIDED", self.configuration.data, 1) or "" |
| 882 | self.status.ignored_dependencies = set(ignore.split()) | 918 | self.status.ignored_dependencies = set(ignore.split()) |
| @@ -1091,9 +1127,9 @@ class ParsingFailure(Exception): | |||
| 1091 | self.args = (realexception, recipe) | 1127 | self.args = (realexception, recipe) |
| 1092 | 1128 | ||
| 1093 | def parse_file(task): | 1129 | def parse_file(task): |
| 1094 | filename, appends = task | 1130 | filename, appends, caches_array = task |
| 1095 | try: | 1131 | try: |
| 1096 | return True, bb.cache.Cache.parse(filename, appends, parse_file.cfg) | 1132 | return True, bb.cache.Cache.parse(filename, appends, parse_file.cfg, caches_array) |
| 1097 | except Exception, exc: | 1133 | except Exception, exc: |
| 1098 | exc.recipe = filename | 1134 | exc.recipe = filename |
| 1099 | raise exc | 1135 | raise exc |
| @@ -1123,13 +1159,13 @@ class CookerParser(object): | |||
| 1123 | self.num_processes = int(self.cfgdata.getVar("BB_NUMBER_PARSE_THREADS", True) or | 1159 | self.num_processes = int(self.cfgdata.getVar("BB_NUMBER_PARSE_THREADS", True) or |
| 1124 | multiprocessing.cpu_count()) | 1160 | multiprocessing.cpu_count()) |
| 1125 | 1161 | ||
| 1126 | self.bb_cache = bb.cache.Cache(self.cfgdata) | 1162 | self.bb_cache = bb.cache.Cache(self.cfgdata, cooker.caches_array) |
| 1127 | self.fromcache = [] | 1163 | self.fromcache = [] |
| 1128 | self.willparse = [] | 1164 | self.willparse = [] |
| 1129 | for filename in self.filelist: | 1165 | for filename in self.filelist: |
| 1130 | appends = self.cooker.get_file_appends(filename) | 1166 | appends = self.cooker.get_file_appends(filename) |
| 1131 | if not self.bb_cache.cacheValid(filename): | 1167 | if not self.bb_cache.cacheValid(filename): |
| 1132 | self.willparse.append((filename, appends)) | 1168 | self.willparse.append((filename, appends, cooker.caches_array)) |
| 1133 | else: | 1169 | else: |
| 1134 | self.fromcache.append((filename, appends)) | 1170 | self.fromcache.append((filename, appends)) |
| 1135 | self.toparse = self.total - len(self.fromcache) | 1171 | self.toparse = self.total - len(self.fromcache) |
| @@ -1205,6 +1241,6 @@ class CookerParser(object): | |||
| 1205 | def reparse(self, filename): | 1241 | def reparse(self, filename): |
| 1206 | infos = self.bb_cache.parse(filename, | 1242 | infos = self.bb_cache.parse(filename, |
| 1207 | self.cooker.get_file_appends(filename), | 1243 | self.cooker.get_file_appends(filename), |
| 1208 | self.cfgdata) | 1244 | self.cfgdata, self.cooker.caches_array) |
| 1209 | for vfn, info in infos: | 1245 | for vfn, info in infos: |
| 1210 | self.cooker.status.add_from_recipeinfo(vfn, info) | 1246 | self.cooker.status.add_from_recipeinfo(vfn, info) |
diff --git a/bitbake/lib/bb/shell.py b/bitbake/lib/bb/shell.py index 3319e2d1cc..1dd8d54bdb 100644 --- a/bitbake/lib/bb/shell.py +++ b/bitbake/lib/bb/shell.py | |||
| @@ -407,7 +407,7 @@ SRC_URI = "" | |||
| 407 | 407 | ||
| 408 | def parse( self, params ): | 408 | def parse( self, params ): |
| 409 | """(Re-)parse .bb files and calculate the dependency graph""" | 409 | """(Re-)parse .bb files and calculate the dependency graph""" |
| 410 | cooker.status = cache.CacheData() | 410 | cooker.status = cache.CacheData(cooker.caches_array) |
| 411 | ignore = data.getVar("ASSUME_PROVIDED", cooker.configuration.data, 1) or "" | 411 | ignore = data.getVar("ASSUME_PROVIDED", cooker.configuration.data, 1) or "" |
| 412 | cooker.status.ignored_dependencies = set( ignore.split() ) | 412 | cooker.status.ignored_dependencies = set( ignore.split() ) |
| 413 | cooker.handleCollections( data.getVar("BBFILE_COLLECTIONS", cooker.configuration.data, 1) ) | 413 | cooker.handleCollections( data.getVar("BBFILE_COLLECTIONS", cooker.configuration.data, 1) ) |
diff --git a/bitbake/lib/bb/ui/hob.py b/bitbake/lib/bb/ui/hob.py index 0f8fe8c2d6..ab6022b7dc 100644 --- a/bitbake/lib/bb/ui/hob.py +++ b/bitbake/lib/bb/ui/hob.py | |||
| @@ -28,6 +28,8 @@ import xmlrpclib | |||
| 28 | import logging | 28 | import logging |
| 29 | import Queue | 29 | import Queue |
| 30 | 30 | ||
| 31 | extraCaches = ['bb.cache_extra:HobRecipeInfo'] | ||
| 32 | |||
| 31 | class MainWindow (gtk.Window): | 33 | class MainWindow (gtk.Window): |
| 32 | 34 | ||
| 33 | def __init__(self, taskmodel, handler, curr_mach=None, curr_distro=None): | 35 | def __init__(self, taskmodel, handler, curr_mach=None, curr_distro=None): |
