summaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/autobuilder/buildsteps/BuildImages.py
blob: da95a5699db3ace5a072006c979e75b379d58576 (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
'''
Created on Jan 6, 2013

__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2013, Intel Corp."
__credits__ = ["Elizabeth Flanagan"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Elizabeth Flanagan"
__email__ = "elizabeth.flanagan@intel.com"
'''


from buildbot.steps.shell import ShellCommand
from buildbot.process.buildstep import LogLineObserver
import os

class BuildImages(ShellCommand):
    haltOnFailure = False 
    flunkOnFailure = True 
    name = "Building Images" 
    def __init__(self, factory, argdict=None, **kwargs):
        self.images=""
        self._pendingLogObservers = []
        self.factory = factory
        counter = ErrorCounter()
        self.addLogObserver('stdio', counter)
        self.useProgress = True
        self.progressMetrics += ('errors',)
        for k, v in argdict.iteritems():
            setattr(self, k, v)
        self.description = "Building Images"
        self.timeout = 25000
        self.command = ". ./oe-init-build-env; bitbake " + self.images
        ShellCommand.__init__(self, **kwargs)

class ErrorCounter(LogLineObserver):
    numErrors = 0
    finished = False

    def outLineReceived(self, line):
        if self.finished:
            return
        if line.startswith("=" * 40):
            self.finished = True
            return
        if "NOTE: " in line and " Failed" in line:
            self.numErrors += 1
            self.step.setProgress('errors', self.numErrors)