Skip to contentSkip to conversation

toaster: Add support for custom script and use toaster-bblayers.conf

PATCH New Sujith H 1 participant 3 messages Nov 17, 2016

lore
Share & tools
lore

Sujith H

author
#0 lore raw

cover toaster: Add support for custom script and use toaster-bblayers.conf

The following changes since commit 6eec988c6a5f276a78b3c2de9aa231c8b0097d20:

toaster: layerindex updater Take into account layers being predefined (2016-11-09 18:26:41 -0800)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib sujith/toaster-use-custom-build-scriptsV2
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=sujith/toaster-use-custom-build-scriptsV2

Sujith H (2):
toaster: localhostbecontroller accept custom init script for build
toaster: localhostbecontroller write toaster layers for project to
toaster-bblayers.conf

 .../toaster/bldcontrol/localhostbecontroller.py    | 27 +++++++++-------------
 1 file changed, 11 insertions(+), 16 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/2 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/lib/toaster/bldcontrol/localhostbecontroller.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +7 -2
index e5f7c98..3896a82 100644
@@ -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
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 2/2 toaster: localhostbecontroller write toaster layers for project to toaster-bblayers.conf

Instead of updating conf/bblayers, here we update toaster-bblayers.conf file. So extra effort to update bblayers.conf can be removed safely.

---
 .../lib/toaster/bldcontrol/localhostbecontroller.py    | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +4 -14
index 3896a82..11335ac 100644
@@ -286,19 +286,8 @@ class LocalhostBEController(BuildEnvironmentController):
                        self.be.sourcedir)
 
         # update bblayers.conf
-        bblconfpath = os.path.join(builddir, "conf/bblayers.conf")
-        conflines = open(bblconfpath, "r").readlines()
-        skip = False
+        bblconfpath = os.path.join(builddir, "conf/toaster-bblayers.conf")
         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)
-
             bblayers.write('# line added by toaster build control\n'
                            'BBLAYERS = "%s"' % ' '.join(layers))
 
@@ -311,9 +300,10 @@ class LocalhostBEController(BuildEnvironmentController):
 
         # run bitbake server from the clone
         bitbake = os.path.join(self.pokydirname, 'bitbake', 'bin', 'bitbake')
-        self._shellcmd('bash -c \"source %s %s; BITBAKE_UI="knotty" %s --read %s '
+        toasterlayers = os.path.join(builddir,"conf/toaster-bblayers.conf")
+        self._shellcmd('bash -c \"source %s %s; BITBAKE_UI="knotty" %s --read %s --read %s '
                        '--server-only -t xmlrpc -B 0.0.0.0:0\"' % (oe_init,
-                       builddir, bitbake, confpath), self.be.sourcedir)
+                       builddir, bitbake, confpath, toasterlayers), self.be.sourcedir)
 
         # read port number from bitbake.lock
         self.be.bbport = ""
Signature · 1 line
1.9.1