aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/utils.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-08-19 14:20:10 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-19 17:59:32 +0100
commite852f6cabd7489585477ab567a1afeb2252377ac (patch)
tree1763e147218470e64092106a004d7cfd20f8d5cd /lib/bb/utils.py
parentb4c45bf6c42b4d319ba868f4ce77e86c8b585818 (diff)
downloadbitbake-e852f6cabd7489585477ab567a1afeb2252377ac.tar.gz
bitbake-layers: fix mapping files to layers
bitbake-layers needs to map recipe and class files to the layer they came from within the show-recipes and show-overlayed commands. However, it turns out that mapping a file to the layer it came from is not as trivial as it might seem. To do it properly we need to match the path to an entry in BBFILES then map that to the collection name using BBFILE_PATTERN, then map that to the actual layer using variable history. If it doesn't match any entry in BBFILES, then we can fall back to BBFILE_PATTERN (to handle classes and conf files). This fixes the layer name not showing up properly in the output of the show-recipes and show-overlayed commands for recipes in layers such as meta-intel that have subdirectories in BBFILE_PATTERN. It also fixes the priority not showing up in show-layers for such layers. As part of this I've added a function to VariableHistory which for a space-separated list variable gives you a dict mapping the items added to the files in which they were added. I've also fixed bb.utils.get_file_layer() and reduced some of the duplication by using this function in bitbake-layers. Also fixes the priority not showing up for layers such as meta-intel Fixes [YOCTO #8160]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/utils.py')
-rw-r--r--lib/bb/utils.py32
1 files changed, 24 insertions, 8 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 607ffc506..5b94432b3 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -29,6 +29,7 @@ import multiprocessing
import fcntl
import subprocess
import glob
+import fnmatch
import traceback
import errno
import signal
@@ -1262,11 +1263,26 @@ def get_file_layer(filename, d):
for collection in collections:
collection_res[collection] = d.getVar('BBFILE_PATTERN_%s' % collection, True) or ''
- # Use longest path so we handle nested layers
- matchlen = 0
- match = None
- for collection, regex in collection_res.iteritems():
- if len(regex) > matchlen and re.match(regex, filename):
- matchlen = len(regex)
- match = collection
- return match
+ def path_to_layer(path):
+ # Use longest path so we handle nested layers
+ matchlen = 0
+ match = None
+ for collection, regex in collection_res.iteritems():
+ if len(regex) > matchlen and re.match(regex, path):
+ matchlen = len(regex)
+ match = collection
+ return match
+
+ result = None
+ bbfiles = (d.getVar('BBFILES', True) or '').split()
+ bbfilesmatch = False
+ for bbfilesentry in bbfiles:
+ if fnmatch.fnmatch(filename, bbfilesentry):
+ bbfilesmatch = True
+ result = path_to_layer(bbfilesentry)
+
+ if not bbfilesmatch:
+ # Probably a bbclass
+ result = path_to_layer(filename)
+
+ return result