aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/autobuilder/buildsteps/CheckYoctoCompat.py
blob: 0eca528742c5807c0760e6f8a1f7e09244c27b1e (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
'''
Created on Sep 07, 2017

__author__ = "Joshua Lock"
__copyright__ = "Copyright 2017, Intel Corp."
__credits__ = ["Joshua Lock"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Joshua Lock"
__email__ = "joshua.g.lock@intel.com"
'''


from buildbot.steps.shell import ShellCommand
from autobuilder.config import *
import os

from lib.buildsteps import BitbakeShellCommand


class CheckYoctoCompat(BitbakeShellCommand):
    haltOnFailure = False
    flunkOnFailure = True
    name = "CheckYoctoCompat"

    def __init__(self, factory, argdict=None, **kwargs):
        self._pendingLogObservers = []
        self.layers = []
        for k, v in argdict.iteritems():
            setattr(self, k, v)
        # Timeout needs to be passed to LoggingBuildStep as a kwarg
        self.timeout = 100000
        kwargs['timeout'] = self.timeout
        ShellCommand.__init__(self, **kwargs)

    def start(self):
        if not self.layers:
            self.layers = self.getProperty("cloned_layers", "").split()

        builddir = os.path.join(self.getProperty("builddir"), "build")

        layerversioncore = int(self.getProperty("layerversion_core", "0"))
        # yocto-check-layer-wrapper was introduced with Rocko
        if layerversioncore >= 11:
            command = ". ./oe-init-build-env;"
            for layer in self.layers:
                layerpath = os.path.join(builddir, layer)
                cmd = "yocto-check-layer-wrapper {}".format(layerpath)
                cmd = cmd + " || export CL_FAIL=1;"
                command = command + cmd
            command = command + 'if [ "$CL_FAIL" = "1" ]; then exit 1; fi;'
            self.command = command
        else:
            self.skipStep('Skipping step for older versions.')

        ShellCommand.start(self)