crosutils: globally replace enter_chroot with cros_sdk

"cros_sdk" is a drop-in replacement of enter_chroot.sh. The only
important difference is in the calling path, specifically that
cros_sdk is in path but has to be called from $(pwd) being inside the
repo checkout, while enter_chroot.sh is called by explicit path.

Invariably, "./enter_chroot.sh" can be replaced, as pwd=src/scripts.
Calling by absolute path can be replaced by first changing directory
anywhere into the repo checkout, and then calling cros_sdk.

BUG=chromium-os:18750
TEST=run them

Change-Id: Ieff91a27bb419e1121361d5b3a11e4c87ff7a087
Reviewed-on: http://gerrit.chromium.org/gerrit/6273
Tested-by: Zdenek Behan <zbehan@chromium.org>
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
This commit is contained in:
Zdenek Behan 2011-08-13 00:47:38 +02:00
parent c316521760
commit 2811c16f55
4 changed files with 7 additions and 8 deletions

View File

@ -669,7 +669,7 @@ def main(argv):
# try to build it if we can # try to build it if we can
cros_env.Info('Creating test image') cros_env.Info('Creating test image')
test_output = cros_env.cmd.Output( test_output = cros_env.cmd.Output(
cros_env.CrosUtilsPath('enter_chroot.sh'), 'cros_sdk',
'--', './mod_image_for_test.sh', '--', './mod_image_for_test.sh',
'--board=%s' % options.board, '-y') '--board=%s' % options.board, '-y')
if not os.path.exists(image_file): if not os.path.exists(image_file):

View File

@ -268,8 +268,7 @@ function restart_in_chroot_if_needed {
if [ $INSIDE_CHROOT -ne 1 ]; then if [ $INSIDE_CHROOT -ne 1 ]; then
# Get inside_chroot path for script. # Get inside_chroot path for script.
local chroot_path="$(reinterpret_path_for_chroot "$0")" local chroot_path="$(reinterpret_path_for_chroot "$0")"
exec $SCRIPTS_DIR/enter_chroot.sh -- \ exec $GCLIENT_ROOT/chromite/bin/cros_sdk -- "$chroot_path" "$@"
"$chroot_path" "$@"
fi fi
} }
@ -278,7 +277,7 @@ function restart_in_chroot_if_needed {
function assert_inside_chroot { function assert_inside_chroot {
if [ $INSIDE_CHROOT -ne 1 ]; then if [ $INSIDE_CHROOT -ne 1 ]; then
echo "This script must be run inside the chroot. Run this first:" echo "This script must be run inside the chroot. Run this first:"
echo " $SCRIPTS_DIR/enter_chroot.sh" echo " cros_sdk"
exit 1 exit 1
fi fi
} }

View File

@ -76,7 +76,7 @@ def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None,
if combine_stdout_stderr: stderr = subprocess.STDOUT if combine_stdout_stderr: stderr = subprocess.STDOUT
if input: stdin = subprocess.PIPE if input: stdin = subprocess.PIPE
if enter_chroot: cmd = ['./enter_chroot.sh', '--'] + cmd if enter_chroot: cmd = ['cros_sdk', '--'] + cmd
# Print out the command before running. # Print out the command before running.
cmd_string = 'PROGRAM(%s) -> RunCommand: %r in dir %s' % (GetCallerName(), cmd_string = 'PROGRAM(%s) -> RunCommand: %r in dir %s' % (GetCallerName(),
@ -155,7 +155,7 @@ def RunCommandCaptureOutput(cmd, print_cmd=True, cwd=None, input=None,
if input: stdin = subprocess.PIPE if input: stdin = subprocess.PIPE
if combine_stdout_stderr: stderr = subprocess.STDOUT if combine_stdout_stderr: stderr = subprocess.STDOUT
if enter_chroot: cmd = ['./enter_chroot.sh', '--'] + cmd if enter_chroot: cmd = ['cros_sdk', '--'] + cmd
# Print out the command before running. # Print out the command before running.
if print_cmd: if print_cmd:

View File

@ -8,9 +8,9 @@ This script runs inside chroot environment. It signs and build factory packages.
Then serves them using devserver. All paths should be specified relative to the Then serves them using devserver. All paths should be specified relative to the
chroot environment. chroot environment.
E.g.: ./enter_chroot.sh -- serve_factory_packages.py --board <board> E.g.: cros_sdk -- serve_factory_packages.py --board <board>
Always precede the call to the script with './enter_chroot.sh -- ". Always precede the call to the script with 'cros_sdk -- ".
""" """
import gflags import gflags