Fix fuchsia upload symbols. (flutter/engine#47938)

The fuchsia bucket does not have a delete ACL which is required to replace files that already exist. This change skips uploading the file if it already exists.

Bug: https://github.com/flutter/flutter/issues/126461
Bug: https://github.com/flutter/flutter/issues/135189

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
godofredoc
2023-11-13 14:14:58 -08:00
committed by GitHub
parent 01c9e1ea99
commit 80f89004b9

View File

@@ -32,6 +32,19 @@ def remote_filename(exec_path):
return ''.join(parts[-2:])
def exists_remotely(remote_path):
gsutil = os.path.join(os.environ['DEPOT_TOOLS'], 'gsutil.py')
command = ['python3', gsutil, '--', 'stat', remote_path]
process = subprocess.Popen(
command, stderr=subprocess.PIPE, stdout=subprocess.PIPE
)
stdout, stderr = process.communicate()
return_code = process.wait()
if return_code == 0:
print('%s exists - skipping copy' % remote_path)
return return_code == 0
def process_symbols(should_upload, symbol_dir):
full_path = os.path.join(BUILD_ROOT_DIR, symbol_dir)
@@ -50,9 +63,9 @@ def process_symbols(should_upload, symbol_dir):
FUCHSIA_ARTIFACTS_BUCKET_NAME, FUCHSIA_ARTIFACTS_DEBUG_NAMESPACE,
remote_filename(file)
)
if should_upload:
if should_upload and not exists_remotely(remote_path):
gsutil = os.path.join(os.environ['DEPOT_TOOLS'], 'gsutil.py')
command = ['python3', gsutil, '--', 'cp', gsutil, file, remote_path]
command = ['python3', gsutil, '--', 'cp', file, remote_path]
subprocess.check_call(command)
else:
print(remote_path)