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
# 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
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)
# 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]