aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/autobuilder/buildsteps/AddKernelProps.py
blob: 1ff96592a46d884ceaecd77723b572e92e19ee26 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
'''
Created on March 18, 2015

__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2015, Intel Corp."
__credits__ = ["Elizabeth Flanagan"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Elizabeth Flanagan"
__email__ = "pidge@toganlabs.com"
'''

from buildbot.steps.shell import ShellCommand
import os
from twisted.python import log
import ast, json

class AddKernelProps(ShellCommand):
    haltOnFailure = False
    flunkOnFailure = True
    name = "AutoConfKernOverR"
    def __init__(self, factory, argdict=None, **kwargs):
        self.machine=""
        self.distro="poky"
        self.kstring = "pn-linux-yocto"
        self.kwargs = kwargs
        for k, v in argdict.iteritems():
            if type(v) is bool:
                setattr(self, k, str(v))
            else:
                setattr(self, k, v)
        self.description = "Add Kernel Bits to Auto Configuration"
        ShellCommand.__init__(self, **kwargs)

    def start(self):
        self.distro = self.getProperty("DISTRO")
        self.machine = self.getProperty("MACHINE")
        kmeta = self.getProperty("custom_kmeta")
        kbranch = self.getProperty("custom_kbranch")
        srcrev_meta = self.getProperty("custom_srcrev_meta")
        srcrev_machine = self.getProperty("custom_srcrev_machine")
        srcuri_meta = self.getProperty("custom_srcuri_meta")
        srcuri_machine = self.getProperty("custom_srcuri_machine")
        fout = ""
        if self.distro == "poky-rt":
            self.kstring = "pn-linux-yocto-rt"
        if srcrev_machine != "" and str(srcrev_machine) != "None":
            fout += "SRCREV_machine_%s_%s = \"%s\"\n" % (self.machine, self.kstring, srcrev_machine)
        if srcrev_meta != "" and str(srcrev_meta) != "None":
            fout += "SRCREV_meta_%s_%s = \"%s\"\n" % (self.machine, self.kstring, srcrev_meta)
        if kmeta != "" and str(kmeta) != "None":
            fout += 'KMETA_%s_%s = \"%s\"\n' % (self.machine, self.kstring, kmeta)
        if srcuri_meta != "" and str(srcuri_meta) != "None":
            fout += "SRC_URI_%s_%s += \"%s;bareclone=1;branch=${KMETA};type=kmeta;name=meta\"\n" % (self.machine, self.kstring, srcuri_meta)
        if kbranch != "" and str(kbranch) != "None":
            fout += 'KBRANCH_%s_%s = \"%s\"\n' % (self.machine, self.kstring, kbranch)
        if srcuri_machine != "" and str(srcuri_machine) != "None":
            fout += "SRC_URI_%s_%s += \"%s;bareclone=1;branch=${KBRANCH};type=machine;name=machine\"\n" % (self.machine, self.kstring, srcuri_machine)
        self.command = ["sh", "-c", "printf '" + fout + "'>> ./build/conf/auto.conf"]
        ShellCommand.start(self)