[Toaster] Review required to use custom script
Michael Wood
michael.g.wood at intel.com
Wed Nov 2 09:12:18 PDT 2016
Couple of comments below:
From b874cbeae00a4e0d34336d3857731c1233ac73d0 Mon Sep 17 00:00:00 2001
From: Sujith H <sujith.h at gmail.com>
Date: Fri, 28 Oct 2016 07:40:22 +0000
Subject: toaster: 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.
Signed-off-by: Sujith H <sujith.h at gmail.com>
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
index a64e89b..33717cd 100644
--- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
@@ -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,20 +277,23 @@ 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:
Please add the exception type in here. It'll be something like ToaserSettings.DoesNotExist see
https://docs.djangoproject.com/en/1.8/ref/models/instances/#django.db.models.Model.DoesNotExist
+ self._shellcmd("bash -c 'source %s %s'" % (oe_init, builddir),
self.be.sourcedir)
# update bblayers.conf
bblconfpath = os.path.join(builddir, "conf/bblayers.conf")
conflines = open(bblconfpath, "r").readlines()
- skip = False
+ if "# line added by toaster build control\n" in conflines:
+ conflines.pop()
This is something that needs to be a in separate patch as it's a different issue.
with open(bblconfpath, 'w') as bblayers:
for line in conflines:
if line.startswith("# line added by toaster"):
- skip = True
continue
- if skip:
- skip = False
else:
bblayers.write(line)
--
cgit v0.10.2
Thanks,
Michael
On 02/11/16 05:03, sujith h wrote:
> Hi,
>
> I have created a patch:
> http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=sujith/toaster-use-custom-build-scripts&id=b874cbeae00a4e0d34336d3857731c1233ac73d0
> to review the usage of custom init or setup script. This will help
> users to use their own script instead of poky's oe-init, if they wish.
> If CUSTOM_BUILD_INIT_SCRIPT variable is not available it will fall
> back to poky's oe-init. Kindly let me know if the patch is ok or not (
> basically feedback ), I can do the needful to get it better.
>
> Thanks,
> Sujith H
>
> --
> സുജിത് ഹരിദാസന്
> Bangalore
> <Project>Contributor to KDE project
> <Project>Contributor to Yocto project
> http://fci.wikia.com/wiki/Anti-DRM-Campaign
> <Blog> http://sujithh.info
> C-x C-c
>
>
More information about the toaster
mailing list