mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Avoid generating unused hashes during uv lock
(#10307)
## Summary We don't even use these! See the comment inline. Closes https://github.com/astral-sh/uv/issues/9651.
This commit is contained in:
parent
bbf9558b16
commit
7182a34aa4
8 changed files with 64 additions and 39 deletions
|
@ -405,22 +405,28 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
|
|||
return Ok(ArchiveMetadata::from_metadata23(metadata.clone()));
|
||||
}
|
||||
|
||||
// If hash generation is enabled, and the distribution isn't hosted on an index, get the
|
||||
// If hash generation is enabled, and the distribution isn't hosted on a registry, get the
|
||||
// entire wheel to ensure that the hashes are included in the response. If the distribution
|
||||
// is hosted on an index, the hashes will be included in the simple metadata response.
|
||||
// For hash _validation_, callers are expected to enforce the policy when retrieving the
|
||||
// wheel.
|
||||
//
|
||||
// Historically, for `uv pip compile --universal`, we also generate hashes for
|
||||
// registry-based distributions when the relevant registry doesn't provide them. This was
|
||||
// motivated by `--find-links`. We continue that behavior (under `HashGeneration::All`) for
|
||||
// backwards compatibility, but it's a little dubious, since we're only hashing _one_
|
||||
// distribution here (as opposed to hashing all distributions for the version), and it may
|
||||
// not even be a compatible distribution!
|
||||
//
|
||||
// TODO(charlie): Request the hashes via a separate method, to reduce the coupling in this API.
|
||||
if hashes.is_generate() {
|
||||
if dist.file().map_or(true, |file| file.hashes.is_empty()) {
|
||||
let wheel = self.get_wheel(dist, hashes).await?;
|
||||
let metadata = wheel.metadata()?;
|
||||
let hashes = wheel.hashes;
|
||||
return Ok(ArchiveMetadata {
|
||||
metadata: Metadata::from_metadata23(metadata),
|
||||
hashes,
|
||||
});
|
||||
}
|
||||
if hashes.is_generate(dist) {
|
||||
let wheel = self.get_wheel(dist, hashes).await?;
|
||||
let metadata = wheel.metadata()?;
|
||||
let hashes = wheel.hashes;
|
||||
return Ok(ArchiveMetadata {
|
||||
metadata: Metadata::from_metadata23(metadata),
|
||||
hashes,
|
||||
});
|
||||
}
|
||||
|
||||
let result = self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue