aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/autobuilder/buildsteps/CreateCurrentLink.py
blob: b421b91b7f4d3e8c51e1a6f9428b323ce08c609b (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 Dec 26, 2012

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

from buildbot.steps.shell import ShellCommand
from twisted.python import log

class CreateCurrentLink(ShellCommand):
    haltOnFailure = False
    flunkOnFailure = True
    name = "CreateCurrentLink"
    def __init__(self, factory, argdict=None, **kwargs):
        for k, v in argdict.iteritems():
            setattr(self, k, v)
        self.description = "Creating Current Link"
        # Timeout needs to be passed to LoggingBuildStep as a kwarg
        for k, v in argdict.iteritems():
            setattr(self, k, v)
        self.timeout = 100000
        self.workdir="build/build/tmp/deploy/"
        kwargs['timeout']=self.timeout
        kwargs['workdir']=self.workdir
        ShellCommand.__init__(self, **kwargs)

    def start(self):
        import os
        try:
            self.deploycheck = self.getProperty('custom_deploy_artifacts')
        except:
            self.deploycheck = "True"
        if str(os.environ.get('PUBLISH_BUILDS')) == "True" and str(self.deploycheck) == "True":
            DEST=self.getProperty('DEST')
            self.command = "rm -rf " + DEST + "/../CURRENT; ln -s "+ DEST + " " + DEST+"/../CURRENT"
        else:
            self.command = "echo 'We will not be Publishing this build either because PUBLISH_BUILDS is False or this is a non-publish build'"
        ShellCommand.start(self)

    def describe(self, done=False):
        description = ShellCommand.describe(self,done)
        return description