mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-05 13:14:46 +02:00
Show links to include files on recipe detail
On the recipe detail page we provide a link to the actual recipe file for reference purposes. However, for recipes that include a common .inc file, many of the definitions of variable values will be inside the .inc, therefore if you just look at the recipe you won't see the full picture. Of course you can just go up to the parent directory in the repository web interface, but for convenience's sake add links to any files that are included/required by the recipe that are adjacent to the recipe itself. (We already have the data in the form of the RecipeFileDependency records that are intended to ensure we know when the recipe needs to be updated if one of the files it includes changes). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
f38bae1dd9
commit
d17080d325
|
@ -467,6 +467,17 @@ class Recipe(models.Model):
|
|||
eu = ExtraURL(name=item.name, url=item.render_url(self))
|
||||
yield eu
|
||||
|
||||
def adjacent_includes(self):
|
||||
"""Returns an iterator over any files included by this recipe that are adjacent to the recipe (usually .inc files)"""
|
||||
recipepath = os.path.join(self.layerbranch.vcs_subdir, self.filepath)
|
||||
if not recipepath.endswith('/'):
|
||||
recipepath += '/'
|
||||
IncludeFile = namedtuple('IncludeFile', 'filepath vcs_web_url')
|
||||
for rfd in self.recipefiledependency_set.all():
|
||||
if rfd.path.startswith(recipepath) and not os.path.basename(rfd.path) == self.filename:
|
||||
ifile = IncludeFile(filepath=rfd.layer_path(), vcs_web_url=rfd.vcs_web_url())
|
||||
yield ifile
|
||||
|
||||
def comparison_recipes(self):
|
||||
return ClassicRecipe.objects.filter(cover_layerbranch=self.layerbranch).filter(cover_pn=self.pn)
|
||||
|
||||
|
@ -560,6 +571,13 @@ class RecipeFileDependency(models.Model):
|
|||
class Meta:
|
||||
verbose_name_plural = "Recipe file dependencies"
|
||||
|
||||
def layer_path(self):
|
||||
return os.path.relpath(self.path, self.layerbranch.vcs_subdir)
|
||||
|
||||
def vcs_web_url(self):
|
||||
url = self.layerbranch.file_url(self.layer_path())
|
||||
return url or ''
|
||||
|
||||
def __str__(self):
|
||||
return '%s' % self.path
|
||||
|
||||
|
|
|
@ -870,6 +870,11 @@ class RecipeDetailView(DetailView):
|
|||
context['verappends'] = verappends
|
||||
context['packageconfigs'] = recipe.packageconfig_set.order_by('feature')
|
||||
context['staticdependencies'] = recipe.staticbuilddep_set.order_by('name')
|
||||
extrafiles = []
|
||||
for dep in recipe.recipefiledependency_set.all():
|
||||
if dep.path.endswith('.inc'):
|
||||
extrafiles.append(dep)
|
||||
context['extrafiles'] = extrafiles
|
||||
return context
|
||||
|
||||
|
||||
|
|
|
@ -116,6 +116,13 @@
|
|||
{% else %}
|
||||
{{ rcp.full_path }}
|
||||
{% endif %}
|
||||
{% for include in rcp.adjacent_includes %}
|
||||
{% if include.vcs_web_url %}
|
||||
<br><a href="{{ include.vcs_web_url }}">{{ include.filepath }}</a>
|
||||
{% else %}
|
||||
<br>{{ include.filepath }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
|
|
|
@ -96,6 +96,13 @@
|
|||
{% else %}
|
||||
{{ recipe.full_path }}
|
||||
{% endif %}
|
||||
{% for include in recipe.adjacent_includes %}
|
||||
{% if include.vcs_web_url %}
|
||||
<br><a href="{{ include.vcs_web_url }}">{{ include.filepath }}</a>
|
||||
{% else %}
|
||||
<br>{{ include.filepath }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
Loading…
Reference in New Issue
Block a user