Skip to content

Commit

Permalink
fixed cargo-generate binary download for musl (#166)
Browse files Browse the repository at this point in the history
Thank you for reworking the patch!
  • Loading branch information
rdbo authored Aug 2, 2023
1 parent ae4121f commit d88602f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/ext/exe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,23 @@ impl Command for CommandCargoGenerate {
fn github_repo(&self) -> &'static str { "cargo-generate" }

fn download_url(&self, target_os: &str, target_arch: &str, version: &str) -> Result<String> {
let target = match (target_os, target_arch) {
("macos", "aarch64") => "aarch64-apple-darwin",
("linux", "aarch64") => "aarch64-unknown-linux-gnu",
("macos", "x86_64") => "x86_64-apple-darwin",
("windows", "x86_64") => "x86_64-pc-windows-msvc",
("linux", "x86_64") => "x86_64-unknown-linux-gnu",
_ => bail!("No cargo-generate tar binary found for {target_os} {target_arch}"),
let is_musl_env = is_linux_musl_env();

let target = if is_musl_env {
match (target_os, target_arch) {
("linux", "aarch64") => "aarch64-unknown-linux-musl",
("linux", "x86_64") => "x86_64-unknown-linux-musl",
_ => bail!("No cargo-generate tar binary found for linux-musl {target_arch}"),
}
} else {
match (target_os, target_arch) {
("macos", "aarch64") => "aarch64-apple-darwin",
("linux", "aarch64") => "aarch64-unknown-linux-gnu",
("macos", "x86_64") => "x86_64-apple-darwin",
("windows", "x86_64") => "x86_64-pc-windows-msvc",
("linux", "x86_64") => "x86_64-unknown-linux-gnu",
_ => bail!("No cargo-generate tar binary found for {target_os} {target_arch}"),
}
};

Ok(format!(
Expand Down

0 comments on commit d88602f

Please sign in to comment.