summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-01-08 12:06:50 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-01-10 17:40:42 (GMT)
commit2a121d5c4d93e1532bc6862a7b6ce3b8225bb99b (patch)
treea1b99acb1afaab211fb0be6f881e762d635b4f98
parent4137b51f634bd0c7dec80701181dc3af79afbd71 (diff)
downloadpoky-2a121d5c4d93e1532bc6862a7b6ce3b8225bb99b.tar.gz
bitbake-layers: flatten: warn the user if output structure is incorrect
If you flatten layers that have different directory structures you may not end up with a usable layer in the output directory - some files won't be picked up by BitBake. To try to avoid this problem, once flattening has completed, get the BBFILES entries that correspond to the layer from which the output layer's conf/layer.conf came from, and check through all of the .bb/.bbappend files in the output directory to see if any will not be referred to by BBFILES in the output layer. If any are found, show a warning to the user. (Bitbake rev: 8e4dc97614f2022855143b49d18795ca0352b237) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbitbake/bin/bitbake-layers38
1 files changed, 38 insertions, 0 deletions
diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers
index 572487d..b4c4127 100755
--- a/bitbake/bin/bitbake-layers
+++ b/bitbake/bin/bitbake-layers
@@ -8,6 +8,7 @@ import cmd
8import logging 8import logging
9import os 9import os
10import sys 10import sys
11import fnmatch
11 12
12bindir = os.path.dirname(__file__) 13bindir = os.path.dirname(__file__)
13topdir = os.path.dirname(bindir) 14topdir = os.path.dirname(bindir)
@@ -152,6 +153,8 @@ cleanup may still be necessary afterwards, in particular:
152* where anything beyond the normal layer setup has been added to 153* where anything beyond the normal layer setup has been added to
153 layer.conf (only the lowest priority number layer's layer.conf is used) 154 layer.conf (only the lowest priority number layer's layer.conf is used)
154* overridden/appended items from bbappends will need to be tidied up 155* overridden/appended items from bbappends will need to be tidied up
156* when the flattened layers do not have the same directory structure (the
157 flatten command should show a warning when this will cause a problem)
155 158
156Warning: if you flatten several layers where another layer is intended to 159Warning: if you flatten several layers where another layer is intended to
157be used "inbetween" them (in layer priority order) such that recipes / 160be used "inbetween" them (in layer priority order) such that recipes /
@@ -194,6 +197,8 @@ build results (as the layer priority order has effectively changed).
194 logger.error('Unable to find layer %s in current configuration, please run "%s show_layers" to list configured layers' % (layername, os.path.basename(sys.argv[0]))) 197 logger.error('Unable to find layer %s in current configuration, please run "%s show_layers" to list configured layers' % (layername, os.path.basename(sys.argv[0])))
195 return 198 return
196 layers = found_layerdirs 199 layers = found_layerdirs
200 else:
201 layernames = []
197 202
198 # Ensure a specified path matches our list of layers 203 # Ensure a specified path matches our list of layers
199 def layer_path_match(path): 204 def layer_path_match(path):
@@ -256,6 +261,39 @@ build results (as the layer priority order has effectively changed).
256 bb.utils.copyfile(appendname, fdest) 261 bb.utils.copyfile(appendname, fdest)
257 first_append = fdest 262 first_append = fdest
258 263
264 # Get the regex for the first layer in our list (which is where the conf/layer.conf file will
265 # have come from)
266 first_regex = None
267 layerdir = layers[0]
268 for layername, pattern, regex, _ in self.cooker.status.bbfile_config_priorities:
269 if (not layernames) or layername in layernames:
270 if regex.match(os.path.join(layerdir, 'test')):
271 first_regex = regex
272 break
273
274 if first_regex:
275 # Find the BBFILES entries that match (which will have come from this conf/layer.conf file)
276 bbfiles = str(self.config_data.getVar('BBFILES', True)).split()
277 bbfiles_layer = []
278 for item in bbfiles:
279 if first_regex.match(item):
280 newpath = os.path.join(outputdir, item[len(layerdir)+1:])
281 bbfiles_layer.append(newpath)
282
283 if bbfiles_layer:
284 # Check that all important layer files match BBFILES
285 for root, dirs, files in os.walk(outputdir):
286 for f1 in files:
287 ext = os.path.splitext(f1)[1]
288 if ext in ['.bb', '.bbappend']:
289 f1full = os.sep.join([root, f1])
290 entry_found = False
291 for item in bbfiles_layer:
292 if fnmatch.fnmatch(f1full, item):
293 entry_found = True
294 break
295 if not entry_found:
296 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)
259 297
260 def get_append_layer(self, appendname): 298 def get_append_layer(self, appendname):
261 for layer, _, regex, _ in self.cooker.status.bbfile_config_priorities: 299 for layer, _, regex, _ in self.cooker.status.bbfile_config_priorities: