aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/autobuilder/buildsteps/CreateWicImages.py
blob: af65f87b4575e7b8298de15f1e268a010b58ecdd (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
'''
__author__ = "Daniel Istrate"
__copyright__ = "Copyright 2015 Intel Corporation"
__credits__ = ["Daniel Istrate"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Daniel Istrate"
__email__ = "daniel.alexandrux.istrate@intel.com"
'''


from buildbot.steps.shell import ShellCommand
import os
from buildbot.status.results import SUCCESS
from lib.buildsteps import BitbakeShellCommand

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

    def __init__(self, factory, argdict=None, **kwargs):
        self.factory = factory
        self.workerdir = os.getenv('WORKERBASEDIR')
        self.command = ''
        self.machine = None
        self.wic_img_type = None
        self.target_img = None
        self.wic_dir = None

        for k, v in argdict.iteritems():
                setattr(self, k, v)
        self.timeout = 100000
        kwargs['timeout']=self.timeout

        BitbakeShellCommand.__init__(self, factory, argdict, **kwargs)

    def start(self):
        # Get Machine
        self.machine = self.getProperty("MACHINE")
        self.description = ['Create wic image: %s for %s (%s)' % (self.wic_img_type, self.target_img, self.machine)]
        # Check to see if we an build with directdisk-gpt
        self.layerversion_core = int(self.getProperty("layerversion_core", "0"))
        if self.layerversion_core < 6 \
           and 'directdisk-gpt' in self.wic_img_type:
            self.skipStep("Skipping directdisk-gpt Build")
        else:
            # Set the wic build directory
            buildername = self.getProperty("buildername")
            self.wic_dir = os.path.join(os.path.join(self.workerdir, buildername), 'build/build/tmp/deploy/wic_images/')
            self.wic_dir += '%s/%s/%s/' % (self.machine, self.wic_img_type, self.target_img)

            # Create wic image 'wic_img_type'
            self.command += '. ./oe-init-build-env && '
            self.command += 'wic create %s -e %s -o %s ' % (self.wic_img_type, self.target_img, self.wic_dir)

        BitbakeShellCommand.start(self)