diff options
| -rw-r--r-- | bitbake/lib/toaster/orm/models.py | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index ee8f1f7166..5e715e302f 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
| @@ -1455,11 +1455,57 @@ class CustomImageRecipe(Recipe): | |||
| 1455 | Q(build__project=self.project) & | 1455 | Q(build__project=self.project) & |
| 1456 | Q(target=self.name)).last() | 1456 | Q(target=self.name)).last() |
| 1457 | 1457 | ||
| 1458 | def update_package_list(self): | ||
| 1459 | """ Update the package list from the last good build of this | ||
| 1460 | CustomImageRecipe | ||
| 1461 | """ | ||
| 1462 | # Check if we're aldready up-to-date or not | ||
| 1463 | target = self.get_last_successful_built_target() | ||
| 1464 | if target == None: | ||
| 1465 | # So we've never actually built this Custom recipe but what about | ||
| 1466 | # the recipe it's based on? | ||
| 1467 | target = \ | ||
| 1468 | Target.objects.filter(Q(build__outcome=Build.SUCCEEDED) & | ||
| 1469 | Q(build__project=self.project) & | ||
| 1470 | Q(target=self.base_recipe.name)).last() | ||
| 1471 | if target == None: | ||
| 1472 | return | ||
| 1473 | |||
| 1474 | if target.build.completed_on == self.last_updated: | ||
| 1475 | return | ||
| 1476 | |||
| 1477 | self.includes_set.clear() | ||
| 1478 | |||
| 1479 | excludes_list = self.excludes_set.values_list('name', flat=True) | ||
| 1480 | appends_list = self.appends_set.values_list('name', flat=True) | ||
| 1481 | |||
| 1482 | built_packages_list = \ | ||
| 1483 | target.target_installed_package_set.values_list('package__name', | ||
| 1484 | flat=True) | ||
| 1485 | for built_package in built_packages_list: | ||
| 1486 | # Is the built package in the custom packages list? | ||
| 1487 | if built_package in excludes_list: | ||
| 1488 | continue | ||
| 1489 | |||
| 1490 | if built_package in appends_list: | ||
| 1491 | continue | ||
| 1492 | |||
| 1493 | cust_img_p = \ | ||
| 1494 | CustomImagePackage.objects.get(name=built_package) | ||
| 1495 | self.includes_set.add(cust_img_p) | ||
| 1496 | |||
| 1497 | |||
| 1498 | self.last_updated = target.build.completed_on | ||
| 1499 | self.save() | ||
| 1500 | |||
| 1458 | def get_all_packages(self): | 1501 | def get_all_packages(self): |
| 1459 | """Get the included packages and any appended packages""" | 1502 | """Get the included packages and any appended packages""" |
| 1503 | self.update_package_list() | ||
| 1504 | |||
| 1460 | return CustomImagePackage.objects.filter((Q(recipe_appends=self) | | 1505 | return CustomImagePackage.objects.filter((Q(recipe_appends=self) | |
| 1461 | Q(recipe_includes=self)) & | 1506 | Q(recipe_includes=self)) & |
| 1462 | ~Q(recipe_excludes=self)) | 1507 | ~Q(recipe_excludes=self)) |
| 1508 | |||
| 1463 | 1509 | ||
| 1464 | def generate_recipe_file_contents(self): | 1510 | def generate_recipe_file_contents(self): |
| 1465 | """Generate the contents for the recipe file.""" | 1511 | """Generate the contents for the recipe file.""" |
