Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: tools/export_tarball/export_tarball.py

Issue 1037753002: Add --progress option to export_tarball.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/export_tarball/export_tarball.py
diff --git a/tools/export_tarball/export_tarball.py b/tools/export_tarball/export_tarball.py
index 08a87560906fb8f4a3a1e0466bbdc770e08cdaaa..8d27f3fa33c951ce588ca8fa4555c06aed878a5c 100755
--- a/tools/export_tarball/export_tarball.py
+++ b/tools/export_tarball/export_tarball.py
@@ -134,6 +134,7 @@ def main(argv):
# TODO(phajdan.jr): Remove --xz option when it's not needed for compatibility.
parser.add_option("--xz", action="store_true")
parser.add_option("--verbose", action="store_true", default=False)
+ parser.add_option("--progress", action="store_true", default=False)
options, args = parser.parse_args(argv)
@@ -174,7 +175,19 @@ def main(argv):
finally:
archive.close()
- if subprocess.call(['xz', '-9', output_fullname]) != 0:
+ if options.progress:
+ sys.stdout.flush()
+ pv = subprocess.Popen(
+ ['pv', '--force', output_fullname],
+ stdout=subprocess.PIPE,
+ stderr=sys.stdout)
+ with open(output_fullname + '.xz', 'w') as f:
+ rc = subprocess.call(['xz', '-9', '-'], stdin=pv.stdout, stdout=f)
+ pv.wait()
+ else:
+ rc = subprocess.call(['xz', '-9', output_fullname])
+
+ if rc != 0:
print 'xz -9 failed!'
return 1
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698