bitbake: toaster: bldcontrol Move CustomImageRecipe file creation into own function
Move the custom image file creation (i.e. create the layer file structure, conf and recipe file) into it's own function and remove the creation of the BRLayer as this is done at schedule_build just like all the other layers. Fix a bug where the toaster-custom-images layer was always being appened to the layer list if the directory exists. (Bitbake rev: 15a42b36c01fccd79e5aa0788dea5640b253982b) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
6f8df05e6e
commit
5de7f159a1
|
@ -201,22 +201,38 @@ class LocalhostBEController(BuildEnvironmentController):
|
|||
logger.debug("localhostbecontroller: current layer list %s " % pformat(layerlist))
|
||||
|
||||
# 5. create custom layer and add custom recipes to it
|
||||
layerpath = os.path.join(self.be.builddir,
|
||||
CustomImageRecipe.LAYER_NAME)
|
||||
for target in targets:
|
||||
try:
|
||||
customrecipe = CustomImageRecipe.objects.get(name=target.target,
|
||||
customrecipe = CustomImageRecipe.objects.get(
|
||||
name=target.target,
|
||||
project=bitbake.req.project)
|
||||
|
||||
custom_layer_path = self.setup_custom_image_recipe(
|
||||
customrecipe, layers)
|
||||
|
||||
if os.path.isdir(custom_layer_path):
|
||||
layerlist.append(custom_layer_path)
|
||||
|
||||
except CustomImageRecipe.DoesNotExist:
|
||||
continue # not a custom recipe, skip
|
||||
|
||||
layerlist.extend(nongitlayerlist)
|
||||
logger.debug("\n\nset layers gives this list \n %s" % ''.join(layerlist))
|
||||
self.islayerset = True
|
||||
return layerlist
|
||||
|
||||
def setup_custom_image_recipe(self, customrecipe, layers):
|
||||
""" Set up toaster-custom-images layer and recipe files """
|
||||
layerpath = os.path.join(self.be.builddir,
|
||||
CustomImageRecipe.LAYER_NAME)
|
||||
|
||||
# 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
|
||||
# create layer.conf
|
||||
config = os.path.join(layerpath, "conf", "layer.conf")
|
||||
if not os.path.isfile(config):
|
||||
with open(config, "w") as conf:
|
||||
|
@ -245,14 +261,13 @@ class LocalhostBEController(BuildEnvironmentController):
|
|||
layer_path,
|
||||
customrecipe.base_recipe.layer_version.dirpath)
|
||||
|
||||
customrecipe.base_recipe.layer_version.dirpath = \
|
||||
br_layer_base_dirpath
|
||||
customrecipe.base_recipe.layer_version.dirpath = br_layer_base_dirpath
|
||||
|
||||
customrecipe.base_recipe.layer_version.save()
|
||||
|
||||
# create recipe
|
||||
recipe_path = \
|
||||
os.path.join(layerpath, "recipes", "%s.bb" % target.target)
|
||||
recipe_path = os.path.join(layerpath, "recipes", "%s.bb" %
|
||||
customrecipe.name)
|
||||
with open(recipe_path, "w") as recipef:
|
||||
recipef.write(customrecipe.generate_recipe_file_contents())
|
||||
|
||||
|
@ -265,17 +280,8 @@ class LocalhostBEController(BuildEnvironmentController):
|
|||
customrecipe.file_path = recipe_path
|
||||
customrecipe.save()
|
||||
|
||||
# create *Layer* objects needed for build machinery to work
|
||||
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)
|
||||
return layerpath
|
||||
|
||||
self.islayerset = True
|
||||
layerlist.extend(nongitlayerlist)
|
||||
return layerlist
|
||||
|
||||
def readServerLogFile(self):
|
||||
return open(os.path.join(self.be.builddir, "toaster_server.log"), "r").read()
|
||||
|
|
Loading…
Reference in New Issue