[oe-commits] [bitbake] 17/20: toaster: the customise image button shouldn't rely on targets

git at git.openembedded.org git at git.openembedded.org
Tue Jul 19 08:01:21 UTC 2016


rpurdie pushed a commit to branch master
in repository bitbake.

commit 6648876c91134bda8498b4f8d7ace9147ec0d985
Author: Elliot Smith <elliot.smith at intel.com>
AuthorDate: Tue Jul 12 15:54:55 2016 -0700

    toaster: the customise image button shouldn't rely on targets
    
    The build dashboard customise image button (for creating a new
    custom image based on an image recipe used by a build) shouldn't
    rely on targets: whether a new custom image can be created or not
    depends on whether any of the recipes used by the build are image
    recipes.
    
    Modify the method used to determine whether a build has customisable
    images to look at the image recipes used during the build, rather
    than whether the targets run by the build refer to image recipes.
    
    Signed-off-by: Elliot Smith <elliot.smith at intel.com>
    Signed-off-by: bavery <brian.avery at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/toaster/orm/models.py                           | 11 +++--------
 lib/toaster/toastergui/templates/basebuildpage.html |  2 +-
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 8e40f0a..048399f 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -449,18 +449,13 @@ class Build(models.Model):
                 break
         return has_images
 
-    def has_image_targets(self):
+    def has_image_recipes(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
+        image_recipes = self.get_image_recipes()
+        return len(image_recipes) > 0
 
     def get_image_file_extensions(self):
         """
diff --git a/lib/toaster/toastergui/templates/basebuildpage.html b/lib/toaster/toastergui/templates/basebuildpage.html
index 8d7c562..eb709bb 100644
--- a/lib/toaster/toastergui/templates/basebuildpage.html
+++ b/lib/toaster/toastergui/templates/basebuildpage.html
@@ -117,7 +117,7 @@
         {% endwith %}
 
           <!-- new custom image from image recipe in this build -->
-          {% if build.has_image_targets %}
+          {% if build.has_image_recipes %}
             <button class="btn btn-default btn-block navbar-btn" data-role="new-custom-image-trigger">New custom image</button>
             {% include 'newcustomimage_modal.html' %}
             <script>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list