OLD | NEW |
| (Empty) |
1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import datetime | |
6 import os | |
7 import sys | |
8 | |
9 from py.utils import shell_utils | |
10 from py.utils import ssh_utils | |
11 from flavor_utils.ssh_build_step_utils import SshBuildStepUtils | |
12 | |
13 class Arm64ModelBuildStepUtils(SshBuildStepUtils): | |
14 # make sure deps_target_os = 'barelinux' so that all dependencies | |
15 # can be installed. | |
16 def __init__(self, build_step_instance): | |
17 SshBuildStepUtils.__init__(self, build_step_instance) | |
18 | |
19 self._remote_dir = 'skia' | |
20 self._build_dir = os.path.join('out', 'config', 'arm64linux') | |
21 | |
22 self._working_dir = os.path.abspath(self._step.args.get( | |
23 'working_dir', os.path.join(os.pardir, os.pardir, 'arm64bareLinux'))) | |
24 | |
25 if type(build_step_instance).__name__ not in ['RunGYP', 'Compile']: | |
26 # SSH connection not needed and host may not exist yet in these steps. | |
27 key_file = os.path.join(self._working_dir, 'key') | |
28 assert os.path.isfile(key_file) | |
29 ssh_utils.SSHAdd(key_file) | |
30 print >> sys.stderr, 'Testing ssh connection...' | |
31 self._ssh.Run(['echo', 'SUCCESS FROM SSH']) | |
32 | |
33 old_timeout = self._step.timeout | |
34 self._step.timeout *= 10 | |
35 print 'Extended timeout from %s to %s.' % ( | |
36 datetime.timedelta(0, old_timeout), | |
37 datetime.timedelta(0, self._step.timeout)) | |
38 | |
39 def RunGYP(self): | |
40 # barelinux_make handles gyp | |
41 pass | |
42 | |
43 def Compile(self, target): | |
44 platform_bin = os.path.join('platform_tools', 'barelinux', 'bin') | |
45 # If working_dir doesn't exist, arm64_download will create it. | |
46 # this script should download everything we need to start the | |
47 # virtual machine, and then boot it up. If it fails it will | |
48 # return a non-zero exit status and shell_utils.run will throw an | |
49 # exception. We do not catch this exception. | |
50 print 'Installing build tools and VM to', self._working_dir | |
51 self.AddGsutilToPath() # needed by arm64_download | |
52 shell_utils.run( | |
53 [os.path.join(platform_bin, 'arm64_download'), self._working_dir]) | |
54 | |
55 assert os.path.isdir(self._working_dir) | |
56 | |
57 toolchain_bin = os.path.join( | |
58 self._working_dir, | |
59 'gcc-linaro-aarch64-linux-gnu-4.8-2013.12_linux', | |
60 'bin') | |
61 assert os.path.isdir(toolchain_bin) | |
62 | |
63 make_cmd = [ | |
64 'sh', '-x', | |
65 os.path.join(platform_bin, 'arm64_make'), | |
66 '-o', self._build_dir, | |
67 '-c', os.path.join(toolchain_bin, 'aarch64-linux-gnu-gcc'), | |
68 '-x', os.path.join(toolchain_bin, 'aarch64-linux-gnu-g++'), | |
69 '-t', self._step.configuration, | |
70 ] | |
71 shell_utils.run(make_cmd) | |
OLD | NEW |