mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
Fix append list name matching
* Recipes without versions in the file name (such as alsa-state.bb) weren't having their bbappends listed. Use a regex match to fix this. * Use the prefix from the filename instead of PN, since that's how BitBake does it * List version matching bbappends first, then non-matching in muted colour Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
4db9555a67
commit
cd26148eed
|
@ -337,6 +337,16 @@ class BBAppend(models.Model):
|
|||
url = self.layerbranch.file_url(os.path.join(self.filepath, self.filename))
|
||||
return url or ''
|
||||
|
||||
def matches_recipe(self, recipe):
|
||||
recipename = recipe.filename[:-3]
|
||||
appendname = self.filename[:-9]
|
||||
if recipename == appendname:
|
||||
return True
|
||||
elif '%' in appendname:
|
||||
import fnmatch
|
||||
return fnmatch.fnmatch(recipename, appendname.replace('%', '*'))
|
||||
return False
|
||||
|
||||
def __unicode__(self):
|
||||
return os.path.join(self.filepath, self.filename)
|
||||
|
||||
|
|
|
@ -656,8 +656,15 @@ class RecipeDetailView(DetailView):
|
|||
context = super(RecipeDetailView, self).get_context_data(**kwargs)
|
||||
recipe = self.get_object()
|
||||
if recipe:
|
||||
appendprefix = "%s_" % recipe.pn
|
||||
context['appends'] = BBAppend.objects.filter(layerbranch__branch=recipe.layerbranch.branch).filter(filename__startswith=appendprefix)
|
||||
verappendprefix = recipe.filename.split('.bb')[0]
|
||||
appendprefix = verappendprefix.split('_')[0]
|
||||
#context['verappends'] = BBAppend.objects.filter(layerbranch__branch=recipe.layerbranch.branch).filter(filename='%s.bbappend' % verappendprefix)
|
||||
context['appends'] = BBAppend.objects.filter(layerbranch__branch=recipe.layerbranch.branch).filter(filename__regex=r'%s(_[^_]*)?\.bbappend' % appendprefix)
|
||||
verappends = []
|
||||
for append in context['appends']:
|
||||
if append.matches_recipe(recipe):
|
||||
verappends.append(append)
|
||||
context['verappends'] = verappends
|
||||
return context
|
||||
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
<h2>bbappends</h2>
|
||||
<p>This recipe is appended by:</p>
|
||||
<table class="table table-bordered">
|
||||
{% for append in appends %}
|
||||
{% for append in verappends %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url layer_item append.layerbranch.branch.name append.layerbranch.layer.name %}">{{ append.layerbranch.layer.name }}</a>
|
||||
|
@ -100,6 +100,18 @@
|
|||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% for append in appends %}
|
||||
{% if not append in verappends %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url layer_item append.layerbranch.branch.name append.layerbranch.layer.name %}" class="muted">{{ append.layerbranch.layer.name }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ append.vcs_web_url }}" class="muted">{{ append.filename }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user