bitbake: toaster: localhostbecontroller accept custom init script for build

When passed variable CUSTOM_BUILD_INIT_SCRIPT to toaster
setting, it would be nice to use it. Else toaster
can use oe-init script. This gives an oppurtunity to
use customized build init scritps.

(Bitbake rev: 9d168bb5f05453bdb7156793eea25da0a3119b4d)

Signed-off-by: Sujith H <sujith.h@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Sujith H 2016-11-24 11:19:58 +00:00 committed by Richard Purdie
parent c57533b83b
commit 5f0405abed
1 changed files with 7 additions and 2 deletions

View File

@ -27,7 +27,7 @@ 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
from orm.models import CustomImageRecipe, Layer, Layer_Version, ProjectLayer, ToasterSetting
import subprocess
from toastermain import settings
@ -277,7 +277,12 @@ class LocalhostBEController(BuildEnvironmentController):
builddir = '%s-toaster-%d' % (self.be.builddir, bitbake.req.project.id)
oe_init = os.path.join(self.pokydirname, 'oe-init-build-env')
# init build environment
self._shellcmd("bash -c 'source %s %s'" % (oe_init, builddir),
try:
custom_script = ToasterSetting.objects.get(name="CUSTOM_BUILD_INIT_SCRIPT").value
custom_script = custom_script.replace("%BUILDDIR%" ,builddir)
self._shellcmd("bash -c 'source %s'" % (custom_script))
except ToasterSetting.DoesNotExist:
self._shellcmd("bash -c 'source %s %s'" % (oe_init, builddir),
self.be.sourcedir)
# update bblayers.conf