summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-01-30 16:25:51 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-01 15:08:41 +0000
commit3d2f6d56109fc3ebe9c8e7fe0d84d6cd01a9e2fb (patch)
tree42c2478f7f1c43999e2ac67c43ec982fdfbe5f03
parentcf425a13a2283de5483939a9f70b518fb745e9f6 (diff)
downloadpoky-3d2f6d56109fc3ebe9c8e7fe0d84d6cd01a9e2fb.tar.gz
bitbake-layers: use directory name as layer name
It turns out that using the collection name as specified within layer.conf (i.e. what gets added to BBFILE_COLLECTIONS) as a name to refer to the layer is not particularly useful, since layer creators aren't necessarily setting these to a meaningful value - e.g. OE-Core uses "normal", meta-oe uses "openembedded-layer", etc. In any case, BitBake uses the directory name in its list of configured layers in the system information presented upon starting a build, so let's just do the same here and avoid confusion. Also rename the get_append_layer function to get_file_layer since it is in no way specific to bbappends. (Bitbake rev: 35d2c1c618826e961dbf4b9889b829f469346d74) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbitbake/bin/bitbake-layers39
1 files changed, 20 insertions, 19 deletions
diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers
index fd1ebfbeb3..65496b1674 100755
--- a/bitbake/bin/bitbake-layers
+++ b/bitbake/bin/bitbake-layers
@@ -57,6 +57,7 @@ class Commands(cmd.Cmd):
57 self.config_data = self.cooker.configuration.data 57 self.config_data = self.cooker.configuration.data
58 bb.providers.logger.setLevel(logging.ERROR) 58 bb.providers.logger.setLevel(logging.ERROR)
59 self.cooker_data = None 59 self.cooker_data = None
60 self.bblayers = (self.config_data.getVar('BBLAYERS', True) or "").split()
60 61
61 def register_idle_function(self, function, data): 62 def register_idle_function(self, function, data):
62 pass 63 pass
@@ -110,13 +111,11 @@ class Commands(cmd.Cmd):
110 logger.plain('') 111 logger.plain('')
111 logger.plain("%s %s %s" % ("layer".ljust(20), "path".ljust(40), "priority")) 112 logger.plain("%s %s %s" % ("layer".ljust(20), "path".ljust(40), "priority"))
112 logger.plain('=' * 74) 113 logger.plain('=' * 74)
113 layerdirs = str(self.config_data.getVar('BBLAYERS', True)).split() 114 for layerdir in self.bblayers:
114 for layerdir in layerdirs: 115 layername = self.get_layer_name(layerdir)
115 layername = '?'
116 layerpri = 0 116 layerpri = 0
117 for layer, _, regex, pri in self.cooker.status.bbfile_config_priorities: 117 for layer, _, regex, pri in self.cooker.status.bbfile_config_priorities:
118 if regex.match(os.path.join(layerdir, 'test')): 118 if regex.match(os.path.join(layerdir, 'test')):
119 layername = layer
120 layerpri = pri 119 layerpri = pri
121 break 120 break
122 121
@@ -181,18 +180,16 @@ build results (as the layer priority order has effectively changed).
181 return 180 return
182 181
183 self.check_prepare_cooker() 182 self.check_prepare_cooker()
184 layers = (self.config_data.getVar('BBLAYERS', True) or "").split() 183 layers = self.bblayers
185 if len(arglist) > 2: 184 if len(arglist) > 2:
186 layernames = arglist[:-1] 185 layernames = arglist[:-1]
187 found_layernames = [] 186 found_layernames = []
188 found_layerdirs = [] 187 found_layerdirs = []
189 for layerdir in layers: 188 for layerdir in layers:
190 for layername, _, regex, _ in self.cooker.status.bbfile_config_priorities: 189 layername = self.get_layer_name(layerdir)
191 if layername in layernames: 190 if layername in layernames:
192 if regex.match(os.path.join(layerdir, 'test')): 191 found_layerdirs.append(layerdir)
193 found_layerdirs.append(layerdir) 192 found_layernames.append(layername)
194 found_layernames.append(layername)
195 break
196 193
197 for layername in layernames: 194 for layername in layernames:
198 if not layername in found_layernames: 195 if not layername in found_layernames:
@@ -268,10 +265,9 @@ build results (as the layer priority order has effectively changed).
268 first_regex = None 265 first_regex = None
269 layerdir = layers[0] 266 layerdir = layers[0]
270 for layername, pattern, regex, _ in self.cooker.status.bbfile_config_priorities: 267 for layername, pattern, regex, _ in self.cooker.status.bbfile_config_priorities:
271 if (not layernames) or layername in layernames: 268 if regex.match(os.path.join(layerdir, 'test')):
272 if regex.match(os.path.join(layerdir, 'test')): 269 first_regex = regex
273 first_regex = regex 270 break
274 break
275 271
276 if first_regex: 272 if first_regex:
277 # Find the BBFILES entries that match (which will have come from this conf/layer.conf file) 273 # Find the BBFILES entries that match (which will have come from this conf/layer.conf file)
@@ -297,17 +293,22 @@ build results (as the layer priority order has effectively changed).
297 if not entry_found: 293 if not entry_found:
298 logger.warning("File %s does not match the flattened layer's BBFILES setting, you may need to edit conf/layer.conf or move the file elsewhere" % f1full) 294 logger.warning("File %s does not match the flattened layer's BBFILES setting, you may need to edit conf/layer.conf or move the file elsewhere" % f1full)
299 295
300 def get_append_layer(self, appendname): 296 def get_file_layer(self, filename):
301 for layer, _, regex, _ in self.cooker.status.bbfile_config_priorities: 297 for layer, _, regex, _ in self.cooker.status.bbfile_config_priorities:
302 if regex.match(appendname): 298 if regex.match(filename):
303 return layer 299 for layerdir in self.bblayers:
300 if regex.match(os.path.join(layerdir, 'test')):
301 return self.get_layer_name(layerdir)
304 return "?" 302 return "?"
305 303
304 def get_layer_name(self, layerdir):
305 return os.path.basename(layerdir.rstrip(os.sep))
306
306 def apply_append(self, appendname, recipename): 307 def apply_append(self, appendname, recipename):
307 appendfile = open(appendname, 'r') 308 appendfile = open(appendname, 'r')
308 recipefile = open(recipename, 'a') 309 recipefile = open(recipename, 'a')
309 recipefile.write('\n') 310 recipefile.write('\n')
310 recipefile.write('##### bbappended from %s #####\n' % self.get_append_layer(appendname)) 311 recipefile.write('##### bbappended from %s #####\n' % self.get_file_layer(appendname))
311 recipefile.writelines(appendfile.readlines()) 312 recipefile.writelines(appendfile.readlines())
312 recipefile.close() 313 recipefile.close()
313 appendfile.close() 314 appendfile.close()