[bitbake-devel] [PATCH 79/94] bitbake: dsi: record recipe dependency
Alex DAMIAN
alexandru.damian at intel.com
Tue Sep 24 16:52:48 UTC 2013
From: Alexandru DAMIAN <alexandru.damian at intel.com>
Add code to record recipe dependencies, for DEPENDS
and RDEPENDS relationships.
Caveat emptor: relationships with ASSUME_PROVIDED
PNs will not be recorded, as they don't have real
recipe objects.
Adds code to the Simple interface to allow visualisation
of the recorded data.
Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
---
bitbake/lib/bb/ui/buildinfohelper.py | 23 +++++++++++++++++++++-
bitbake/lib/webhob/bldviewer/templates/recipe.html | 9 +++++++++
bitbake/lib/webhob/orm/models.py | 11 +++++++++--
3 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 8b0e720..cf947da 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -9,7 +9,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webhob.whbmain.settings")
import webhob.whbmain.settings as whb_django_settings
from webhob.orm.models import Machine, Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage
from webhob.orm.models import Target_Package, Build_Package, Variable, Build_File
-from webhob.orm.models import Task_Dependency, Build_Package_Dependency, Target_Package_Dependency
+from webhob.orm.models import Task_Dependency, Build_Package_Dependency, Target_Package_Dependency, Recipe_Dependency
from bb.msg import BBLogFormatter as format
class ORMWrapper(object):
@@ -562,6 +562,27 @@ class BuildInfoHelper(object):
t.save()
self.internal_state['recipes'][pn] = recipe
+ # save recipe dependency
+ try:
+ # buildtime
+ for recipe in event._depgraph['depends']:
+ target = self.internal_state['recipes'][recipe]
+ for dep in event._depgraph['depends'][recipe]:
+ dependency = self.internal_state['recipes'][dep]
+ Recipe_Dependency.objects.get_or_create( recipe = target,
+ depends_on = dependency, dep_type = Recipe_Dependency.TYPE_DEPENDS)
+
+ # runtime
+ for recipe in event._depgraph['rdepends-pn']:
+ target = self.internal_state['recipes'][recipe]
+ for dep in event._depgraph['rdepends-pn'][recipe]:
+ dependency = self.internal_state['recipes'][dep]
+ Recipe_Dependency.objects.get_or_create( recipe = target,
+ depends_on = dependency, dep_type = Recipe_Dependency.TYPE_RDEPENDS)
+
+ except KeyError: # we'll not get recipes for key w/ values listed in ASSUME_PROVIDED
+ pass
+
# save all task information
def _save_a_task(taskdesc):
spec = re.split(r'\.', taskdesc);
diff --git a/bitbake/lib/webhob/bldviewer/templates/recipe.html b/bitbake/lib/webhob/bldviewer/templates/recipe.html
index 32fcdb8..e81883f 100644
--- a/bitbake/lib/webhob/bldviewer/templates/recipe.html
+++ b/bitbake/lib/webhob/bldviewer/templates/recipe.html
@@ -22,6 +22,8 @@
<th>Bugtracker</th>
<th>Author</th>
<th>File_path</th>
+ <th style="width: 30em">Recipe Dependency</th>
+
{% for recipe in recipes %}
@@ -36,6 +38,13 @@
<td>{{recipe.bugtracker}}</td>
<td>{{recipe.author}}</td>
<td>{{recipe.file_path}}</td>
+ <td>
+ <div style="height: 5em; overflow:auto">
+ {% for rr in recipe.r_dependencies_recipe.all %}
+ <a href="#{{rr.depends_on.name}}">{{rr.depends_on.name}}</a><br/>
+ {% endfor %}
+ </div>
+ </td>
</tr>
{% endfor %}
diff --git a/bitbake/lib/webhob/orm/models.py b/bitbake/lib/webhob/orm/models.py
index aa368fe..7ce0d1f 100644
--- a/bitbake/lib/webhob/orm/models.py
+++ b/bitbake/lib/webhob/orm/models.py
@@ -184,9 +184,16 @@ class Recipe(models.Model):
class Recipe_Dependency(models.Model):
- recipe = models.ForeignKey(Recipe, related_name='recipe_dependencies_recipe')
- depends_on = models.ForeignKey(Recipe, related_name='recipe_dependencies_depends')
+ TYPE_DEPENDS = 0
+ TYPE_RDEPENDS = 1
+ DEPENDS_TYPE = (
+ (TYPE_DEPENDS, "depends"),
+ (TYPE_RDEPENDS, "rdepends"),
+ )
+ recipe = models.ForeignKey(Recipe, related_name='r_dependencies_recipe')
+ depends_on = models.ForeignKey(Recipe, related_name='r_dependencies_depends')
+ dep_type = models.IntegerField(choices=DEPENDS_TYPE)
class Layer(models.Model):
name = models.CharField(max_length=100)
--
1.8.1.2
More information about the bitbake-devel
mailing list