From 18d8b170520817c4307345631a8b804ada0f21ab Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Fri, 5 Feb 2016 11:41:43 +0000 Subject: 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 Signed-off-by: brian avery Signed-off-by: Richard Purdie --- bitbake/lib/toaster/orm/models.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bitbake/lib/toaster/orm') diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 7f7b1f37e9..9bfc00d667 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py @@ -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) | -- cgit v1.2.3-54-g00ecf