[bitbake-devel] [PATCH 2/5] toaster: orm Add a constant for the CustomImageRecipe's layer name

Elliot Smith elliot.smith at intel.com
Wed Mar 23 08:28:37 UTC 2016


From: Michael Wood <michael.g.wood at intel.com>

Use a constant to define the name for the toaster custom images layer;
this constant is then used to identify this layer in various places.

Signed-off-by: Michael Wood <michael.g.wood at intel.com>
Signed-off-by: Elliot Smith <elliot.smith at intel.com>
---
 lib/bb/ui/buildinfohelper.py    | 4 ++--
 lib/toaster/orm/models.py       | 4 ++++
 lib/toaster/toastergui/views.py | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index 28c7353..7b8b1a5 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -42,7 +42,7 @@ from orm.models import Variable, VariableHistory
 from orm.models import Package, Package_File, Target_Installed_Package, Target_File
 from orm.models import Task_Dependency, Package_Dependency
 from orm.models import Recipe_Dependency, Provides
-from orm.models import Project, CustomImagePackage
+from orm.models import Project, CustomImagePackage, CustomImageRecipe
 
 from bldcontrol.models import BuildEnvironment, BuildRequest
 
@@ -344,7 +344,7 @@ class ORMWrapper(object):
             # Special case the toaster-custom-images layer which is created
             # on the fly so don't update the values which may cause the layer
             # to be duplicated on a future get_or_create
-            if layer_obj.layer.name == "toaster-custom-images":
+            if layer_obj.layer.name == CustomImageRecipe.LAYER_NAME:
                 return layer_obj
             # We already found our layer version for this build so just
             # update it with the new build information
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 3c98c0b..a8b0408 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -1448,6 +1448,10 @@ class ProjectLayer(models.Model):
         unique_together = (("project", "layercommit"),)
 
 class CustomImageRecipe(Recipe):
+
+    # CustomImageRecipe's belong to layers called:
+    LAYER_NAME = "toaster-custom-images"
+
     search_allowed_fields = ['name']
     base_recipe = models.ForeignKey(Recipe, related_name='based_on_recipe')
     project = models.ForeignKey(Project)
diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py
index 85ca9be..15760b3 100755
--- a/lib/toaster/toastergui/views.py
+++ b/lib/toaster/toastergui/views.py
@@ -2407,7 +2407,7 @@ if True:
 
             # create layer 'Custom layer' and verion if needed
             layer = Layer.objects.get_or_create(
-                name="toaster-custom-images",
+                name=CustomImageRecipe.LAYER_NAME,
                 summary="Layer for custom recipes",
                 vcs_url="file:///toaster_created_layer")[0]
 
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.




More information about the bitbake-devel mailing list