diff options
author | Elliot Smith <elliot.smith@intel.com> | 2016-07-12 15:54:51 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-19 08:56:52 +0100 |
commit | 07a58a8944315f87107b29c3d66bc3a7d57c0249 (patch) | |
tree | 1c80fc596636db3971542ac903092a4b1d39f7da /bitbake/lib/toaster/orm/models.py | |
parent | 587275eefd744032f00ebdce35134b2ab2bb7572 (diff) | |
download | poky-07a58a8944315f87107b29c3d66bc3a7d57c0249.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/toaster/orm/models.py')
-rw-r--r-- | bitbake/lib/toaster/orm/models.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 0443a4589d..a1119168dd 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -449,6 +449,19 @@ class Build(models.Model): | |||
449 | break | 449 | break |
450 | return has_images | 450 | return has_images |
451 | 451 | ||
452 | def has_image_targets(self): | ||
453 | """ | ||
454 | Returns True if a build has any targets which were built from | ||
455 | image recipes. | ||
456 | """ | ||
457 | targets = Target.objects.filter(build_id=self.id) | ||
458 | has_image_targets = False | ||
459 | for target in targets: | ||
460 | if target.is_image: | ||
461 | has_image_targets = True | ||
462 | break | ||
463 | return has_image_targets | ||
464 | |||
452 | def get_image_file_extensions(self): | 465 | def get_image_file_extensions(self): |
453 | """ | 466 | """ |
454 | Get string of file name extensions for images produced by this build; | 467 | Get string of file name extensions for images produced by this build; |