Skip to content

Commit

Permalink
Fix fuchsia upload symbols. (flutter#47938)
Browse files Browse the repository at this point in the history
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: flutter/flutter#126461
Bug: flutter/flutter#135189

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
  • Loading branch information
godofredoc authored Nov 13, 2023
1 parent 11b80d6 commit 046ec85
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tools/fuchsia/upload_to_symbol_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
Expand Down

0 comments on commit 046ec85

Please sign in to comment.