mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 20:48:43 +00:00
Merge pull request #68 from pinage404/fix/binary-package-format
Fix/binary package format
This commit is contained in:
commit
8af4f2c5ea
2 changed files with 12 additions and 2 deletions
|
@ -56,7 +56,7 @@ yes
|
||||||
`binstall` works with existing CI-built binary outputs, with configuration via `[package.metadata.binstall]` keys in the relevant crate manifest.
|
`binstall` works with existing CI-built binary outputs, with configuration via `[package.metadata.binstall]` keys in the relevant crate manifest.
|
||||||
When configuring `binstall` you can test against a local manifest with `--manifest-path=PATH` argument to use the crate and manifest at the provided `PATH`, skipping crate discovery and download.
|
When configuring `binstall` you can test against a local manifest with `--manifest-path=PATH` argument to use the crate and manifest at the provided `PATH`, skipping crate discovery and download.
|
||||||
|
|
||||||
To get started, add a `[package.metadata.binstall]` section to your `Cargo.toml. As an example, the default configuration would be:
|
To get started, add a `[package.metadata.binstall]` section to your `Cargo.toml`. As an example, the default configuration would be:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[package.metadata.binstall]
|
[package.metadata.binstall]
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -199,7 +199,11 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||||
// Generate install paths
|
// Generate install paths
|
||||||
// Source path is the download dir + the generated binary path
|
// Source path is the download dir + the generated binary path
|
||||||
let source_file_path = bin_ctx.render(&meta.bin_dir)?;
|
let source_file_path = bin_ctx.render(&meta.bin_dir)?;
|
||||||
let source = bin_path.join(&source_file_path);
|
let source = if meta.pkg_fmt == PkgFmt::Bin {
|
||||||
|
bin_path.clone()
|
||||||
|
} else {
|
||||||
|
bin_path.join(&source_file_path)
|
||||||
|
};
|
||||||
|
|
||||||
// Destination path is the install dir + base-name-version{.format}
|
// Destination path is the install dir + base-name-version{.format}
|
||||||
let dest_file_path = bin_ctx.render("{ bin }-v{ version }{ format }")?;
|
let dest_file_path = bin_ctx.render("{ bin }-v{ version }{ format }")?;
|
||||||
|
@ -235,6 +239,12 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||||
for (_name, source, dest, _link) in &bin_files {
|
for (_name, source, dest, _link) in &bin_files {
|
||||||
// TODO: check if file already exists
|
// TODO: check if file already exists
|
||||||
std::fs::copy(source, dest)?;
|
std::fs::copy(source, dest)?;
|
||||||
|
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
|
{
|
||||||
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
std::fs::set_permissions(dest, std::fs::Permissions::from_mode(0o755))?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate symlinks
|
// Generate symlinks
|
||||||
|
|
Loading…
Add table
Reference in a new issue