bitbake: toaster: models add get_last_successful_built_target method

Add a convenience method to get the last successful build
target for a CustomImageRecipe.

(Bitbake rev: 4dde3d830cd38bbe306d83629dcb80da5fc9b027)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Michael Wood 2016-02-05 11:41:43 +00:00 committed by Richard Purdie
parent 8885b7bfd3
commit 18d8b17052
1 changed files with 7 additions and 0 deletions

View File

@ -1447,6 +1447,13 @@ class CustomImageRecipe(Recipe):
base_recipe = models.ForeignKey(Recipe, related_name='based_on_recipe')
project = models.ForeignKey(Project)
def get_last_successful_built_target(self):
""" Return the last successful built target object if one exists
otherwise return None """
return Target.objects.filter(Q(build__outcome=Build.SUCCEEDED) &
Q(build__project=self.project) &
Q(target=self.name)).last()
def get_all_packages(self):
"""Get the included packages and any appended packages"""
return CustomImagePackage.objects.filter((Q(recipe_appends=self) |