[bitbake-devel] [PATCH 2/5] toaster: write pre-read conf file for build variables

Alex DAMIAN alexandru.damian at intel.com
Thu Jan 8 13:15:11 UTC 2015


From: Alexandru DAMIAN <alexandru.damian at intel.com>

We change the setting of variables from directly injection
into the set-up cooker to writing a conf file that is pre-read
on bitbake server startup. This is needed because the injection
can only happen after the variable set is parsed, and the variables
already inferred, so setting up variables happens too late.

[YOCTO #7045]

Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
---
 bin/toaster                                             | 6 +++++-
 lib/toaster/bldcontrol/bbcontroller.py                  | 5 +++++
 lib/toaster/bldcontrol/management/commands/runbuilds.py | 5 +----
 lib/toaster/orm/models.py                               | 1 +
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/bin/toaster b/bin/toaster
index 7511012..6969bf7 100755
--- a/bin/toaster
+++ b/bin/toaster
@@ -251,7 +251,11 @@ case $CMD in
             return 4
         fi
         unset BBSERVER
-        bitbake --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0
+        PREREAD=""
+        if [ -e conf/toaster-pre.conf ]; then
+                PREREAD="--read conf/toaster-pre.conf"
+        fi
+        bitbake $PREREAD --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0
         if [ $? -ne 0 ]; then
             start_success=0
             echo "Bitbake server start failed"
diff --git a/lib/toaster/bldcontrol/bbcontroller.py b/lib/toaster/bldcontrol/bbcontroller.py
index 7c27fe1..102606e 100644
--- a/lib/toaster/bldcontrol/bbcontroller.py
+++ b/lib/toaster/bldcontrol/bbcontroller.py
@@ -135,6 +135,11 @@ class BuildEnvironmentController(object):
         bblayerconffile.write("# line added by toaster build control\nBBLAYERS = \"" + " ".join(layerlist) + "\"")
         bblayerconffile.close()
 
+    def writePreConfFile(self, variable_list):
+        prefilepath = os.path.join(self.be.builddir, "conf/toaster-pre.conf")
+        with open(prefilepath, "w") as prefile:
+            for i in variable_list:
+                prefile.write("%s=\"%s\"\n" % (i.name, i.value))
 
 
     def startBBServer(self, brbe):
diff --git a/lib/toaster/bldcontrol/management/commands/runbuilds.py b/lib/toaster/bldcontrol/management/commands/runbuilds.py
index 56c989c..bdce6ee 100644
--- a/lib/toaster/bldcontrol/management/commands/runbuilds.py
+++ b/lib/toaster/bldcontrol/management/commands/runbuilds.py
@@ -53,14 +53,11 @@ class Command(NoArgsCommand):
 
             # set up the buid environment with the needed layers
             bec.setLayers(br.brbitbake_set.all(), br.brlayer_set.all())
+            bec.writePreConfFile(br.brvariable_set.all())
 
             # get the bb server running with the build req id and build env id
             bbctrl = bec.getBBController("%d:%d" % (br.pk, bec.be.pk))
 
-            # set the build configuration
-            for variable in br.brvariable_set.all():
-                bbctrl.setVariable(variable.name, variable.value)
-
             # trigger the build command
             task = reduce(lambda x, y: x if len(y)== 0 else y, map(lambda y: y.task, br.brtarget_set.all()))
             if len(task) == 0:
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 46b704c..6fbbeed 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -529,6 +529,7 @@ class Recipe_Dependency(models.Model):
 
 
 class Machine(models.Model):
+    search_allowed_fields = ["name", "description"]
     layer_source = models.ForeignKey('LayerSource', default = None, null = True)  # from where did we get this machine
     up_id = models.IntegerField(null = True, default = None)                      # id of entry in the source
     up_date = models.DateTimeField(null = True, default = None)
-- 
1.9.1




More information about the bitbake-devel mailing list