@@ -193,10 +193,18 @@
</div> <!-- end of container-fluid -->
{% if not layerbranch.vcs_last_commit %}
+ {% with lastupdate=updates.first %}
+ {% if lastupdate.errors %}
+ <div class="alert alert-danger">
+ <b>Warning:</b> The content of this layer on branch {{ url_branch }} could not be indexed: the last update, on {{ lastupdate.started }}, failed. See <a href="{% url 'layerupdate' lastupdate.id %}">its log</a> for the errors.
+ </div>
+ {% else %}
<div class="alert alert-info">
<b>Note:</b> The content of this layer on branch {{ url_branch }} has not yet been indexed. Indexing should take place within a few hours.
</div>
{% endif %}
+ {% endwith %}
+ {% endif %}
<ul class="nav nav-tabs" id="layertabbar">
{% if layerbranch.recipe_set.count > 0 %}
new file mode 100644
@@ -0,0 +1,49 @@
+# layerindex-web - test the layer page of a layer that has not been indexed
+#
+# Licensed under the MIT license, see COPYING.MIT for details
+#
+# SPDX-License-Identifier: MIT
+
+from datetime import datetime
+
+import pytest
+from django.urls import reverse
+
+from layerindex.models import Branch, LayerBranch, LayerItem, LayerUpdate, Update
+
+
+@pytest.fixture
+def new_layer(db):
+ master, _ = Branch.objects.get_or_create(name='master', defaults={'bitbake_branch': 'master'})
+ layer = LayerItem.objects.create(name='meta-new', status='P', layer_type='A', summary='new',
+ description='new', vcs_url='git://example.com/meta-new.git')
+ LayerBranch.objects.create(layer=layer, branch=master)
+ return layer
+
+
+def add_update(layer, log):
+ update = Update.objects.create(started=datetime.now(), finished=datetime.now())
+ layerupdate = LayerUpdate(update=update, layer=layer, branch=Branch.objects.get(name='master'),
+ started=datetime.now(), finished=datetime.now(), log=log)
+ layerupdate.save()
+ return layerupdate
+
+
+@pytest.mark.django_db
+def test_failed_first_parse_shows_warning(client, new_layer):
+ # [YOCTO #13489]
+ layerupdate = add_update(new_layer, 'ERROR: conf/layer.conf not found for layer meta-new')
+ page = client.get(reverse('layer_item', args=('master', 'meta-new'))).content.decode()
+ assert 'could not be indexed' in page
+ assert reverse('layerupdate', args=(layerupdate.id,)) in page
+ assert 'has not yet been indexed' not in page
+
+
+@pytest.mark.django_db
+def test_not_yet_indexed(client, new_layer):
+ for log in (None, 'WARNING: something'):
+ if log:
+ add_update(new_layer, log)
+ page = client.get(reverse('layer_item', args=('master', 'meta-new'))).content.decode()
+ assert 'has not yet been indexed' in page
+ assert 'could not be indexed' not in page
The page of a layer branch that has not been indexed always said that indexing should happen within a few hours, even when the update had already failed, e.g. because of a bad conf/layer.conf. Show a warning with a link to the failed update's log instead. [YOCTO #13489] AI-Generated: Claude Opus 5.5 Signed-off-by: Tim Orling <tim.orling@konsulko.com> --- templates/layerindex/detail.html | 8 ++++++ tests/test_first_parse_status.py | 49 ++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 tests/test_first_parse_status.py