mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 20:48:43 +00:00
Merge pull request #66 from ryankurte/macos-use-zip
Swap macos to zip, update binary lookup for binstall
This commit is contained in:
commit
f25f0b2337
4 changed files with 34 additions and 15 deletions
|
@ -1,2 +1,11 @@
|
||||||
[target.armv7-unknown-linux-gnueabihf]
|
[target.armv7-unknown-linux-gnueabihf]
|
||||||
linker = "arm-linux-gnueabihf-gcc"
|
linker = "arm-linux-gnueabihf-gcc"
|
||||||
|
|
||||||
|
[target.armv7-unknown-linux-musleabihf]
|
||||||
|
linker = "arm-linux-musleabihf-gcc"
|
||||||
|
|
||||||
|
[target.aarch64-unknown-linux-gnu]
|
||||||
|
linker = "aarch64-linux-gnu-gcc"
|
||||||
|
|
||||||
|
[target.aarch64-unknown-linux-musl]
|
||||||
|
linker = "aarch64-linux-musl-gcc"
|
||||||
|
|
28
.github/workflows/rust.yml
vendored
28
.github/workflows/rust.yml
vendored
|
@ -26,7 +26,7 @@ jobs:
|
||||||
- target: x86_64-apple-darwin
|
- target: x86_64-apple-darwin
|
||||||
os: macos-latest
|
os: macos-latest
|
||||||
output: cargo-binstall
|
output: cargo-binstall
|
||||||
archive: tgz
|
archive: zip
|
||||||
- target: armv7-unknown-linux-gnueabihf
|
- target: armv7-unknown-linux-gnueabihf
|
||||||
os: ubuntu-20.04
|
os: ubuntu-20.04
|
||||||
output: cargo-binstall
|
output: cargo-binstall
|
||||||
|
@ -83,14 +83,18 @@ jobs:
|
||||||
- name: Copy and rename utility
|
- name: Copy and rename utility
|
||||||
run: cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }}
|
run: cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }}
|
||||||
|
|
||||||
- name: Create archive (tgz)
|
- name: Create archive (tgz, linux)
|
||||||
if: ${{ matrix.target != 'x86_64-pc-windows-msvc' }}
|
if: ${{ matrix.os != 'macos-latest' && matrix.os != 'windows-latest' }}
|
||||||
run: tar -czvf cargo-binstall-${{ matrix.target }}.tgz ${{ matrix.output }}
|
run: tar -czvf cargo-binstall-${{ matrix.target }}.tgz ${{ matrix.output }}
|
||||||
|
|
||||||
- name: Create archive (zip)
|
- name: Create archive (zip, windows)
|
||||||
if: ${{ matrix.target == 'x86_64-pc-windows-msvc' }}
|
if: ${{ matrix.os == 'windows-latest' }}
|
||||||
run: tar.exe -a -c -f cargo-binstall-${{ matrix.target }}.zip ${{ matrix.output }}
|
run: tar.exe -a -c -f cargo-binstall-${{ matrix.target }}.zip ${{ matrix.output }}
|
||||||
|
|
||||||
|
- name: Create archive (zip, macos)
|
||||||
|
if: ${{ matrix.os == 'macos-latest' }}
|
||||||
|
run: zip cargo-binstall-${{ matrix.target }}.zip ${{ matrix.output }}
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
|
@ -122,7 +126,7 @@ jobs:
|
||||||
- target: x86_64-apple-darwin
|
- target: x86_64-apple-darwin
|
||||||
os: macos-latest
|
os: macos-latest
|
||||||
output: cargo-binstall
|
output: cargo-binstall
|
||||||
archive: tgz
|
archive: zip
|
||||||
- target: x86_64-pc-windows-msvc
|
- target: x86_64-pc-windows-msvc
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
output: cargo-binstall.exe
|
output: cargo-binstall.exe
|
||||||
|
@ -136,13 +140,17 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: cargo-binstall-${{ matrix.target }}.${{ matrix.archive }}
|
name: cargo-binstall-${{ matrix.target }}.${{ matrix.archive }}
|
||||||
|
|
||||||
- name: "Extract build artifact (tgz)"
|
- name: "Extract build artifact (tgz, linux)"
|
||||||
if: ${{ matrix.target != 'x86_64-pc-windows-msvc' }}
|
if: ${{ matrix.os != 'windows-latest' && matrix.os != 'macos-latest' }}
|
||||||
run: tar -xvf cargo-binstall-${{ matrix.target }}.tgz
|
run: tar -xvf cargo-binstall-${{ matrix.target }}.tgz
|
||||||
|
|
||||||
- name: "Extract build artifact (zip)"
|
- name: "Extract build artifact (zip, windows)"
|
||||||
if: ${{ matrix.target == 'x86_64-pc-windows-msvc' }}
|
if: ${{ matrix.os == 'windows-latest' }}
|
||||||
run: tar.exe -xvf cargo-binstall-${{ matrix.target }}.zip
|
run: tar.exe -xvf cargo-binstall-${{ matrix.target }}.zip
|
||||||
|
|
||||||
|
- name: "Extract build artifact (zip, macos)"
|
||||||
|
if: ${{ matrix.os == 'macos-latest' }}
|
||||||
|
run: unzip cargo-binstall-${{ matrix.target }}.zip
|
||||||
|
|
||||||
- name: "Run binstall"
|
- name: "Run binstall"
|
||||||
run: ./${{ matrix.output }} cargo-binstall --manifest-path . --no-confirm
|
run: ./${{ matrix.output }} cargo-binstall --manifest-path . --no-confirm
|
||||||
|
|
|
@ -15,6 +15,8 @@ bin-dir = "{ bin }{ format }"
|
||||||
|
|
||||||
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
|
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
|
||||||
pkg-fmt = "zip"
|
pkg-fmt = "zip"
|
||||||
|
[package.metadata.binstall.overrides.x86_64-apple-darwin]
|
||||||
|
pkg-fmt = "zip"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
crates_io_api = "0.7.0"
|
crates_io_api = "0.7.0"
|
||||||
|
|
|
@ -50,7 +50,7 @@ pub fn extract<S: AsRef<Path>, P: AsRef<Path>>(source: S, fmt: PkgFmt, path: P)
|
||||||
match fmt {
|
match fmt {
|
||||||
PkgFmt::Tar => {
|
PkgFmt::Tar => {
|
||||||
// Extract to install dir
|
// Extract to install dir
|
||||||
debug!("Extracting from archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref());
|
debug!("Extracting from tar archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref());
|
||||||
|
|
||||||
let dat = std::fs::File::open(source)?;
|
let dat = std::fs::File::open(source)?;
|
||||||
let mut tar = Archive::new(dat);
|
let mut tar = Archive::new(dat);
|
||||||
|
@ -59,7 +59,7 @@ pub fn extract<S: AsRef<Path>, P: AsRef<Path>>(source: S, fmt: PkgFmt, path: P)
|
||||||
},
|
},
|
||||||
PkgFmt::Tgz => {
|
PkgFmt::Tgz => {
|
||||||
// Extract to install dir
|
// Extract to install dir
|
||||||
debug!("Decompressing from archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref());
|
debug!("Decompressing from tgz archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref());
|
||||||
|
|
||||||
let dat = std::fs::File::open(source)?;
|
let dat = std::fs::File::open(source)?;
|
||||||
let tar = GzDecoder::new(dat);
|
let tar = GzDecoder::new(dat);
|
||||||
|
@ -69,7 +69,7 @@ pub fn extract<S: AsRef<Path>, P: AsRef<Path>>(source: S, fmt: PkgFmt, path: P)
|
||||||
},
|
},
|
||||||
PkgFmt::Txz => {
|
PkgFmt::Txz => {
|
||||||
// Extract to install dir
|
// Extract to install dir
|
||||||
debug!("Decompressing from archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref());
|
debug!("Decompressing from txz archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref());
|
||||||
|
|
||||||
let dat = std::fs::File::open(source)?;
|
let dat = std::fs::File::open(source)?;
|
||||||
let tar = XzDecoder::new(dat);
|
let tar = XzDecoder::new(dat);
|
||||||
|
@ -79,7 +79,7 @@ pub fn extract<S: AsRef<Path>, P: AsRef<Path>>(source: S, fmt: PkgFmt, path: P)
|
||||||
},
|
},
|
||||||
PkgFmt::Zip => {
|
PkgFmt::Zip => {
|
||||||
// Extract to install dir
|
// Extract to install dir
|
||||||
debug!("Decompressing from archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref());
|
debug!("Decompressing from zip archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref());
|
||||||
|
|
||||||
let dat = std::fs::File::open(source)?;
|
let dat = std::fs::File::open(source)?;
|
||||||
let mut zip = ZipArchive::new(dat)?;
|
let mut zip = ZipArchive::new(dat)?;
|
||||||
|
@ -87,7 +87,7 @@ pub fn extract<S: AsRef<Path>, P: AsRef<Path>>(source: S, fmt: PkgFmt, path: P)
|
||||||
zip.extract(path)?;
|
zip.extract(path)?;
|
||||||
},
|
},
|
||||||
PkgFmt::Bin => {
|
PkgFmt::Bin => {
|
||||||
debug!("Copying data from archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref());
|
debug!("Copying binary '{:?}' to `{:?}`", source.as_ref(), path.as_ref());
|
||||||
// Copy to install dir
|
// Copy to install dir
|
||||||
std::fs::copy(source, path)?;
|
std::fs::copy(source, path)?;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue