OLD | NEW |
1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Module containing the various individual commands a builder can run.""" | 5 """Module containing the various individual commands a builder can run.""" |
6 | 6 |
7 import os | 7 import os |
8 import re | 8 import re |
9 import shutil | 9 import shutil |
10 import sys | 10 import sys |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 cros_lib.OldRunCommand(cmd, cwd=cwd) | 144 cros_lib.OldRunCommand(cmd, cwd=cwd) |
145 | 145 |
146 | 146 |
147 def SetupBoard(buildroot, board='x86-generic'): | 147 def SetupBoard(buildroot, board='x86-generic'): |
148 """Wrapper around setup_board.""" | 148 """Wrapper around setup_board.""" |
149 cwd = os.path.join(buildroot, 'src', 'scripts') | 149 cwd = os.path.join(buildroot, 'src', 'scripts') |
150 cros_lib.OldRunCommand( | 150 cros_lib.OldRunCommand( |
151 ['./setup_board', '--fast', '--default', '--board=%s' % board], cwd=cwd, | 151 ['./setup_board', '--fast', '--default', '--board=%s' % board], cwd=cwd, |
152 enter_chroot=True) | 152 enter_chroot=True) |
153 | 153 |
154 | 154 def Build(buildroot, emptytree, build_autotest=True, usepkg=True, |
155 def Build(buildroot, emptytree, build_autotest=True, usepkg=True): | 155 extra_env=None): |
156 """Wrapper around build_packages.""" | 156 """Wrapper around build_packages.""" |
157 cwd = os.path.join(buildroot, 'src', 'scripts') | 157 cwd = os.path.join(buildroot, 'src', 'scripts') |
158 cmd = ['./build_packages'] | 158 cmd = ['./build_packages'] |
| 159 env = [] |
159 if not build_autotest: cmd.append('--nowithautotest') | 160 if not build_autotest: cmd.append('--nowithautotest') |
160 if not usepkg: cmd.append('--nousepkg') | 161 if not usepkg: cmd.append('--nousepkg') |
161 if emptytree: | 162 if emptytree: |
162 cmd = ['sh', '-c', 'EXTRA_BOARD_FLAGS=--emptytree %s' % ' '.join(cmd)] | 163 env.append('EXTRA_BOARD_FLAGS=--emptytree') |
| 164 if extra_env: |
| 165 env.extend(extra_env) |
| 166 if env: |
| 167 cmd = ['sh', '-c', '%s %s' % (' '.join(env), ' '.join(cmd))] |
163 | 168 |
164 cros_lib.OldRunCommand(cmd, cwd=cwd, enter_chroot=True) | 169 cros_lib.OldRunCommand(cmd, cwd=cwd, enter_chroot=True) |
165 | 170 |
166 | 171 |
167 def BuildImage(buildroot): | 172 def BuildImage(buildroot): |
168 _WipeOldOutput(buildroot) | 173 _WipeOldOutput(buildroot) |
169 | 174 |
170 cwd = os.path.join(buildroot, 'src', 'scripts') | 175 cwd = os.path.join(buildroot, 'src', 'scripts') |
171 cros_lib.OldRunCommand(['./build_image', '--replace'], cwd=cwd, | 176 cros_lib.OldRunCommand(['./build_image', '--replace'], cwd=cwd, |
172 enter_chroot=True) | 177 enter_chroot=True) |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 447 |
443 archive_url = None | 448 archive_url = None |
444 key_re = re.compile('^%s=(.*)$' % _CROS_ARCHIVE_URL) | 449 key_re = re.compile('^%s=(.*)$' % _CROS_ARCHIVE_URL) |
445 for line in result.output.splitlines(): | 450 for line in result.output.splitlines(): |
446 line_match = key_re.match(line) | 451 line_match = key_re.match(line) |
447 if line_match: | 452 if line_match: |
448 archive_url = line_match.group(1) | 453 archive_url = line_match.group(1) |
449 | 454 |
450 assert archive_url, 'Archive Build Failed to Provide Archive URL' | 455 assert archive_url, 'Archive Build Failed to Provide Archive URL' |
451 return archive_url | 456 return archive_url |
OLD | NEW |