Take a list of pairs of layer substitutions: (current, replacement)
and replace each entry's current layer with the replacement layer.
The replacement parameter may include #YPDIR which will be
substituted for the full path of the poky checkout.

[YOCTO #11745 ]

Signed-off-by: Stephano Cetola <stephano.cet...@linux.intel.com>
---
 .../autobuilder/buildsteps/ModBBLayersConf.py      | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 
lib/python2.7/site-packages/autobuilder/buildsteps/ModBBLayersConf.py

diff --git 
a/lib/python2.7/site-packages/autobuilder/buildsteps/ModBBLayersConf.py 
b/lib/python2.7/site-packages/autobuilder/buildsteps/ModBBLayersConf.py
new file mode 100644
index 000000000..5e9a7f22b
--- /dev/null
+++ b/lib/python2.7/site-packages/autobuilder/buildsteps/ModBBLayersConf.py
@@ -0,0 +1,40 @@
+'''
+Created on July 24, 2017
+
+__author__ = "Stephano Cetola"
+__copyright__ = "Copyright 2017, Intel Corp."
+__credits__ = ["Stephano Cetola"]
+__license__ = "GPL"
+__version__ = "2.0"
+__maintainer__ = "Stephano Cetola"
+__email__ = "stephano.cet...@linux.intel.com"
+'''
+
+from buildbot.steps.shell import ShellCommand
+from twisted.python import log
+import os
+
+class ModBBLayersConf(ShellCommand):
+    haltOnFailure = True
+    flunkOnFailure = True
+    name = "Modify BBLayers Configuration"
+    def __init__(self, factory, argdict=None, **kwargs):
+        self.factory = factory
+        for k, v in argdict.iteritems():
+            setattr(self, k, v)
+        self.description = "Modify BBLayers Configuration"
+        ShellCommand.__init__(self, **kwargs)
+
+    def start(self):
+        builddir = os.path.join(self.getProperty('builddir'), 'build')
+        bblayers = "%s/build/conf/bblayers.conf" % builddir
+        cmd = 'echo "Not configured"'
+        if self.sub:
+            cmd = ""
+            for mod in self.sub:
+                tgt, rep = mod
+                rep = rep.replace("#YPDIR", builddir)
+                cmd = cmd + "sed -i 's|.*%s .*|%s \\\\|' %s;" % (tgt, rep, 
bblayers)
+
+        self.command = cmd
+        ShellCommand.start(self)
-- 
2.13.3

-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to