cros_sdk: Add workspace support for CreateChroot.
Passes the workspace folder to CreateChroot() so that the workspace
group can be created and assigned properly in the chroot.
BUG=brillo:861
TEST=cbuildbot/run_tests
CQ-DEPEND=CL:269521
Change-Id: Ib1b2b6091c100b821596d734fda764d06b77d7f4
Reviewed-on: https://chromium-review.googlesource.com/269530
Reviewed-by: Nam Nguyen <namnguyen@chromium.org>
Tested-by: David Pursell <dpursell@chromium.org>
Commit-Queue: David Pursell <dpursell@chromium.org>
Trybot-Ready: David Pursell <dpursell@chromium.org>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index a472bfa..4a99774 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -141,7 +141,8 @@
return tarball_dest
-def CreateChroot(chroot_path, sdk_tarball, cache_dir, nousepkg=False):
+def CreateChroot(chroot_path, sdk_tarball, cache_dir, nousepkg=False,
+ workspace=None):
"""Creates a new chroot from a given SDK"""
cmd = MAKE_CHROOT + ['--stage3_path', sdk_tarball,
@@ -150,6 +151,9 @@
if nousepkg:
cmd.append('--nousepkg')
+ if workspace:
+ cmd.extend(['--workspace_root', workspace])
+
logging.notice('Creating chroot. This may take a few minutes...')
try:
cros_build_lib.RunCommand(cmd, print_cmd=False)
@@ -630,7 +634,8 @@
if options.create:
lock.write_lock()
CreateChroot(options.chroot, sdk_tarball, options.cache_dir,
- nousepkg=(options.bootstrap or options.nousepkg))
+ nousepkg=(options.bootstrap or options.nousepkg),
+ workspace=options.workspace)
if options.enter:
lock.read_lock()