diff mbox series

[layerindex-web,5/5] layerindex/update_layer.py: enable classes-global,-recipe

Message ID ac0ef0540a918768728f07b1c64c6637f2fad695.1705982792.git.tim.orling@konsulko.com
State New
Headers show
Series [layerindex-web,1/5] layerindex/models: add BBClassRecipe BBClassGlobal | expand

Commit Message

Tim Orling Jan. 23, 2024, 4:15 a.m. UTC
Add support for the new BBClassGlobal and BBClassRecipe
sub-classes.

[YOCTO #15238]

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 layerindex/update_layer.py | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/layerindex/update_layer.py b/layerindex/update_layer.py
index d9bec0c..33c5cfb 100644
--- a/layerindex/update_layer.py
+++ b/layerindex/update_layer.py
@@ -296,7 +296,10 @@  def main():
 
     utils.setup_django()
     import settings
-    from layerindex.models import LayerItem, LayerBranch, LayerDependency, Recipe, RecipeFileDependency, Machine, Distro, BBAppend, BBClass, IncFile
+    from layerindex.models import (LayerItem, LayerBranch, LayerDependency,
+                                   Recipe, RecipeFileDependency, Machine,
+                                   Distro, BBAppend, BBClass,
+                                   BBClassGlobal, BBClassRecipe, IncFile)
     from django.db import transaction
 
     logger.setLevel(options.loglevel)
@@ -644,7 +647,12 @@  def main():
                                 update_distro_conf_file(os.path.join(repodir, path), distro, config_data_copy)
                                 distro.save()
                             elif typename == 'bbclass':
-                                bbclass = BBClass()
+                                if '/classes-global/' in path:
+                                    bbclass = BBClassGlobal()
+                                elif '/classes-recipe/' in path:
+                                    bbclass = BBClassRecipe()
+                                else:
+                                    bbclass = BBClass()
                                 bbclass.layerbranch = layerbranch
                                 bbclass.name = filename
                                 bbclass.save()
@@ -765,7 +773,12 @@  def main():
                                 update_distro_conf_file(fullpath, distro, config_data_copy)
                                 distro.save()
                             elif typename == 'bbclass':
-                                bbclass = BBClass()
+                                if '/classes-global/' in fullpath:
+                                    bbclass = BBClassGlobal()
+                                elif '/classes-recipe/' in fullpath:
+                                    bbclass = BBClassRecipe()
+                                else:
+                                    bbclass = BBClass()
                                 bbclass.layerbranch = layerbranch
                                 bbclass.name = filename
                                 bbclass.save()