Skip to content

Commit

Permalink
feat: add option and env variable to disable zstd and bz2 (prefix-dev…
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbe7a authored Nov 28, 2023
1 parent e685d71 commit b1d7e17
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 30 deletions.
30 changes: 10 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ pre-build = [
]

[patch.crates-io]
# rattler = { git = "https://github.com/mamba-org/rattler", branch = "main" }
# rattler_conda_types = { git = "https://github.com/mamba-org/rattler", branch = "main" }
# rattler_digest = { git = "https://github.com/mamba-org/rattler", branch = "main" }
# rattler_networking = { git = "https://github.com/mamba-org/rattler", branch = "main" }
# rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", branch = "main" }
# rattler_shell = { git = "https://github.com/mamba-org/rattler", branch = "main" }
# rattler_solve = { git = "https://github.com/mamba-org/rattler", branch = "main" }
# rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", branch = "main" }
# rattler_package_streaming = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_conda_types = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_digest = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_networking = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_shell = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_solve = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", branch = "main" }
rattler_package_streaming = { git = "https://github.com/mamba-org/rattler", branch = "main" }

# rattler = { path = "../rattler/crates/rattler" }
# rattler_conda_types = { path = "../rattler/crates/rattler_conda_types" }
Expand Down
12 changes: 12 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ struct CommonOpts {
/// Output directory for build artifacts. Defaults to `./output`.
#[clap(long, env = "CONDA_BLD_PATH")]
output_dir: Option<PathBuf>,

/// Enable support for repodata.json.zst
#[clap(long, env = "RATTLER_ZSTD", default_value = "true", hide = true)]
use_zstd: bool,

/// Enable support for repodata.json.bz2
#[clap(long, env = "RATTLER_BZ2", default_value = "true", hide = true)]
use_bz2: bool,
}

#[derive(Parser)]
Expand Down Expand Up @@ -286,6 +294,8 @@ async fn run_build_from_args(args: BuildOpts, multi_progress: MultiProgress) ->
multi_progress_indicator: multi_progress,
no_clean: args.keep_build,
no_test: args.no_test,
use_zstd: args.common.use_zstd,
use_bz2: args.common.use_bz2,
};

let mut subpackages = BTreeMap::new();
Expand Down Expand Up @@ -412,6 +422,8 @@ async fn rebuild_from_args(args: RebuildOpts) -> miette::Result<()> {
multi_progress_indicator: MultiProgress::new(),
no_clean: true,
no_test: args.no_test,
use_zstd: args.common.use_zstd,
use_bz2: args.common.use_bz2,
};

output
Expand Down
2 changes: 1 addition & 1 deletion src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ pub async fn run_test(package_file: &Path, config: &TestConfiguration) -> Result
client: AuthenticatedClient::default(),
multi_progress_indicator: MultiProgress::new(),
no_clean: config.keep_test_prefix,
no_test: false,
..Default::default()
};

tracing::info!("Creating test environment in {:?}", prefix);
Expand Down
8 changes: 8 additions & 0 deletions src/tool_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ pub struct Configuration {

/// Whether to skip the test phase
pub no_test: bool,

/// Whether to use zstd
pub use_zstd: bool,

/// Whether to use bzip2
pub use_bz2: bool,
}

impl Default for Configuration {
Expand All @@ -37,6 +43,8 @@ impl Default for Configuration {
),
no_clean: false,
no_test: false,
use_zstd: true,
use_bz2: true,
}
}
}

0 comments on commit b1d7e17

Please sign in to comment.