Skip to contentSkip to conversation

buildsteps: add bblayers modification step

PATCH New Stephano Cetola 1 participant 1 message Jul 31, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 buildsteps: add bblayers modification step

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 ]

---
 .../autobuilder/buildsteps/ModBBLayersConf.py      | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 lib/python2.7/site-packages/autobuilder/buildsteps/ModBBLayersConf.py
lib/python2.7/site-packages/autobuilder/buildsteps/ModBBLayersConf.py new file +40 -0
new file mode 100644
index 000000000..5e9a7f22b
@@ -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__ = "[email protected]"
+'''
+
+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)
Signature · 1 line
2.13.3