diff options
| -rw-r--r-- | bitbake/lib/bb/ui/buildinfohelper.py | 7 | ||||
| -rw-r--r-- | bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 25 | ||||
| -rw-r--r-- | bitbake/lib/toaster/orm/models.py | 3 | ||||
| -rw-r--r-- | bitbake/lib/toaster/toastergui/api.py | 16 |
4 files changed, 31 insertions, 20 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 3ddcb2ac6d..e96e93440e 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py | |||
| @@ -42,7 +42,7 @@ from orm.models import Variable, VariableHistory | |||
| 42 | from orm.models import Package, Package_File, Target_Installed_Package, Target_File | 42 | from orm.models import Package, Package_File, Target_Installed_Package, Target_File |
| 43 | from orm.models import Task_Dependency, Package_Dependency | 43 | from orm.models import Task_Dependency, Package_Dependency |
| 44 | from orm.models import Recipe_Dependency, Provides | 44 | from orm.models import Recipe_Dependency, Provides |
| 45 | from orm.models import Project, CustomImagePackage, CustomImageRecipe | 45 | from orm.models import Project, CustomImagePackage |
| 46 | from orm.models import signal_runbuilds | 46 | from orm.models import signal_runbuilds |
| 47 | 47 | ||
| 48 | from bldcontrol.models import BuildEnvironment, BuildRequest | 48 | from bldcontrol.models import BuildEnvironment, BuildRequest |
| @@ -361,11 +361,6 @@ class ORMWrapper(object): | |||
| 361 | 361 | ||
| 362 | def get_update_layer_version_object(self, build_obj, layer_obj, layer_version_information): | 362 | def get_update_layer_version_object(self, build_obj, layer_obj, layer_version_information): |
| 363 | if isinstance(layer_obj, Layer_Version): | 363 | if isinstance(layer_obj, Layer_Version): |
| 364 | # Special case the toaster-custom-images layer which is created | ||
| 365 | # on the fly so don't update the values which may cause the layer | ||
| 366 | # to be duplicated on a future get_or_create | ||
| 367 | if layer_obj.layer.name == CustomImageRecipe.LAYER_NAME: | ||
| 368 | return layer_obj | ||
| 369 | # We already found our layer version for this build so just | 364 | # We already found our layer version for this build so just |
| 370 | # update it with the new build information | 365 | # update it with the new build information |
| 371 | logger.debug("We found our layer from toaster") | 366 | logger.debug("We found our layer from toaster") |
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py index 11335ac393..18870d9612 100644 --- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | |||
| @@ -228,13 +228,22 @@ class LocalhostBEController(BuildEnvironmentController): | |||
| 228 | br_layer_base_recipe = layers.get( | 228 | br_layer_base_recipe = layers.get( |
| 229 | layer_version=customrecipe.base_recipe.layer_version) | 229 | layer_version=customrecipe.base_recipe.layer_version) |
| 230 | 230 | ||
| 231 | br_layer_base_dirpath = \ | 231 | # If the layer is one that we've cloned we know where it lives |
| 232 | os.path.join(self.be.sourcedir, | 232 | if br_layer_base_recipe.giturl and br_layer_base_recipe.commit: |
| 233 | self.getGitCloneDirectory( | 233 | layer_path = self.getGitCloneDirectory( |
| 234 | br_layer_base_recipe.giturl, | 234 | br_layer_base_recipe.giturl, |
| 235 | br_layer_base_recipe.commit), | 235 | br_layer_base_recipe.commit) |
| 236 | customrecipe.base_recipe.layer_version.dirpath | 236 | # Otherwise it's a local layer |
| 237 | ) | 237 | elif br_layer_base_recipe.local_source_dir: |
| 238 | layer_path = br_layer_base_recipe.local_source_dir | ||
| 239 | else: | ||
| 240 | logger.error("Unable to workout the dir path for the custom" | ||
| 241 | " image recipe") | ||
| 242 | |||
| 243 | br_layer_base_dirpath = os.path.join( | ||
| 244 | self.be.sourcedir, | ||
| 245 | layer_path, | ||
| 246 | customrecipe.base_recipe.layer_version.dirpath) | ||
| 238 | 247 | ||
| 239 | customrecipe.base_recipe.layer_version.dirpath = \ | 248 | customrecipe.base_recipe.layer_version.dirpath = \ |
| 240 | br_layer_base_dirpath | 249 | br_layer_base_dirpath |
| @@ -249,6 +258,8 @@ class LocalhostBEController(BuildEnvironmentController): | |||
| 249 | 258 | ||
| 250 | # Update the layer and recipe objects | 259 | # Update the layer and recipe objects |
| 251 | customrecipe.layer_version.dirpath = layerpath | 260 | customrecipe.layer_version.dirpath = layerpath |
| 261 | customrecipe.layer_version.layer.local_source_dir = layerpath | ||
| 262 | customrecipe.layer_version.layer.save() | ||
| 252 | customrecipe.layer_version.save() | 263 | customrecipe.layer_version.save() |
| 253 | 264 | ||
| 254 | customrecipe.file_path = recipe_path | 265 | customrecipe.file_path = recipe_path |
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index b24e9c5492..fd15fbe7be 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
| @@ -1636,7 +1636,8 @@ class CustomImageRecipe(Recipe): | |||
| 1636 | if base_recipe_path: | 1636 | if base_recipe_path: |
| 1637 | base_recipe = open(base_recipe_path, 'r').read() | 1637 | base_recipe = open(base_recipe_path, 'r').read() |
| 1638 | else: | 1638 | else: |
| 1639 | raise IOError("Based on recipe file not found") | 1639 | raise IOError("Based on recipe file not found: %s" % |
| 1640 | base_recipe_path) | ||
| 1640 | 1641 | ||
| 1641 | # Add a special case for when the recipe we have based a custom image | 1642 | # Add a special case for when the recipe we have based a custom image |
| 1642 | # recipe on requires another recipe. | 1643 | # recipe on requires another recipe. |
diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py index ae1f150770..4851047bfa 100644 --- a/bitbake/lib/toaster/toastergui/api.py +++ b/bitbake/lib/toaster/toastergui/api.py | |||
| @@ -291,10 +291,13 @@ class XhrCustomRecipe(View): | |||
| 291 | return error_response("recipe-already-exists") | 291 | return error_response("recipe-already-exists") |
| 292 | 292 | ||
| 293 | # create layer 'Custom layer' and verion if needed | 293 | # create layer 'Custom layer' and verion if needed |
| 294 | layer = Layer.objects.get_or_create( | 294 | layer, l_created = Layer.objects.get_or_create( |
| 295 | name=CustomImageRecipe.LAYER_NAME, | 295 | name=CustomImageRecipe.LAYER_NAME, |
| 296 | summary="Layer for custom recipes", | 296 | summary="Layer for custom recipes") |
| 297 | vcs_url="file:///toaster_created_layer")[0] | 297 | |
| 298 | if l_created: | ||
| 299 | layer.local_source_dir = "toaster_created_layer" | ||
| 300 | layer.save() | ||
| 298 | 301 | ||
| 299 | # Check if we have a layer version already | 302 | # Check if we have a layer version already |
| 300 | # We don't use get_or_create here because the dirpath will change | 303 | # We don't use get_or_create here because the dirpath will change |
| @@ -303,9 +306,10 @@ class XhrCustomRecipe(View): | |||
| 303 | Q(layer=layer) & | 306 | Q(layer=layer) & |
| 304 | Q(build=None)).last() | 307 | Q(build=None)).last() |
| 305 | if lver is None: | 308 | if lver is None: |
| 306 | lver, created = Layer_Version.objects.get_or_create( | 309 | lver, lv_created = Layer_Version.objects.get_or_create( |
| 307 | project=params['project'], | 310 | project=params['project'], |
| 308 | layer=layer, | 311 | layer=layer, |
| 312 | layer_source=LayerSource.TYPE_LOCAL, | ||
| 309 | dirpath="toaster_created_layer") | 313 | dirpath="toaster_created_layer") |
| 310 | 314 | ||
| 311 | # Add a dependency on our layer to the base recipe's layer | 315 | # Add a dependency on our layer to the base recipe's layer |
| @@ -319,7 +323,7 @@ class XhrCustomRecipe(View): | |||
| 319 | optional=False) | 323 | optional=False) |
| 320 | 324 | ||
| 321 | # Create the actual recipe | 325 | # Create the actual recipe |
| 322 | recipe, created = CustomImageRecipe.objects.get_or_create( | 326 | recipe, r_created = CustomImageRecipe.objects.get_or_create( |
| 323 | name=request.POST["name"], | 327 | name=request.POST["name"], |
| 324 | base_recipe=params["base"], | 328 | base_recipe=params["base"], |
| 325 | project=params["project"], | 329 | project=params["project"], |
| @@ -329,7 +333,7 @@ class XhrCustomRecipe(View): | |||
| 329 | # If we created the object then setup these fields. They may get | 333 | # If we created the object then setup these fields. They may get |
| 330 | # overwritten later on and cause the get_or_create to create a | 334 | # overwritten later on and cause the get_or_create to create a |
| 331 | # duplicate if they've changed. | 335 | # duplicate if they've changed. |
| 332 | if created: | 336 | if r_created: |
| 333 | recipe.file_path = request.POST["name"] | 337 | recipe.file_path = request.POST["name"] |
| 334 | recipe.license = "MIT" | 338 | recipe.license = "MIT" |
| 335 | recipe.version = "0.1" | 339 | recipe.version = "0.1" |
