From: Michael Wood <michael.g.wood@intel.com>
To: toaster@yoctoproject.org
Subject: [PATCH 03/21] toaster: create custom layer and recipes for Image customisation
Date: Fri, 25 Sep 2015 19:07:14 +0100 [thread overview]
Message-ID: <1443204452-32244-4-git-send-email-michael.g.wood@intel.com> (raw)
In-Reply-To: <1443204452-32244-1-git-send-email-michael.g.wood@intel.com>
From: Ed Bartosh <ed.bartosh@linux.intel.com>
When building customised recipes toaster creates custom layer directory
and puts layer.conf and custom recipes to it.
[YOCTO #8075]
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
.../toaster/bldcontrol/localhostbecontroller.py | 51 +++++++++++++++++++++-
1 file changed, 49 insertions(+), 2 deletions(-)
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
index a9909b8..62fff1d 100644
--- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
@@ -23,9 +23,11 @@
import os
import sys
import re
+import shutil
from django.db import transaction
from django.db.models import Q
from bldcontrol.models import BuildEnvironment, BRLayer, BRVariable, BRTarget, BRBitbake
+from orm.models import CustomImageRecipe, Layer, Layer_Version, ProjectLayer
import subprocess
from toastermain import settings
@@ -197,7 +199,7 @@ class LocalhostBEController(BuildEnvironmentController):
return local_checkout_path
- def setLayers(self, bitbakes, layers):
+ def setLayers(self, bitbakes, layers, targets):
""" a word of attention: by convention, the first layer for any build will be poky! """
assert self.be.sourcedir is not None
@@ -299,6 +301,51 @@ class LocalhostBEController(BuildEnvironmentController):
if not os.path.exists(bblayerconf):
raise BuildSetupException("BE is not consistent: bblayers.conf file missing at %s" % bblayerconf)
+ # 6. create custom layer and add custom recipes to it
+ layerpath = os.path.join(self.be.sourcedir, "_meta-toaster-custom")
+ if os.path.isdir(layerpath):
+ shutil.rmtree(layerpath) # remove leftovers from previous builds
+ for target in targets:
+ try:
+ customrecipe = CustomImageRecipe.objects.get(name=target.target,
+ project=bitbakes[0].req.project)
+ except CustomImageRecipe.DoesNotExist:
+ continue # not a custom recipe, skip
+
+ # create directory structure
+ for name in ("conf", "recipes"):
+ path = os.path.join(layerpath, name)
+ if not os.path.isdir(path):
+ os.makedirs(path)
+
+ # create layer.oonf
+ config = os.path.join(layerpath, "conf", "layer.conf")
+ if not os.path.isfile(config):
+ with open(config, "w") as conf:
+ 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.recipe.file_path)
+ packages = [pkg.name for pkg in customrecipe.packages.all()]
+ if packages:
+ recipef.write('IMAGE_INSTALL = "%s"\n' % ' '.join(packages))
+
+ # 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,
+ giturl="file://%s" % layerpath)
+ if os.path.isdir(layerpath):
+ layerlist.append(layerpath)
+
BuildEnvironmentController._updateBBLayers(bblayerconf, layerlist)
self.islayerset = True
@@ -316,7 +363,7 @@ class LocalhostBEController(BuildEnvironmentController):
def triggerBuild(self, bitbake, layers, variables, targets):
# set up the buid environment with the needed layers
- self.setLayers(bitbake, layers)
+ self.setLayers(bitbake, layers, targets)
self.writeConfFile("conf/toaster-pre.conf", variables)
self.writeConfFile("conf/toaster.conf", raw = "INHERIT+=\"toaster buildhistory\"")
--
2.1.4
next prev parent reply other threads:[~2015-09-25 18:07 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 18:07 [PATCH 00/21] michaelw/toaster/ic-5.0 Michael Wood
2015-09-25 18:07 ` [PATCH 01/21] toaster: make a workaround for old style index Michael Wood
2015-09-25 18:07 ` [PATCH 02/21] toaster: tables Move the title and name into the widget Michael Wood
2015-09-25 18:07 ` Michael Wood [this message]
2015-09-25 18:07 ` [PATCH 04/21] toaster: widgets ToasterTable add logger to notify when cache hit Michael Wood
2015-09-25 18:07 ` [PATCH 05/21] toaster: widgets ToasterTable Add more info to search field exception Michael Wood
2015-09-25 18:07 ` [PATCH 06/21] toaster: add nocache option to the ToasterTable widget Michael Wood
2015-09-25 18:07 ` [PATCH 07/21] toaster: ToasterTable remove unused class definition Michael Wood
2015-09-25 18:07 ` [PATCH 08/21] toaster: Add CustomImageRecipe model Michael Wood
2015-09-25 18:07 ` [PATCH 09/21] toaster: add toggle for enabling image customisation feeature Michael Wood
2015-09-25 18:07 ` [PATCH 10/21] toaster: implement decorator for REST responses Michael Wood
2015-09-25 18:07 ` [PATCH 11/21] toaster: Fix indentation of jsunittests view Michael Wood
2015-09-25 18:07 ` [PATCH 12/21] toaster: Add new ReST API for Image Customisation feature Michael Wood
2015-09-25 18:07 ` [PATCH 13/21] toaster: Add ToasterTables for Image customisation feature Michael Wood
2015-09-25 18:07 ` [PATCH 14/21] toaster: Add Image customisation frontend feature Michael Wood
2015-09-25 18:07 ` [PATCH 15/21] toaster: Add test cases for new Image customisation features Michael Wood
2015-09-25 18:07 ` [PATCH 16/21] toaster: Special case the openembedded-core layer to avoid duplicates Michael Wood
2015-09-25 18:07 ` [PATCH 17/21] toaster: Create a relationship between build information and toaster layers Michael Wood
2015-09-25 18:07 ` [PATCH 18/21] toaster: Prioroitise the layer more generic vcs reference over the sha Michael Wood
2015-09-25 18:07 ` [PATCH 19/21] toaster: tables show all recipes in the layerdetails even duplicates Michael Wood
2015-09-25 18:07 ` [PATCH 20/21] toaster: buildinfohelper Create a copy of the built layer and recipe Michael Wood
2015-09-25 18:07 ` [PATCH 21/21] Revert "bitbake: toaster: don't re-create Target objects" Michael Wood
2015-09-28 16:07 ` Additional patch Michael Wood
2015-09-28 16:07 ` [PATCH] toaster: orm remove the complicated querying on the ORM Michael Wood
2015-09-29 4:43 ` Additional patch Brian Avery
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443204452-32244-4-git-send-email-michael.g.wood@intel.com \
--to=michael.g.wood@intel.com \
--cc=toaster@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.