Index: scripts/slave/recipe_modules/zip/resources/unzip.py |
diff --git a/scripts/slave/recipe_modules/zip/resources/unzip.py b/scripts/slave/recipe_modules/zip/resources/unzip.py |
index 0d1ae391f205cb6e8b1355df4c59e128f26d968a..da37e63e9f56287a2b8652f1f7db9379757b6627 100644 |
--- a/scripts/slave/recipe_modules/zip/resources/unzip.py |
+++ b/scripts/slave/recipe_modules/zip/resources/unzip.py |
@@ -14,7 +14,7 @@ import sys |
import zipfile |
-def unzip_with_subprocess(zip_file, output): |
+def unzip_with_subprocess(zip_file, output, quiet): |
"""Unzips an archive using 'zip' utility. |
Works only on Linux and Mac, uses system 'zip' program. |
@@ -22,12 +22,19 @@ def unzip_with_subprocess(zip_file, output): |
Args: |
zip_file: absolute path to an archive to unzip. |
output: existing directory to unzip to. |
+ quiet (bool): If True, instruct the subprocess to unzip with |
+ minimal output. |
Returns: |
Exit code (0 on success). |
""" |
+ args = ['unzip'] |
+ if quiet: |
+ args += ['-q'] |
+ args += [zip_file] |
+ |
return subprocess.call( |
- args=['unzip', zip_file], |
+ args=args, |
cwd=output) |
@@ -55,6 +62,7 @@ def main(): |
data = json.load(sys.stdin) |
output = data['output'] |
zip_file = data['zip_file'] |
+ quiet = data['quiet'] |
# Archive path should exist and be an absolute path to a file. |
assert os.path.exists(zip_file), zip_file |
@@ -73,7 +81,7 @@ def main(): |
exit_code = unzip_with_python(zip_file, output) |
else: |
# On mac and linux 'unzip' utility handles symlink and file modes. |
- exit_code = unzip_with_subprocess(zip_file, output) |
+ exit_code = unzip_with_subprocess(zip_file, output, quiet) |
finally: |
# On non-zero exit code or on unexpected exception, clean up. |
if exit_code: |