bitbake: toaster: only show "New custom image" button for builds with image targets

Add a has_image_targets() method to Build, and use that to hide
the "New custom image" button on the build dashboard if a build
has no targets which build images.

[YOCTO #9514]

(Bitbake rev: 3c4b053e44ea512ef2ced67289a7b0161db6ce9b)

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: bavery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Elliot Smith
2016-07-12 15:54:51 -07:00
committed by Richard Purdie
parent 587275eefd
commit 07a58a8944
2 changed files with 35 additions and 20 deletions

View File

@@ -449,6 +449,19 @@ class Build(models.Model):
break
return has_images
def has_image_targets(self):
"""
Returns True if a build has any targets which were built from
image recipes.
"""
targets = Target.objects.filter(build_id=self.id)
has_image_targets = False
for target in targets:
if target.is_image:
has_image_targets = True
break
return has_image_targets
def get_image_file_extensions(self):
"""
Get string of file name extensions for images produced by this build;