From 680a6c37a0fbb29292576f142431f162cb3d814e Mon Sep 17 00:00:00 2001 From: John Chen Date: Thu, 4 Feb 2021 05:28:12 +0000 Subject: [PATCH] Improve upload_to_google_storage.py missing file handling When there are missing input files, upload_to_google_storage.py should not display 'Success'. Bug: 920654 Change-Id: I1bc7ba6e8eb48ea28b634da01e1be9a80af7b719 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2647870 Reviewed-by: Dirk Pranke Commit-Queue: John Chen --- upload_to_google_storage.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/upload_to_google_storage.py b/upload_to_google_storage.py index bf1c405433..332bb9a47b 100755 --- a/upload_to_google_storage.py +++ b/upload_to_google_storage.py @@ -167,9 +167,11 @@ def upload_to_google_storage( # We want to hash everything in a single thread since its faster. # The bottleneck is in disk IO, not CPU. hashing_start = time.time() + has_missing_files = False for filename in input_filenames: if not os.path.exists(filename): stdout_queue.put('Main> Error: %s not found, skipping.' % filename) + has_missing_files = True continue if os.path.exists('%s.sha1' % filename) and skip_hashing: stdout_queue.put( @@ -208,6 +210,9 @@ def upload_to_google_storage( max_ret_code = max(ret_code, max_ret_code) if message: print(message, file=sys.stderr) + if has_missing_files: + print('One or more input files missing', file=sys.stderr) + max_ret_code = max(1, max_ret_code) if not max_ret_code: print('Success!')