diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-11-04 15:02:28 +0000 |
---|---|---|
committer | Michael Wood <michael.g.wood@intel.com> | 2016-02-08 17:30:15 +0000 |
commit | f3322567378d6038a00da0fab6c5641a1a8e5409 (patch) | |
tree | 5d40e6a6cdf39f244b86a45d0fe886775d929537 /lib/toaster/bldcontrol/localhostbecontroller.py | |
parent | 6863343c3434ce19aa4b609c83f48a06e6943366 (diff) | |
download | bitbake-contrib-f3322567378d6038a00da0fab6c5641a1a8e5409.tar.gz |
toaster: move CustomImageRecipe generation to API entry point
Use the CustomImageRecipe generate_recipe_file_contents to generate the
recipe that we build from. Move creation of the dummy layer and recipe
object to the point of recipe creation as we need these objects before
the build time. Also update the methods to add and remove packages to
account for the CustomImageRecipe inheriting from Recipe.
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Diffstat (limited to 'lib/toaster/bldcontrol/localhostbecontroller.py')
-rw-r--r-- | lib/toaster/bldcontrol/localhostbecontroller.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/lib/toaster/bldcontrol/localhostbecontroller.py b/lib/toaster/bldcontrol/localhostbecontroller.py index 2dd48d454..8acf01347 100644 --- a/lib/toaster/bldcontrol/localhostbecontroller.py +++ b/lib/toaster/bldcontrol/localhostbecontroller.py @@ -240,23 +240,22 @@ class LocalhostBEController(BuildEnvironmentController): conf.write('BBPATH .= ":${LAYERDIR}"\nBBFILES += "${LAYERDIR}/recipes/*.bb"\n') # create recipe - recipe = os.path.join(layerpath, "recipes", "%s.bb" % target.target) - with open(recipe, "w") as recipef: - recipef.write("require %s\n" % customrecipe.base_recipe.file_path) - packages = [pkg.name for pkg in customrecipe.packages.all()] - if packages: - recipef.write('IMAGE_INSTALL = "%s"\n' % ' '.join(packages)) + recipe_path = \ + os.path.join(layerpath, "recipes", "%s.bb" % target.target) + with open(recipe_path, "w") as recipef: + recipef.write(customrecipe.generate_recipe_file_contents()) + + # Update the layer and recipe objects + customrecipe.layer_version.dirpath = layerpath + customrecipe.layer_version.save() + + customrecipe.file_path = recipe_path + customrecipe.save() # create *Layer* objects needed for build machinery to work - layer = Layer.objects.get_or_create(name="Toaster Custom layer", - summary="Layer for custom recipes", - vcs_url="file://%s" % layerpath)[0] - breq = target.req - lver = Layer_Version.objects.get_or_create(project=breq.project, layer=layer, - dirpath=layerpath, build=breq.build)[0] - ProjectLayer.objects.get_or_create(project=breq.project, layercommit=lver, - optional=False) - BRLayer.objects.get_or_create(req=breq, name=layer.name, dirpath=layerpath, + BRLayer.objects.get_or_create(req=target.req, + name=layer.name, + dirpath=layerpath, giturl="file://%s" % layerpath) if os.path.isdir(layerpath): layerlist.append(layerpath) |