cros_chroot: Make chroot creating/destruction less verbose
Allow for the creation and the destruction of the chroot to be less
noisy.
Also, speed up entering the chroot when brillo/cros chroot is called.
BUG=brillo:710
TEST=unittests + manual tests
Change-Id: I9413d192b22eeb64fe2f4b912f869e92f170a8ce
Reviewed-on: https://chromium-review.googlesource.com/263742
Reviewed-by: Ralph Nathan <ralphnathan@chromium.org>
Tested-by: Ralph Nathan <ralphnathan@chromium.org>
Commit-Queue: Ralph Nathan <ralphnathan@chromium.org>
Trybot-Ready: Ralph Nathan <ralphnathan@chromium.org>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index eeb1647..a472bfa 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -84,6 +84,7 @@
# fail if asked to resume a complete file.
# pylint: disable=C0301,W0631
# https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3482927&group_id=976
+ logging.notice('Downloading chroot files.')
for url in urls:
# http://www.logilab.org/ticket/8766
# pylint: disable=E1101
@@ -94,7 +95,7 @@
return parsed.path
continue
content_length = 0
- print('Attempting download: %s' % url)
+ logging.debug('Attempting download from %s', url)
result = retry_util.RunCurl(
['-I', url], redirect_stdout=True, redirect_stderr=True,
print_cmd=False)
@@ -134,7 +135,7 @@
if filename == tarball_name or filename.startswith(ignored_prefix):
continue
- print('Cleaning up old tarball: %s' % (filename,))
+ logging.info('Cleaning up old tarball: %s' % (filename,))
osutils.SafeUnlink(os.path.join(storage_dir, filename))
return tarball_dest
@@ -149,6 +150,7 @@
if nousepkg:
cmd.append('--nousepkg')
+ logging.notice('Creating chroot. This may take a few minutes...')
try:
cros_build_lib.RunCommand(cmd, print_cmd=False)
except cros_build_lib.RunCommandError:
@@ -160,6 +162,7 @@
cmd = MAKE_CHROOT + ['--chroot', chroot_path,
'--delete']
try:
+ logging.notice('Deleting chroot.')
cros_build_lib.RunCommand(cmd, print_cmd=False)
except cros_build_lib.RunCommandError:
raise SystemExit('Running %r failed!' % cmd)