Skip to contentSkip to conversation

layerindex: show when a layer branch is no longer updated

PATCH Superseded Tim Orling 1 participant 1 message Nov 14

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Tim Orling

author
#0 lore raw

PATCH 1/1 layerindex: show when a layer branch is no longer updated

Updates can be turned off for a layer, a branch or a layer branch, but only the admin interface showed it, so the layer list and layer pages gave no hint that the information may be out of date. Show a "not updated" label with the reason next to the layer in the layer list and on the layer page.

[YOCTO #14781]

AI-Generated: Claude Opus 5.5

---
On a test instance loaded with a copy of the layers.openembedded.org database, 171 layer branches on master get the label: 57 layers marked "No update" (e.g. meta-ros2-foxy) and 114 layer branches with updates turned off (e.g. meta-efikamx, which has no LAYERSERIES_COMPAT). Applies to master and to master-next.

 layerindex/models.py             | 11 ++++++++
 layerindex/views.py              |  2 +-
 templates/layerindex/detail.html |  7 +++++
 templates/layerindex/layers.html |  1 +
 tests/test_updates_disabled.py   | 45 ++++++++++++++++++++++++++++++++
 5 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 tests/test_updates_disabled.py
layerindex/models.py +11 -0
index 1d72c55..d071788 100644
@@ -334,6 +334,17 @@ class LayerBranch(models.Model):
     def test_file_url(self):
         return self.file_url('conf/layer.conf')
 
+    def updates_disabled_reason(self):
+        """Why the update script no longer updates this layer branch, if it
+        doesn't"""
+        if self.layer.status == 'X':
+            return 'Updates are disabled for this layer'
+        if not self.branch.updates_enabled:
+            return 'Updates are disabled for the %s branch' % self.branch.name
+        if not self.updates_enabled:
+            return 'Updates are disabled for this layer on the %s branch' % self.branch.name
+        return ''
+
     def get_checkout_branch(self):
         """Get the branch that we actually need to check out in the repo"""
         if self.actual_branch:
layerindex/views.py +1 -1
index 592311f..85c82d6 100644
@@ -443,7 +443,7 @@ class LayerListView(ListView):
 
     def get_queryset(self):
         _check_url_branch(self.kwargs)
-        return LayerBranch.objects.filter(branch__name=self.kwargs['branch']).filter(layer__status__in=['P', 'X']).order_by('layer__layer_type', '-layer__index_preference', 'layer__name')
+        return LayerBranch.objects.filter(branch__name=self.kwargs['branch']).filter(layer__status__in=['P', 'X']).select_related('branch').order_by('layer__layer_type', '-layer__index_preference', 'layer__name')
 
     def get_context_data(self, **kwargs):
         context = super(LayerListView, self).get_context_data(**kwargs)
templates/layerindex/detail.html +7 -0
index 6c20f47..910499f 100644
@@ -125,6 +125,13 @@
                     <span class="text-muted"><small>Last commit: {{ layerbranch.vcs_last_commit|timesince }} ago ({{ layerbranch.get_checkout_branch }} branch)</small></span>
                     </p>
                     {% endif %}
+                    {% with reason=layerbranch.updates_disabled_reason %}
+                    {% if reason %}
+                    <p>
+                    <span class="label label-default">not updated</span> <small class="text-muted">{{ reason }}, so the information here may be out of date.</small>
+                    </p>
+                    {% endif %}
+                    {% endwith %}
 
                     {% if layerbranch.active_maintainers.count > 0 %}
                     <h3>{% if layerbranch.active_maintainers|length == 1 %}Maintainer{% else %}Maintainers{% endif %}</h3>
templates/layerindex/layers.html +1 -0
index daae8cb..73792f4 100644
@@ -75,6 +75,7 @@
                     {% for layerbranch in layerbranch_list %}
                     <tr class="layertype_{{ layerbranch.layer.layer_type }}">
                         <td><a href="{% url 'layer_item' url_branch layerbranch.layer.name %}">{{ layerbranch.layer.name }}</a>
+                            {% with reason=layerbranch.updates_disabled_reason %}{% if reason %}<span class="label label-default" title="{{ reason }}">not updated</span>{% endif %}{% endwith %}
                             {% if layerbranch.yp_compatible_version %}
                             <a href="{{layerbranch.yp_compatible_version.link_url}}"><img src="{{layerbranch.yp_compatible_version.image_url}}" alt="{{layerbranch.yp_compatible_version.description}}" class="yp-icon" title="{{layerbranch.yp_compatible_version.description}}" ></a>
                             {% endif %}
tests/test_updates_disabled.py new file +45 -0

45 lines not on this page · raw message

base-commit: 08e58cdece30019a6f9e5d14af16ebe20afa6177

Signature · 1 line
2.56.0