Commit 680a6c37 authored by John Chen's avatar John Chen Committed by LUCI CQ

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/+/2647870Reviewed-by: 's avatarDirk Pranke <dpranke@google.com>
Commit-Queue: John Chen <johnchen@chromium.org>
parent 6dc9cc30
......@@ -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!')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment