[Toaster] [PATCH 2/5] toaster: orm Add a constant for the CustomImageRecipe's layer name
Michael Wood
michael.g.wood at intel.com
Fri Mar 4 09:58:57 PST 2016
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>
---
bitbake/lib/bb/ui/buildinfohelper.py | 2 +-
bitbake/lib/toaster/orm/models.py | 4 ++++
bitbake/lib/toaster/toastergui/views.py | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 81abede..20ccbc6 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -326,7 +326,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/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 93b5df3..d451989 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -1430,6 +1430,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/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index f3b8d3c..9baa956 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2392,7 +2392,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]
--
2.5.0
More information about the toaster
mailing list