Add support for inherit field in recipes
PATCH 1/1 Add support for inherit field in recipes
From: Alex Franco <[email protected]>
Modified: models.py, update.py, recipes.html, detail.html, recipedetail.html, additional.css
To identify image recipes and provide inheritance data for recipes, an inherits field was added to the recipe model, and then populated using refactored data from __inherit_cache. Finally the field was also added to Toaster templates, along with style changes proposed in attachment.
[YOCTO #7575]
Signed-off-by Alex Franco <[email protected]>
Signed-off-by Aníbal Limón <[email protected]>
--- layerindex/models.py | 1 + layerindex/static/css/additional.css | 11 ++++++++++- layerindex/update.py | 2 ++ templates/layerindex/detail.html | 4 +++- templates/layerindex/recipedetail.html | 4 ++++ templates/layerindex/recipes.html | 4 +++- 6 files changed, 23 insertions(+), 3 deletions(-)
layerindex/models.py +1 -0
@@ -242,6 +242,7 @@ class Recipe(models.Model): bugtracker = models.URLField(blank=True) provides = models.CharField(max_length=255, blank=True) bbclassextend = models.CharField(max_length=100, blank=True) + inherits = models.CharField(max_length=255, blank=True) updated = models.DateTimeField(auto_now = True)
layerindex/static/css/additional.css +10 -1
@@ -198,4 +198,13 @@ padding: 8px; .buttonblock-btn { margin-left: 8px; -} +} + +.icon-hdd { + margin-left: 2px; +} + +.icon-hdd:hover { + cursor: pointer; +} +
layerindex/update.py +2 -0
@@ -65,6 +65,8 @@ def update_recipe_file(data, path, recipe, layerdir_start, repodir): recipe.bugtracker = envdata.getVar("BUGTRACKER", True) or "" recipe.provides = envdata.getVar("PROVIDES", True) or "" recipe.bbclassextend = envdata.getVar("BBCLASSEXTEND", True) or "" + rlist = envdata.getVar("__inherit_cache", True) or [] + recipe.inherits = ' '.join(sorted([(split_recipe_fn(r)[0]) for r in rlist])) or "" recipe.save() # Get file dependencies within this layer
templates/layerindex/detail.html +3 -1
@@ -198,7 +198,7 @@ <tbody> {% for recipe in layerbranch.sorted_recipes %} <tr> - <td><a href="{% url recipe recipe.id %}">{{ recipe.name }}</a></td> + <td><a href="{% url recipe recipe.id %}">{{ recipe.name }}</a>{% if 'image' in recipe.inherits %}<i class="icon-hdd"></i>{% endif %}</td> <td>{{ recipe.pv }}</td> <td class="span8">{{ recipe.short_desc }}</td> </tr>
@@ -321,6 +321,8 @@ e.preventDefault(); $(this).tab('show'); }) + + $('.icon-hdd').tooltip({title:"Inherits image"}); }); }); </script>
templates/layerindex/recipedetail.html +4 -0
@@ -83,6 +83,10 @@ <th>Layer</th> <td><a href="{% url layer_item recipe.layerbranch.branch.name recipe.layerbranch.layer.name %}">{{ recipe.layerbranch.layer.name }}</a> ({{ recipe.layerbranch.branch.name}} branch)</td> </tr> + <tr> + <th>Inherits</th> + <td>{{ recipe.inherits }}</td> + </tr> </tbody> </table>
templates/layerindex/recipes.html +3 -1
@@ -52,7 +52,7 @@ <tbody> {% for recipe in recipe_list %} <tr {% if recipe.preferred_count > 0 %}class="muted"{% endif %}> - <td><a href="{% url recipe recipe.id %}">{{ recipe.name }}</a></td> + <td><a href="{% url recipe recipe.id %}">{{ recipe.name }}</a>{% if 'image' in recipe.inherits %}<i class="icon-hdd"></i>{% endif %}</td> <td>{{ recipe.pv }}</td> <td>{{ recipe.short_desc }}</td> <td><a href="{% url layer_item url_branch recipe.layerbranch.layer.name %}">{{ recipe.layerbranch.layer.name }}</a></td>
@@ -82,6 +82,8 @@ firstfield = $("#filter-form input:text").first() if( ! firstfield.val() ) firstfield.focus() + + $('.icon-hdd').tooltip({title:"Inherits image"}); }); </script> {% endblock %}
Signature · 1 line
1.9.1