diff options
author | George Burgess IV <gbiv@google.com> | 2020-10-08 12:44:45 -0700 |
---|---|---|
committer | George Burgess <gbiv@chromium.org> | 2020-10-09 17:17:16 +0000 |
commit | 6868239551ebbefe0a87f0ff8565917c4f2859f5 (patch) | |
tree | e08cd1531d9836b2ba5a9284cc9540183befb11d /rust_tools/rust_uprev.py | |
parent | a874714a7352b770993f451b2ecb4e5d0ab58ac8 (diff) | |
download | toolchain-utils-6868239551ebbefe0a87f0ff8565917c4f2859f5.tar.gz |
rust_uprev: check for files in gs:// before downloading them
I had to `--reset` a few times; downloading these files just to not
upload them took a bit, and wasn't useful. This CL adds a check so we
don't do that in the future.
BUG=chromium:1136579, chromium:1112551
TEST=Ran the script
Change-Id: I03f9f21cc07a7b16b540a5be5b4b08e105fc81a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2462926
Reviewed-by: Tiancong Wang <tcwang@google.com>
Tested-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'rust_tools/rust_uprev.py')
-rwxr-xr-x | rust_tools/rust_uprev.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/rust_tools/rust_uprev.py b/rust_tools/rust_uprev.py index b4fcaf18..1d29556d 100755 --- a/rust_tools/rust_uprev.py +++ b/rust_tools/rust_uprev.py @@ -379,9 +379,20 @@ def update_virtual_rust(template_version: RustVersion, def upload_single_tarball(rust_url: str, tarfile_name: str, tempdir: str) -> None: rust_src = f'{rust_url}/{tarfile_name}' - logging.info('Downloading Rust artifact from %s', rust_src) gsutil_location = f'gs://chromeos-localmirror/distfiles/{tarfile_name}' + missing_file = subprocess.call( + ['gsutil', 'ls', gsutil_location], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) + if not missing_file: + logging.info('Rust artifact at %s already exists; skipping download', + gsutil_location) + return + + logging.info('Downloading Rust artifact from %s', rust_src) + # Download Rust's source rust_file = os.path.join(tempdir, tarfile_name) subprocess.check_call(['curl', '-f', '-o', rust_file, rust_src]) |