| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 cros_lib.OldRunCommand(cmd, cwd=cwd) | 146 cros_lib.OldRunCommand(cmd, cwd=cwd) |
| 147 | 147 |
| 148 | 148 |
| 149 def SetupBoard(buildroot, board='x86-generic'): | 149 def SetupBoard(buildroot, board='x86-generic'): |
| 150 """Wrapper around setup_board.""" | 150 """Wrapper around setup_board.""" |
| 151 cwd = os.path.join(buildroot, 'src', 'scripts') | 151 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 152 cros_lib.OldRunCommand( | 152 cros_lib.OldRunCommand( |
| 153 ['./setup_board', '--fast', '--default', '--board=%s' % board], cwd=cwd, | 153 ['./setup_board', '--fast', '--default', '--board=%s' % board], cwd=cwd, |
| 154 enter_chroot=True) | 154 enter_chroot=True) |
| 155 | 155 |
| 156 def Build(buildroot, emptytree, build_autotest=True, usepkg=True, | 156 |
| 157 extra_env=None): | 157 def Build(buildroot, emptytree, build_autotest=True, usepkg=True): |
| 158 """Wrapper around build_packages.""" | 158 """Wrapper around build_packages.""" |
| 159 cwd = os.path.join(buildroot, 'src', 'scripts') | 159 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 160 cmd = ['./build_packages'] | 160 cmd = ['./build_packages'] |
| 161 env = [] | |
| 162 if not build_autotest: cmd.append('--nowithautotest') | 161 if not build_autotest: cmd.append('--nowithautotest') |
| 163 if not usepkg: cmd.append('--nousepkg') | 162 if not usepkg: cmd.append('--nousepkg') |
| 164 if emptytree: | 163 if emptytree: |
| 165 env.append('EXTRA_BOARD_FLAGS=--emptytree') | 164 cmd = ['sh', '-c', 'EXTRA_BOARD_FLAGS=--emptytree %s' % ' '.join(cmd)] |
| 166 if extra_env: | |
| 167 env.extend(extra_env) | |
| 168 if env: | |
| 169 cmd = ['sh', '-c', '%s %s' % (' '.join(env), ' '.join(cmd))] | |
| 170 | 165 |
| 171 cros_lib.OldRunCommand(cmd, cwd=cwd, enter_chroot=True) | 166 cros_lib.OldRunCommand(cmd, cwd=cwd, enter_chroot=True) |
| 172 | 167 |
| 173 | 168 |
| 174 def BuildImage(buildroot): | 169 def BuildImage(buildroot): |
| 175 _WipeOldOutput(buildroot) | 170 _WipeOldOutput(buildroot) |
| 176 | 171 |
| 177 cwd = os.path.join(buildroot, 'src', 'scripts') | 172 cwd = os.path.join(buildroot, 'src', 'scripts') |
| 178 cros_lib.OldRunCommand(['./build_image', '--replace'], cwd=cwd, | 173 cros_lib.OldRunCommand(['./build_image', '--replace'], cwd=cwd, |
| 179 enter_chroot=True) | 174 enter_chroot=True) |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 444 |
| 450 archive_url = None | 445 archive_url = None |
| 451 key_re = re.compile('^%s=(.*)$' % _CROS_ARCHIVE_URL) | 446 key_re = re.compile('^%s=(.*)$' % _CROS_ARCHIVE_URL) |
| 452 for line in result.output.splitlines(): | 447 for line in result.output.splitlines(): |
| 453 line_match = key_re.match(line) | 448 line_match = key_re.match(line) |
| 454 if line_match: | 449 if line_match: |
| 455 archive_url = line_match.group(1) | 450 archive_url = line_match.group(1) |
| 456 | 451 |
| 457 assert archive_url, 'Archive Build Failed to Provide Archive URL' | 452 assert archive_url, 'Archive Build Failed to Provide Archive URL' |
| 458 return archive_url | 453 return archive_url |
| OLD | NEW |