aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/autobuilder/buildsteps/CheckOutToasterLayers.py
blob: a45dd67c2ce1ee8abe76cc722cf34e6dbda4e42f (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
61
62
63
64
65
66
67
68
69
70
71
# This file is part of Buildbot.  Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members
#
#
'''
Created on Jun 15, 2015

__copyright__ = "Intel Corp."
__credits__ = ["Elizabeth Flanagan"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Elizabeth Flanagan"
__email__ = "pidge@toganlabs.com"
'''
from twisted.python import log
from twisted.internet import defer

import os, ast
from buildbot.steps.source.yoctogit import YoctoGit
from buildbot.steps.shell import ShellCommand
from buildbot import config
from buildbot.status import build
from buildbot.process import buildstep

class CheckOutToasterLayers(ShellCommand):
    def __init__(self, factory, argdict=None, **kwargs):
        self.workdir=""
        self.branch = ""
        self.commit = ""
        self.repourl = ""
        self.timeout = 100000
        self.description = "Git Checkout of Toaster Layers:"
        for k, v in argdict.iteritems():
            setattr(self, k, v)
        ShellCommand.__init__(self, **kwargs)

    def start(self):
        _layers = ast.literal_eval(self.getProperty('custom_layers'))
        fout=""
        for layer in _layers:
            layername=layer.iterkeys().next()
            repo=layer[layer.iterkeys().next()]['repourl']
            branch=layer[layer.iterkeys().next()]['branch']
            #commit=layer[layer.iterkeys().next()]['commit']
            storedir=None
            mirrordir=None
            method = 'clobber'
            mode='full'
            self.workdir=""
            self.description+="/n" + layername + "/n"
            if 'poky' in layername or 'oecore' in layername:
                workdir = 'build'
            else:
                workdir="build/" + layername
            log.msg(layer)
            fout += "mkdir -p "+ workdir +"; cd " + workdir + "; git clone " + repo + " .;git checkout" + branch +"; cd $BASEBUILDDIR;"
        self.command = ["sh", "-c", "BASEBUILDDIR=`pwd`; rm -rf build;" + fout]
        ShellCommand.start(self)