RRS: exclude lib/ subdirectory of layers to avoid picking up templates

We were picking up lib/bblayers/example.bb in OE-Core, and it's possible
we might add similar templates in future. There shouldn't ever be files
we're interested in under lib/, and in the absence of the ability to
follow BBFILES, just exclude the directory explicitly.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2019-10-22 14:19:37 +13:00
parent 20a420ec9c
commit 869ebec108
2 changed files with 9 additions and 4 deletions

View File

@ -57,21 +57,23 @@ def get_pv_type(pv):
def get_recipe_files(layerdir):
from layerindex import recipeparse
sublayer_dirs = []
# Exclude lib dir (likely to include templates)
exclude_dirs = [os.path.join(layerdir, 'lib') + os.sep]
# Exclude sub-layers
for root, dirs, files in os.walk(layerdir):
for d in dirs:
if os.path.exists(os.path.join(root, d, 'conf', 'layer.conf')):
sublayer_dirs.append(os.path.join(root, d) + os.sep)
exclude_dirs.append(os.path.join(root, d) + os.sep)
recipe_files = []
for root, dirs, files in os.walk(layerdir):
if '.git' in dirs:
dirs.remove('.git')
# remove sublayer dirs
# remove excluded dirs
for d in dirs[:]:
fullpath = os.path.join(root, d) + os.sep
if fullpath in sublayer_dirs:
if fullpath in exclude_dirs:
dirs.remove(d)
for f in files:

View File

@ -303,6 +303,9 @@ def _get_recipes_filenames(ct, repo, repodir, layersubdir_start, logger):
if layersubdir_start and not (diffitem.a_path.startswith(layersubdir_start) or diffitem.b_path.startswith(layersubdir_start)):
# Not in this layer, skip it
continue
if diffitem.a_path.startswith(layersubdir_start + 'lib/') or diffitem.b_path.startswith(layersubdir_start + 'lib/'):
# A little bit hacky, but we pick up templates otherwise
continue
(typename, _, _) = recipeparse.detect_file_type(diffitem.a_path,
layersubdir_start)