From 5de6d2338dcb57df822d0038fe228bd4e300fcba Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 19 Sep 2024 15:53:06 -0400 Subject: [PATCH] Bump the wheel and sdist cache versions (#7560) ## Summary Both of these can contain rkyv data in their HTTP cache envelopes. As such, the entries aren't readable by earlier versions of uv, and `uv cache prune` can break. I should make `uv cache prune` robust to this, but this feels safest. --- crates/uv-cache/src/lib.rs | 7 ++++--- crates/uv/tests/cache_prune.rs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/uv-cache/src/lib.rs b/crates/uv-cache/src/lib.rs index 2cc4b744e..0f5c34eaa 100644 --- a/crates/uv-cache/src/lib.rs +++ b/crates/uv-cache/src/lib.rs @@ -759,15 +759,16 @@ pub enum CacheBucket { impl CacheBucket { fn to_str(self) -> &'static str { match self { - // Note, next time we change the version we should change the name of this bucket to `source-dists-v0` - Self::SourceDistributions => "built-wheels-v3", + Self::SourceDistributions => "sdists-v4", Self::FlatIndex => "flat-index-v0", Self::Git => "git-v0", Self::Interpreter => "interpreter-v2", // Note that when bumping this, you'll also need to bump it // in crates/uv/tests/cache_clean.rs. Self::Simple => "simple-v13", - Self::Wheels => "wheels-v1", + // Note that when bumping this, you'll also need to bump it + // in crates/uv/tests/cache_prune.rs. + Self::Wheels => "wheels-v2", Self::Archive => "archive-v0", Self::Builds => "builds-v0", Self::Environments => "environments-v1", diff --git a/crates/uv/tests/cache_prune.rs b/crates/uv/tests/cache_prune.rs index 3041cc55b..f7cffe0c1 100644 --- a/crates/uv/tests/cache_prune.rs +++ b/crates/uv/tests/cache_prune.rs @@ -142,7 +142,7 @@ fn prune_stale_symlink() -> Result<()> { .success(); // Remove the wheels directory, causing the symlink to become stale. - let wheels = context.cache_dir.child("wheels-v1"); + let wheels = context.cache_dir.child("wheels-v2"); fs_err::remove_dir_all(wheels)?; let filters: Vec<_> = context @@ -330,7 +330,7 @@ fn prune_stale_revision() -> Result<()> { ----- stderr ----- DEBUG uv [VERSION] ([COMMIT] DATE) Pruning cache at: [CACHE_DIR]/ - DEBUG Removing dangling source revision: [CACHE_DIR]/built-wheels-v3/[ENTRY] + DEBUG Removing dangling source revision: [CACHE_DIR]/sdists-v4/[ENTRY] DEBUG Removing dangling cache archive: [CACHE_DIR]/archive-v0/[ENTRY] Removed 8 files ([SIZE]) "###);