aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/autobuilder/buildsteps/ModBBLayersConf.py
blob: 5e9a7f22b65793942c676fe6d76c0f508c22b038 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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.cetola@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)