Specify full paths for scripts run inside the chroot.
Remove the assumption that the current directory is ~/trunk/src/scripts/
when the chroot is entered with cros_sdk.
BUG=chromium:429765
TEST=Ran build_chromeos.py, build_tc.py with the changes.
Change-Id: I9e54fda6b5f8ec8fe18b18cf67824c923a7e82e2
Reviewed-on: https://chrome-internal-review.googlesource.com/182270
Reviewed-by: Luis Lozano <llozano@chromium.org>
Commit-Queue: Rahul Chaudhry <rahulchaudhry@google.com>
Tested-by: Rahul Chaudhry <rahulchaudhry@google.com>
diff --git a/utils/command_executer.py b/utils/command_executer.py
index d4c329e..b9fe98a 100644
--- a/utils/command_executer.py
+++ b/utils/command_executer.py
@@ -1,7 +1,8 @@
#!/usr/bin/python
#
-# Copyright 2011 Google Inc. All Rights Reserved.
-#
+# Copyright 2011 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
import getpass
import os
@@ -243,12 +244,18 @@
prefix="in_chroot_cmd")
os.write(handle, "#!/bin/bash\n")
os.write(handle, command)
+ os.write(handle, "\n")
os.close(handle)
os.chmod(command_file, 0777)
- command = "cd %s; cros_sdk %s -- ./%s" % (chromeos_root, cros_sdk_options,
- os.path.basename(command_file))
+ # Run command_file inside the chroot, making sure that any "~" is expanded
+ # by the shell inside the chroot, not outside.
+ command = ("cd %s; cros_sdk %s -- bash -c '%s/%s'" %
+ (chromeos_root,
+ cros_sdk_options,
+ misc.CHROMEOS_SCRIPTS_DIR,
+ os.path.basename(command_file)))
ret = self.RunCommand(command, return_output,
command_terminator=command_terminator,
command_timeout=command_timeout,