diff options
-rw-r--r-- | bitbake/lib/toaster/orm/models.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 4f8510c4ec..b24e9c5492 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -1478,17 +1478,22 @@ class Layer_Version(models.Model): | |||
1478 | 1478 | ||
1479 | def get_alldeps(self, project_id): | 1479 | def get_alldeps(self, project_id): |
1480 | """Get full list of unique layer dependencies.""" | 1480 | """Get full list of unique layer dependencies.""" |
1481 | def gen_layerdeps(lver, project): | 1481 | def gen_layerdeps(lver, project, depth): |
1482 | if depth == 0: | ||
1483 | return | ||
1482 | for ldep in lver.dependencies.all(): | 1484 | for ldep in lver.dependencies.all(): |
1483 | yield ldep.depends_on | 1485 | yield ldep.depends_on |
1484 | # get next level of deps recursively calling gen_layerdeps | 1486 | # get next level of deps recursively calling gen_layerdeps |
1485 | for subdep in gen_layerdeps(ldep.depends_on, project): | 1487 | for subdep in gen_layerdeps(ldep.depends_on, project, depth-1): |
1486 | yield subdep | 1488 | yield subdep |
1487 | 1489 | ||
1488 | project = Project.objects.get(pk=project_id) | 1490 | project = Project.objects.get(pk=project_id) |
1489 | result = [] | 1491 | result = [] |
1490 | projectlvers = [player.layercommit for player in project.projectlayer_set.all()] | 1492 | projectlvers = [player.layercommit for player in |
1491 | for dep in gen_layerdeps(self, project): | 1493 | project.projectlayer_set.all()] |
1494 | # protect against infinite layer dependency loops | ||
1495 | maxdepth = 20 | ||
1496 | for dep in gen_layerdeps(self, project, maxdepth): | ||
1492 | # filter out duplicates and layers already belonging to the project | 1497 | # filter out duplicates and layers already belonging to the project |
1493 | if dep not in result + projectlvers: | 1498 | if dep not in result + projectlvers: |
1494 | result.append(dep) | 1499 | result.append(dep) |