mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-09 05:20:03 +00:00
Merge pull request #228 from NobodyXu/fix/skip-on-custom-install
Fix updating metafiles: Skip on custom install path
This commit is contained in:
commit
1768392413
3 changed files with 41 additions and 43 deletions
53
src/main.rs
53
src/main.rs
|
@ -240,12 +240,11 @@ async fn entry(jobserver_client: LazyJobserverClient) -> Result<()> {
|
|||
let desired_targets = get_desired_targets(&opts.targets);
|
||||
|
||||
// Compute install directory
|
||||
let install_path: Arc<Path> = Arc::from(
|
||||
get_install_path(opts.install_path.as_deref()).ok_or_else(|| {
|
||||
error!("No viable install path found of specified, try `--install-path`");
|
||||
miette!("No install path found or specified")
|
||||
})?,
|
||||
);
|
||||
let (install_path, custom_install_path) = get_install_path(opts.install_path.as_deref());
|
||||
let install_path = install_path.ok_or_else(|| {
|
||||
error!("No viable install path found of specified, try `--install-path`");
|
||||
miette!("No install path found or specified")
|
||||
})?;
|
||||
debug!("Using install path: {}", install_path.display());
|
||||
|
||||
// Create a temporary directory for downloads etc.
|
||||
|
@ -343,27 +342,29 @@ async fn entry(jobserver_client: LazyJobserverClient) -> Result<()> {
|
|||
}
|
||||
|
||||
block_in_place(|| {
|
||||
debug!("Writing .crates.toml");
|
||||
metafiles::v1::CratesToml::append(
|
||||
metadata_vec
|
||||
.iter()
|
||||
.map(|metadata| (&metadata.cvs, metadata.bins.clone())),
|
||||
)?;
|
||||
if !custom_install_path {
|
||||
debug!("Writing .crates.toml");
|
||||
metafiles::v1::CratesToml::append(
|
||||
metadata_vec
|
||||
.iter()
|
||||
.map(|metadata| (&metadata.cvs, metadata.bins.clone())),
|
||||
)?;
|
||||
|
||||
debug!("Writing .crates2.json");
|
||||
metafiles::v2::Crates2Json::append(metadata_vec.into_iter().map(|metadata| {
|
||||
(
|
||||
metadata.cvs,
|
||||
metafiles::v2::CrateInfo {
|
||||
version_req: Some(metadata.version_req),
|
||||
bins: metadata.bins,
|
||||
profile: "release".into(),
|
||||
target: metadata.target,
|
||||
rustc: format!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
}))?;
|
||||
debug!("Writing .crates2.json");
|
||||
metafiles::v2::Crates2Json::append(metadata_vec.into_iter().map(|metadata| {
|
||||
(
|
||||
metadata.cvs,
|
||||
metafiles::v2::CrateInfo {
|
||||
version_req: Some(metadata.version_req),
|
||||
bins: metadata.bins,
|
||||
profile: "release".into(),
|
||||
target: metadata.target,
|
||||
rustc: format!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION")),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
}))?;
|
||||
}
|
||||
|
||||
if opts.no_cleanup {
|
||||
// Consume temp_dir without removing it from fs.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue