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
|
import os
from autobuilder.config import DAFT_WORKER_WORKSPACE
from buildbot.steps.shell import ShellCommand
class DaftFlash(ShellCommand):
haltOnFailure = True
name = "DaftFlash"
def __init__(self, factory, argdict=None, **kwargs):
self.tests = None
self.factory = factory
for k, v in argdict.iteritems():
setattr(self, k, v)
self.description = "DUT Flashing"
self.timeout = 100000
kwargs['timeout']=self.timeout
ShellCommand.__init__(self, **kwargs)
def start(self):
workspace_dir = DAFT_WORKER_WORKSPACE
dut_name = self.getProperty('dut_name')
workdir = self.getProperty('workdir')
image = self.getProperty('BuildImages')
machine = self.getProperty('MACHINE')
image_path = os.path.join(workdir, 'build', 'build', 'tmp', 'deploy',
'images', machine, '%s-%s.hddimg' % (image, machine))
image_name = os.path.basename(image_path)
# XXX: DAFT needs to have the image in a shared workspace
self.command = "cp %s %s; " % (image_path, workspace_dir)
self.command += "cd %s; " % (workspace_dir)
daft_cmd = "daft --setout %s %s" % (dut_name, image_name)
self.command += "cd {} && {} ".format(workspace_dir, daft_cmd)
ShellCommand.start(self)
|