This is an automated email from the ASF dual-hosted git repository. akitouni pushed a commit to branch abderrahim/cargo-fixes in repository https://gitbox.apache.org/repos/asf/buildstream-plugins.git
commit 00d876f605d09e773470d350426b2ccf5aaef252 Author: Abderrahim Kitouni <[email protected]> AuthorDate: Mon Feb 7 10:13:26 2022 +0100 cargo: don't download crates at track time if the checksums are available in the lock file --- src/buildstream_plugins/sources/cargo.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/buildstream_plugins/sources/cargo.py b/src/buildstream_plugins/sources/cargo.py index f929f46..676a23d 100644 --- a/src/buildstream_plugins/sources/cargo.py +++ b/src/buildstream_plugins/sources/cargo.py @@ -408,13 +408,16 @@ class CargoSource(Source): for package in lock["package"]: if "source" not in package: continue - new_ref += [{"name": package["name"], "version": str(package["version"])}] + new_ref += [{"name": package["name"], "version": str(package["version"]), "sha": package.get("checksum")}] # Make sure the order we set it at track time is deterministic new_ref = sorted(new_ref, key=lambda c: (c["name"], c["version"])) # Download the crates and get their shas for crate_obj in new_ref: + if crate_obj["sha"] is not None: + continue + crate = Crate(self, crate_obj["name"], crate_obj["version"]) crate_url = crate._get_url()
