aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/autobuilder/buildsteps/UpdateBuildHistory.py
blob: 48c16fa23abf45b986311a70c15134ce8393f7b8 (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
'''
Created on Jan 12, 2015

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


from buildbot.steps.shell import ShellCommand
from buildbot.process.buildstep import LogLineObserver
from autobuilder.config import *
import os, ast

class UpdateBuildHistory(ShellCommand):
    haltOnFailure = False
    flunkOnFailure = False
    name = "Update Build History"
    def __init__(self, factory, argdict=None, **kwargs):
        self.machines=""
        self.factory = factory
        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):
        repo = self.getProperty("repo_poky")
        self.command = "echo 'Skipping Step.'"
        if os.environ.get('BUILD_HISTORY_WHITELIST') is not None:
            history_repos=ast.literal_eval(os.environ.get('BUILD_HISTORY_WHITELIST').encode('utf-8'))
            if history_repos is not None and repo in history_repos.keys():
                if self.getProperty("branch_poky") in history_repos[self.getProperty("repo_poky")] and \
                   os.environ.get("BUILD_HISTORY_COLLECT") == "True":
                    bhw_dir = os.environ.get("BUILD_HISTORY_WEB_DIR")
                    bh_dir = os.environ.get("BUILD_HISTORY_DIR")
                    pokydir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-worker"), self.getProperty("buildername")) + "/build"
                    cmd=""
                    for machine in self.machines:
                        cmd += os.path.join(bhw_dir + "/warningmgr/import.py") + " -m " + machine + " -b " + machine + " " + pokydir + " " + bh_dir + "/" + machine + "/poky-buildhistory;"
                    self.command=cmd
        ShellCommand.start(self)