[layerindex-web,v2,3/3] layerindex/utils.py: ignore 'core' in BBFILES_COLLECTIONS

Message ID 5682b26bdd4fb7d99e21b57e52cd92396b90e63f.1650833930.git.tim.orling@konsulko.com
State Accepted, archived
Commit d8ab1beebeb5b49693b522d8618393620495bd74
Delegated to: Tim Orling
Headers show
Series [layerindex-web,1/3] layerindex/utils.py: add is_commit_ancestor check | expand

Commit Message

Tim Orling April 24, 2022, 9:10 p.m. UTC
Many layers append BBFILE_COLLECTIONS and therefore have 'core <layer>'

During update.py, this means we are likely not handling the collection we
expect:

WARNING: /opt/workdir/git___git_openembedded_org_meta-openembedded/meta-oe: multiple collections found, handling first one (core) only
BBFILE_COLLECTIONS = "core"

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
Changes in v2:
  * Use logger.debug instead of warning for the case where 'core' is ignored

 layerindex/utils.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch

diff --git a/layerindex/utils.py b/layerindex/utils.py
index 46e109e..414bbe5 100644
--- a/layerindex/utils.py
+++ b/layerindex/utils.py
@@ -44,7 +44,12 @@  def get_layer_var(config_data, var, logger):
         collection = collection_list[0]
         layerdir = config_data.getVar('LAYERDIR', True)
         if len(collection_list) > 1:
-            logger.warn('%s: multiple collections found, handling first one (%s) only' % (layerdir, collection))
+            if collection_list[0] == 'core':
+                # Many layers append BBFILE_COLLECTIONS and therefore have 'core <layer>'
+                collection = collection_list[1]
+                logger.debug('%s: multiple collections found, ignoring the first one (\'core\') and handling (%s) only' % (layerdir, collection))
+            else:
+                logger.warn('%s: multiple collections found, handling first one (%s) only' % (layerdir, collection))
         if var == 'BBFILE_COLLECTIONS':
             return collection
     value = config_data.getVar('%s_%s' % (var, collection), True)