in src/buildstream_plugins/sources/cargo.py [0:0]
def fetch(self, alias_override=None, **kwargs):
# Just a defensive check, it is impossible for the
# file to be already cached because Source.fetch() will
# not be called if the source is already cached.
#
if os.path.isfile(self._get_mirror_file()):
return # pragma: nocover
# Download the crate
crate_url = self._get_url(alias_override)
with self.cargo.timed_activity("Downloading: {}".format(crate_url), silent_nested=True):
sha256 = self._download(crate_url)
if self.sha is not None and sha256 != self.sha:
raise SourceError(
"File downloaded from {} has sha256sum '{}', not '{}'!".format(crate_url, sha256, self.sha)
)