Add support for classes-global and classes-recipe
cover Add support for classes-global and classes-recipe
Previously, only the 'classes' path was searched, but we should also be searching 'classes-global' and 'classes-recipe' since:
bitbake f33ce7e7
'BBHandler/cooker: Implement recipe and global classes'
and
oe-core f5c12800
'classes: Update classes to match new bitbake class scope functionality'
This requires changes not only in models.py, but also in recipeparse.py, update_layer.py and views.py.
While we are at it, add "Global" and "Recipe" 'badges' next to the class names in the appropriate class view templates.
[YOCTO #15238]
The following changes since commit 83378f2f9c881505027220a98514bcb933d82682:
global: deprecated pkg_resources parse_version (2024-01-22 16:08:37 -0800)
are available in the Git repository at:
https://github.com/moto-timo/layerindex-web timo/classes-global-recipe
https://github.com/moto-timo/layerindex-web/tree/timo/classes-global-recipe
Tim Orling (5):
layerindex/models: add BBClassRecipe BBClassGlobal layerindex/recipeparse.py: extend bbclass regex layerindex/views: add classes-recipe,-global
templates: add bbclasstype badge layerindex/update_layer.py: enable classes-global,-recipe
...obal_bbclassrecipe_bbclass_bbclass_type.py | 41 ++++++++++++++++++ layerindex/models.py | 43 ++++++++++++++++++- layerindex/recipeparse.py | 4 +- layerindex/update_layer.py | 19 ++++++-- layerindex/views.py | 3 +- templates/layerindex/classes.html | 5 ++- templates/layerindex/detail.html | 5 ++- 7 files changed, 111 insertions(+), 9 deletions(-) create mode 100644 layerindex/migrations/0048_bbclassglobal_bbclassrecipe_bbclass_bbclass_type.py
Signature · 1 line
2.34.1
PATCH 1/5 layerindex/models: add BBClassRecipe BBClassGlobal
Add support for classes-global and classes-recipe, but use "proxy=True" to not create new tables for the new classes. Rather, we use the bbclass_type field.
[YOCTO #15238]
--- ...obal_bbclassrecipe_bbclass_bbclass_type.py | 41 ++++++++++++++++++ layerindex/models.py | 43 ++++++++++++++++++- 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 layerindex/migrations/0048_bbclassglobal_bbclassrecipe_bbclass_bbclass_type.py
layerindex/migrations/0048_bbclassglobal_bbclassrecipe_bbclass_bbclass_type.py new file +41 -0
@@ -0,0 +1,41 @@ +# Generated by Django 4.2.9 on 2024-01-20 21:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("layerindex", "0047_layerbranch_updates_enabled"), + ] + + operations = [ + migrations.CreateModel( + name="BBClassGlobal", + fields=[], + options={ + "proxy": True, + "indexes": [], + "constraints": [], + }, + bases=("layerindex.bbclass",), + ), + migrations.CreateModel( + name="BBClassRecipe", + fields=[], + options={ + "proxy": True, + "indexes": [], + "constraints": [], + }, + bases=("layerindex.bbclass",), + ), + migrations.AddField( + model_name="bbclass", + name="bbclass_type", + field=models.CharField( + choices=[("", "Class"), ("Global", "Global"), ("Recipe", "Recipe")], + default="", + max_length=25, + ), + ), + ]
layerindex/models.py +42 -1
60 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/5 layerindex/recipeparse.py: extend bbclass regex
In reply to Tim OrlingExtend the bbclass regex to match classes-global and classes-recipe
[YOCTO #15238]
--- layerindex/recipeparse.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
layerindex/recipeparse.py +2 -2
@@ -130,7 +130,7 @@ def setup_layer(config_data, fetchdir, layerdir, layer, layerbranch, logger): machine_conf_re = re.compile(r'conf/machine/([^/.]*).conf$') distro_conf_re = re.compile(r'conf/distro/([^/.]*).conf$') -bbclass_re = re.compile(r'classes/([^/.]*).bbclass$') +bbclass_re = re.compile(r'classes(?P<subtype>-global|-recipe)?/(?P<name>[^/.]*).bbclass$') def detect_file_type(path, subdir_start): typename = None if fnmatch.fnmatch(path, "*.bb"):
@@ -149,7 +149,7 @@ def detect_file_type(path, subdir_start): res = bbclass_re.match(subpath) if res: typename = 'bbclass' - return (typename, None, res.group(1)) + return (typename, None, res.group('name')) res = distro_conf_re.match(subpath) if res: typename = 'distro'
Signature · 1 line
2.34.1
PATCH 3/5 layerindex/views: add classes-recipe,-global
In reply to Tim OrlingSince commits:
bitbake f33ce7e7
'BBHandler/cooker: Implement recipe and global classes'
oe-core f5c12800
'classes: Update classes to match new bitbake class scope functionality'
we now have a lot of the oe-core recipe classes in meta/classes-recipe.
We are also missing any bbclasses in meta/classes-global
[YOCTO #15238]
--- layerindex/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
layerindex/views.py +2 -1
@@ -51,7 +51,8 @@ from layerindex.forms import (AdvancedRecipeSearchForm, BulkChangeEditFormSet, LayerMaintainerFormSet, RecipeChangesetForm, PatchDispositionForm, PatchDispositionFormSet, BranchComparisonForm, RecipeDependenciesForm) -from layerindex.models import (BBAppend, BBClass, Branch, ClassicRecipe, +from layerindex.models import (BBAppend, BBClass, BBClassGlobal, BBClassRecipe, + Branch, ClassicRecipe, Distro, DynamicBuildDep, IncFile, LayerBranch, LayerDependency, LayerItem, LayerMaintainer, LayerNote, LayerUpdate, Machine, Patch, Recipe,
Signature · 1 line
2.34.1
PATCH 4/5 templates: add bbclasstype badge
In reply to Tim OrlingNow that we have different BBClass subtypes, it is handy to have a UI indication of the different types. Add "badges" to display "Global" (for 'classes-global' paths) or "Recipe" (for 'classes-recipe' paths).
[YOCTO #15238]
--- templates/layerindex/classes.html | 5 ++++- templates/layerindex/detail.html | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-)
templates/layerindex/classes.html +4 -1
@@ -54,7 +54,10 @@ <tbody> {% for class in class_list %} <tr> - <td><a href="{{ class.vcs_web_url }}">{{ class.name }}</a></td> + <td> + <a href="{{ class.vcs_web_url }}">{{ class.name }}</a> + <span class="badge badge-info" id="id_bbclass_type">{{ class.bbclass_type }}</span> + </td> <td><a href="{% url 'layer_item' url_branch class.layerbranch.layer.name %}">{{ class.layerbranch.layer.name }}</a></td> </tr> {% endfor %}
templates/layerindex/detail.html +4 -1
@@ -311,7 +311,10 @@ <tbody> {% for class in classes %} <tr> - <td><a href="{{ class.vcs_web_url }}">{{ class.name }}</a></td> + <td> + <a href="{{ class.vcs_web_url }}">{{ class.name }}</a> + <span class="badge badge-info" id="id_bbclass_typ">{{ class.bbclass_type }}</span> + </td> </tr> {% endfor %} </tbody>
Signature · 1 line
2.34.1
PATCH 5/5 layerindex/update_layer.py: enable classes-global,-recipe
In reply to Tim OrlingAdd support for the new BBClassGlobal and BBClassRecipe sub-classes.
[YOCTO #15238]
--- layerindex/update_layer.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
layerindex/update_layer.py +16 -3
@@ -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()
Signature · 1 line
2.34.1