diff options
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 1d5e5f66c2..8776e187ea 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -79,6 +79,29 @@ class SkippedPackage: | |||
79 | elif reason: | 79 | elif reason: |
80 | self.skipreason = reason | 80 | self.skipreason = reason |
81 | 81 | ||
82 | |||
83 | class CookerFeatures(object): | ||
84 | _feature_list = [HOB_EXTRA_CACHES] = range(1) | ||
85 | |||
86 | def __init__(self): | ||
87 | self._features=set() | ||
88 | |||
89 | def setFeature(self, f): | ||
90 | # validate we got a request for a feature we support | ||
91 | if f not in CookerFeatures._feature_list: | ||
92 | return | ||
93 | self._features.add(f) | ||
94 | |||
95 | def __contains__(self, f): | ||
96 | return f in self._features | ||
97 | |||
98 | def __iter__(self): | ||
99 | return self._features.__iter__() | ||
100 | |||
101 | def next(self): | ||
102 | return self._features.next() | ||
103 | |||
104 | |||
82 | #============================================================================# | 105 | #============================================================================# |
83 | # BBCooker | 106 | # BBCooker |
84 | #============================================================================# | 107 | #============================================================================# |
@@ -90,6 +113,7 @@ class BBCooker: | |||
90 | def __init__(self, configuration): | 113 | def __init__(self, configuration): |
91 | self.recipecache = None | 114 | self.recipecache = None |
92 | self.skiplist = {} | 115 | self.skiplist = {} |
116 | self.featureset = CookerFeatures() | ||
93 | 117 | ||
94 | self.configuration = configuration | 118 | self.configuration = configuration |
95 | 119 | ||
@@ -122,7 +146,13 @@ class BBCooker: | |||
122 | self.state = state.initial | 146 | self.state = state.initial |
123 | 147 | ||
124 | self.caches_array = [] | 148 | self.caches_array = [] |
125 | caches_name_array = ['bb.cache:CoreRecipeInfo'] + self.configuration.extra_caches | 149 | |
150 | all_extra_cache_names = [] | ||
151 | # We hardcode all known cache types in a single place, here. | ||
152 | if CookerFeatures.HOB_EXTRA_CACHES in self.featureset: | ||
153 | all_extra_cache_names.append("bb.cache_extra:HobRecipeInfo") | ||
154 | |||
155 | caches_name_array = ['bb.cache:CoreRecipeInfo'] + all_extra_cache_names | ||
126 | 156 | ||
127 | # At least CoreRecipeInfo will be loaded, so caches_array will never be empty! | 157 | # At least CoreRecipeInfo will be loaded, so caches_array will never be empty! |
128 | # This is the entry point, no further check needed! | 158 | # This is the entry point, no further check needed! |
@@ -130,7 +160,7 @@ class BBCooker: | |||
130 | try: | 160 | try: |
131 | module_name, cache_name = var.split(':') | 161 | module_name, cache_name = var.split(':') |
132 | module = __import__(module_name, fromlist=(cache_name,)) | 162 | module = __import__(module_name, fromlist=(cache_name,)) |
133 | self.caches_array.append(getattr(module, cache_name)) | 163 | self.caches_array.append(getattr(module, cache_name)) |
134 | except ImportError as exc: | 164 | except ImportError as exc: |
135 | logger.critical("Unable to import extra RecipeInfo '%s' from '%s': %s" % (cache_name, module_name, exc)) | 165 | logger.critical("Unable to import extra RecipeInfo '%s' from '%s': %s" % (cache_name, module_name, exc)) |
136 | sys.exit("FATAL: Failed to import extra cache class '%s'." % cache_name) | 166 | sys.exit("FATAL: Failed to import extra cache class '%s'." % cache_name) |