summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/orm/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/orm/models.py')
-rw-r--r--bitbake/lib/toaster/orm/models.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 9851c92b71..9a5942b75e 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -1177,6 +1177,25 @@ class Layer_Version(models.Model):
1177 def get_detailspage_url(self, project_id): 1177 def get_detailspage_url(self, project_id):
1178 return reverse('layerdetails', args=(project_id, self.pk)) 1178 return reverse('layerdetails', args=(project_id, self.pk))
1179 1179
1180 def get_alldeps(self, project_id):
1181 """Get full list of unique layer dependencies."""
1182 def gen_layerdeps(lver, project):
1183 for ldep in lver.dependencies.all():
1184 yield ldep.depends_on
1185 # get next level of deps recursively calling gen_layerdeps
1186 for subdep in gen_layerdeps(ldep.depends_on, project):
1187 yield subdep
1188
1189 project = Project.objects.get(pk=project_id)
1190 result = []
1191 projectlvers = [player.layercommit for player in project.projectlayer_set.all()]
1192 for dep in gen_layerdeps(self, project):
1193 # filter out duplicates and layers already belonging to the project
1194 if dep not in result + projectlvers:
1195 result.append(dep)
1196
1197 return sorted(result, key=lambda x: x.layer.name)
1198
1180 def __unicode__(self): 1199 def __unicode__(self):
1181 return "%d %s (VCS %s, Project %s)" % (self.pk, str(self.layer), self.get_vcs_reference(), self.build.project if self.build is not None else "No project") 1200 return "%d %s (VCS %s, Project %s)" % (self.pk, str(self.layer), self.get_vcs_reference(), self.build.project if self.build is not None else "No project")
1182 1201