diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-11-04 15:02:28 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-10 13:29:17 +0000 |
commit | 2cf55afb9714827401500c631d95d0fc3a10efdd (patch) | |
tree | 0bc5ea6ae3a357023011269bd1605eacb4bc7908 /bitbake/lib/toaster/bldcontrol | |
parent | c402ac2654cafb2c594c091a5a0a0f340af19a05 (diff) | |
download | poky-2cf55afb9714827401500c631d95d0fc3a10efdd.tar.gz |
bitbake: 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.
(Bitbake rev: f3322567378d6038a00da0fab6c5641a1a8e5409)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol')
-rw-r--r-- | bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py index 2dd48d454a..8acf013476 100644 --- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | |||
@@ -240,23 +240,22 @@ class LocalhostBEController(BuildEnvironmentController): | |||
240 | conf.write('BBPATH .= ":${LAYERDIR}"\nBBFILES += "${LAYERDIR}/recipes/*.bb"\n') | 240 | conf.write('BBPATH .= ":${LAYERDIR}"\nBBFILES += "${LAYERDIR}/recipes/*.bb"\n') |
241 | 241 | ||
242 | # create recipe | 242 | # create recipe |
243 | recipe = os.path.join(layerpath, "recipes", "%s.bb" % target.target) | 243 | recipe_path = \ |
244 | with open(recipe, "w") as recipef: | 244 | os.path.join(layerpath, "recipes", "%s.bb" % target.target) |
245 | recipef.write("require %s\n" % customrecipe.base_recipe.file_path) | 245 | with open(recipe_path, "w") as recipef: |
246 | packages = [pkg.name for pkg in customrecipe.packages.all()] | 246 | recipef.write(customrecipe.generate_recipe_file_contents()) |
247 | if packages: | 247 | |
248 | recipef.write('IMAGE_INSTALL = "%s"\n' % ' '.join(packages)) | 248 | # Update the layer and recipe objects |
249 | customrecipe.layer_version.dirpath = layerpath | ||
250 | customrecipe.layer_version.save() | ||
251 | |||
252 | customrecipe.file_path = recipe_path | ||
253 | customrecipe.save() | ||
249 | 254 | ||
250 | # create *Layer* objects needed for build machinery to work | 255 | # create *Layer* objects needed for build machinery to work |
251 | layer = Layer.objects.get_or_create(name="Toaster Custom layer", | 256 | BRLayer.objects.get_or_create(req=target.req, |
252 | summary="Layer for custom recipes", | 257 | name=layer.name, |
253 | vcs_url="file://%s" % layerpath)[0] | 258 | dirpath=layerpath, |
254 | breq = target.req | ||
255 | lver = Layer_Version.objects.get_or_create(project=breq.project, layer=layer, | ||
256 | dirpath=layerpath, build=breq.build)[0] | ||
257 | ProjectLayer.objects.get_or_create(project=breq.project, layercommit=lver, | ||
258 | optional=False) | ||
259 | BRLayer.objects.get_or_create(req=breq, name=layer.name, dirpath=layerpath, | ||
260 | giturl="file://%s" % layerpath) | 259 | giturl="file://%s" % layerpath) |
261 | if os.path.isdir(layerpath): | 260 | if os.path.isdir(layerpath): |
262 | layerlist.append(layerpath) | 261 | layerlist.append(layerpath) |