-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use new gateway to get the repodata for global install #1767
feat: use new gateway to get the repodata for global install #1767
Conversation
crates/pixi_config/src/lib.rs
Outdated
@@ -446,6 +447,12 @@ impl From<ConfigCliPrompt> for Config { | |||
} | |||
} | |||
|
|||
impl From<Config> for rattler_repodata_gateway::ChannelConfig { | |||
fn from(val: Config) -> Self { | |||
from_pixi_config(&val) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like from_pixi_config
but I decided to use something more rusty for this
crates/pixi_config/src/gateway.rs
Outdated
@@ -19,3 +22,19 @@ pub fn from_pixi_config(config: &Config) -> ChannelConfig { | |||
per_channel: Default::default(), | |||
} | |||
} | |||
|
|||
/// Constructs a [`Gateway`] from a [`ClientWithMiddleware`] and a [`Config`] | |||
pub fn new_gateway(client: ClientWithMiddleware, config: Config) -> Gateway { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a gateway per project, I thought it would be nice to have an API for some more global gateway
crates/pixi_config/src/lib.rs
Outdated
#[cfg(feature = "rattler_repodata_gateway")] | ||
impl From<Config> for rattler_repodata_gateway::ChannelConfig { | ||
fn from(config: Config) -> Self { | ||
let default_source_config = config | ||
.repodata_config | ||
.as_ref() | ||
.map(|config| SourceConfig { | ||
jlap_enabled: !config.disable_jlap.unwrap_or(false), | ||
zstd_enabled: !config.disable_zstd.unwrap_or(false), | ||
bz2_enabled: !config.disable_bzip2.unwrap_or(false), | ||
cache_action: Default::default(), | ||
}) | ||
.unwrap_or_default(); | ||
|
||
rattler_repodata_gateway::ChannelConfig { | ||
default: default_source_config, | ||
per_channel: Default::default(), | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a duplicate of the existing from_pixi_config
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgot to remove it! I want to keep it's implementation in this trait, so when you need to convert you just
call config.into()
wdyt?
crates/pixi_config/src/gateway.rs
Outdated
@@ -19,3 +22,19 @@ pub fn from_pixi_config(config: &Config) -> ChannelConfig { | |||
per_channel: Default::default(), | |||
} | |||
} | |||
|
|||
/// Constructs a [`Gateway`] from a [`ClientWithMiddleware`] and a [`Config`] | |||
pub fn new_gateway(client: ClientWithMiddleware, config: Config) -> Gateway { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this could be a function of Config
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/cli/exec.rs
Outdated
.with_client(client.clone()) | ||
.with_channel_config(from_pixi_config(config)) | ||
.with_channel_config(config.into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the gateway
function here?
This PR aims to change
pixi global install
to use new repodata gateway.Partially close #1720 ( pixi search and pixi global update should also use it )