Skip to content

Commit

Permalink
add options to disable zstd and bz2 (conda#420)
Browse files Browse the repository at this point in the history
We want to try `rattler` and `rattler-build` within the client
infrastructure. This client uses JFrog Artifactory to proxy conda
repositories. The deployed version has a bug where the
`repodata.json.zst` is cached indefinitely. An option to disable support
for bz2 and zstd would allow us to use rattler with this version.
  • Loading branch information
0xbe7a committed Nov 27, 2023
1 parent 9311ebc commit 9a3f2cc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

#### Added

* Options to disable `bz2` and `zstd` in `fetch_repo_data`

## [0.13.0] - 2023-11-27

### 📃 Details
Expand Down
16 changes: 12 additions & 4 deletions crates/rattler_repodata_gateway/src/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ pub struct FetchRepoDataOptions {

/// When enabled repodata can be fetched incrementally using JLAP
pub jlap_enabled: bool,

/// When enabled, the zstd variant will be used if available
pub zstd_enabled: bool,

/// When enabled, the bz2 variant will be used if available
pub bz2_enabled: bool,
}

impl Default for FetchRepoDataOptions {
Expand All @@ -170,6 +176,8 @@ impl Default for FetchRepoDataOptions {
cache_action: Default::default(),
variant: Variant::default(),
jlap_enabled: true,
zstd_enabled: true,
bz2_enabled: true,
}
}
}
Expand Down Expand Up @@ -400,13 +408,13 @@ pub async fn fetch_repo_data(

// Now that the caches have been refreshed determine whether or not we can use one of the
// variants. We don't check the expiration here since we just refreshed it.
let has_zst = variant_availability.has_zst();
let has_bz2 = variant_availability.has_bz2();
let has_jlap = variant_availability.has_jlap();
let has_zst = options.zstd_enabled && variant_availability.has_zst();
let has_bz2 = options.bz2_enabled && variant_availability.has_bz2();
let has_jlap = options.jlap_enabled && variant_availability.has_jlap();

// We first attempt to make a JLAP request; if it fails for any reason, we continue on with
// a normal request.
let jlap_state = if has_jlap && cache_state.is_some() && options.jlap_enabled {
let jlap_state = if has_jlap && cache_state.is_some() {
let repo_data_state = cache_state.as_ref().unwrap();
match jlap::patch_repo_data(
&client,
Expand Down

0 comments on commit 9a3f2cc

Please sign in to comment.