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 ab8f18a0e3356087cf3f47feedf32cdfa1d82178
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 3486502..1544960 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()

Reply via email to