diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2013-09-18 13:15:47 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-09-22 12:19:43 +0100 |
commit | ba83eb315d1462e096e2d6682d246cbbe260b4c0 (patch) | |
tree | 7b0bf6ac84989275df250d76e1d1097fdd9bd0aa /bitbake/lib/bb/cooker.py | |
parent | 87e86d4fd3a22627bf5a7eff20d8551cb1e67452 (diff) | |
download | poky-ba83eb315d1462e096e2d6682d246cbbe260b4c0.tar.gz |
bitbake: bitbake: cooker,xmlrpc,servers: implement CookerFeatures
Implementing feature set selection that allows a client
to enable specific features in the server at connection time.
Only enabling of features is supported, as there is
no way to safely remove data loaded into the cooker.
Once enabled, a feature will remain enabled for the
life of the cooker.
Client-server connection now supports specifying the feature
set required by the client. This is implemented in the Process
server using a managed proxy list, so the server cooker
will now load dynamically needed features based on what client
connects to it.
In the XMLRPC server the feature set is requested by
using a parameter for registerUIHandler function.
This allows observer-only clients to also specify features
for the server.
The server code configuration now is completly separated
from the client code. All hardcoding of client knowledge is
removed from the server.
The extra_caches is removed as the client can now specify
the caches it needs using the feature. The UI modules
now need to specify the desired featureSet. HOB is modified
to conform to the featureSet specification.
The only feature available is CookerFeatures.HOB_EXTRA_CACHES
which forces loading the bb.cache_extra:HobRecipeInfo class.
(Bitbake rev: 98e594837aab89ea042cfa9f3740d20a661b14e2)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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) |