From 1c25b1346f3d769bee931a8c5db58b55366ec20d Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 8 Apr 2021 18:39:54 +1200 Subject: [PATCH 1/6] added zip support, pkg-fmt override swapped CI to build zips for windows --- .github/workflows/rust.yml | 27 ++++++++----- Cargo.lock | 83 +++++++++++++++++++++++++++++++++----- Cargo.toml | 7 +++- README.md | 9 ++++- src/helpers.rs | 11 ++++- src/lib.rs | 38 +++++++++++++++++ src/main.rs | 9 ++++- 7 files changed, 160 insertions(+), 24 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d6ee3548..18186add 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,15 +22,19 @@ jobs: - target: x86_64-unknown-linux-gnu os: ubuntu-latest output: cargo-binstall + archive: tgz - target: x86_64-apple-darwin os: macos-latest output: cargo-binstall + archive: tgz - target: armv7-unknown-linux-gnueabihf os: ubuntu-20.04 output: cargo-binstall + archive: tgz - target: x86_64-pc-windows-msvc os: windows-latest output: cargo-binstall.exe + archive: zip steps: - uses: actions/checkout@v2 @@ -93,28 +97,33 @@ jobs: command: build args: --target ${{ matrix.target }} --release - - name: Copy / Rename utility - run: | - cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }} - tar -czvf cargo-binstall-${{ matrix.target }}.tgz ${{ matrix.output }} + - name: Copy and rename utility + run: cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }} + + - name: Create archive (tgz) + if: ${{ matrix.target != 'x86_64-pc-windows-msvc' }} + run: tar -czvf cargo-binstall-${{ matrix.target }}.tgz ${{ matrix.output }} + + - name: Create archive (zip) + if: ${{ matrix.target == 'x86_64-pc-windows-msvc' }} + run: tar.exe -a -c -f cargo-binstall-${{ matrix.target }}.zip ${{ matrix.output }} - name: Upload artifacts uses: actions/upload-artifact@v1 with: - name: cargo-binstall-${{ matrix.target }}.tgz - path: cargo-binstall-${{ matrix.target }}.tgz + name: cargo-binstall-${{ matrix.target }}.${{ matrix.archive }} + path: cargo-binstall-${{ matrix.target }}.${{ matrix.archive }} - name: Upload binary to release if: ${{ startsWith(github.ref, 'refs/tags/v') }} uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: cargo-binstall-${{ matrix.target }}.tgz - asset_name: cargo-binstall-${{ matrix.target }}.tgz + file: cargo-binstall-${{ matrix.target }}.${{ matrix.archive }} + asset_name: cargo-binstall-${{ matrix.target }}.${{ matrix.archive }} tag: ${{ github.ref }} overwrite: true - test: name: Test runs-on: ${{ matrix.os }} diff --git a/Cargo.lock b/Cargo.lock index d2c2dcc0..1889b065 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,10 +1,12 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] -name = "adler" -version = "0.2.3" +name = "adler32" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "aho-corasick" @@ -88,12 +90,39 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + [[package]] name = "bytes" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" +[[package]] +name = "bzip2" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.10+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17fa3d1ac1ca21c5c4e36a97f3c3eb25084576f6fc47bf0139c1123434216c6c" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "cargo-binstall" version = "0.1.0" @@ -120,6 +149,7 @@ dependencies = [ "tinytemplate", "tokio", "xz2", + "zip", ] [[package]] @@ -338,11 +368,11 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.19" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129" +checksum = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", "crc32fast", "libc", "miniz_oxide", @@ -838,12 +868,11 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.4.3" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" +checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" dependencies = [ - "adler", - "autocfg", + "adler32", ] [[package]] @@ -1541,6 +1570,26 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "thiserror" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0f4a65597094d4483ddaed134f409b2cb7c1beccf25201a9f73c719254fa98e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7765189610d8241a44529806d6fd1f2e0a08734313a35d5b3a556f92b381f3c0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "thread_local" version = "1.0.1" @@ -1952,3 +2001,17 @@ checksum = "c179869f34fc7c01830d3ce7ea2086bc3a07e0d35289b667d0a8bf910258926c" dependencies = [ "lzma-sys", ] + +[[package]] +name = "zip" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8264fcea9b7a036a4a5103d7153e988dbc2ebbafb34f68a3c2d404b6b82d74b6" +dependencies = [ + "byteorder", + "bzip2", + "crc32fast", + "flate2", + "thiserror", + "time", +] diff --git a/Cargo.toml b/Cargo.toml index 3eca536f..9743ea9f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,9 +10,11 @@ license = "GPL-3.0" [package.metadata.binstall] -pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }.tgz" +pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }.{ format }" bin-dir = "{ bin }{ format }" +[package.metadata.binstall.overrides.x86_64-pc-windows-msvc] +pkg-fmt = "zip" [dependencies] crates_io_api = "0.6.1" @@ -25,7 +27,7 @@ simplelog = "0.9.0" anyhow = "1.0.40" reqwest = "0.10.10" tempdir = "0.3.7" -flate2 = "1.0.19" +flate2 = "1.0.14" tar = "0.4.30" cargo_toml = "0.8.1" serde = { version = "1.0.119", features = [ "derive" ] } @@ -36,6 +38,7 @@ serde_derive = "1.0.118" crates-index = "0.16.2" semver = "0.11.0" xz2 = "0.1.6" +zip = "0.5.11" [dev-dependencies] env_logger = "0.8.2" diff --git a/README.md b/README.md index de8f5aab..eae7f1c0 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ yes - [x] Tgz - [x] Txz - [x] Tar + - [x] Zip - [x] Bin - Extraction / Transformation - [x] Extract from subdirectory in archive (ie. support archives with platform or target subdirectories) @@ -79,12 +80,18 @@ Template variables use the format `{ VAR }` where `VAR` is the name of the varia - `bin` is the name of a specific binary, inferred from the crate configuration - `target` is the rust target name (defaults to your architecture, but can be overridden using the `--target` command line option if required(). +Package format can be overridden on a per-target basis, for example, if your `x86_64-pc-windows-msvc` builds use `zip` archives this can be set via: + +``` +[package.metadata.binstall.overrides.x86_64-pc-windows-msvc] +pkg-fmt = "zip" +``` ### Defaults By default `binstall` is setup to work with github releases, and expects to find: -- an archive named `{ name }-{ target }-v{ version }.tgz` +- an archive named `{ name }-{ target }-v{ version }.{ format }` - so that this does not overwrite different targets or versions when manually downloaded - located at `{ repo }/releases/download/v{ version }/` - compatible with github tags / releases diff --git a/src/helpers.rs b/src/helpers.rs index c2f019b8..bc1f3479 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -7,7 +7,7 @@ use cargo_toml::{Manifest}; use flate2::read::GzDecoder; use tar::Archive; use xz2::read::XzDecoder; - +use zip::read::ZipArchive; use crate::{Meta}; @@ -77,6 +77,15 @@ pub fn extract, P: AsRef>(source: S, fmt: PkgFmt, path: P) txz.unpack(path)?; }, + PkgFmt::Zip => { + // Extract to install dir + debug!("Decompressing from archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref()); + + let dat = std::fs::File::open(source)?; + let mut zip = ZipArchive::new(dat)?; + + zip.extract(path)?; + }, PkgFmt::Bin => { debug!("Copying data from archive '{:?}' to `{:?}`", source.as_ref(), path.as_ref()); // Copy to install dir diff --git a/src/lib.rs b/src/lib.rs index 55271832..01faa24b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,6 @@ + +use std::collections::HashMap; + use serde::{Serialize, Deserialize}; use strum_macros::{Display, EnumString, EnumVariantNames}; use tinytemplate::TinyTemplate; @@ -21,6 +24,7 @@ pub const DEFAULT_BIN_PATH: &'static str = "{ name }-{ target }-v{ version }/{ b /// Binary format enumeration +/// This defaults to .zip on windows and .tgz on all other platforms #[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] #[derive(Display, EnumString, EnumVariantNames)] #[strum(serialize_all = "snake_case")] @@ -32,6 +36,8 @@ pub enum PkgFmt { Tgz, /// Download format is TAR + XZ Txz, + /// Download format is Zip + Zip, /// Download format is raw / binary Bin, } @@ -68,6 +74,9 @@ pub struct PkgMeta { /// Public key for package verification (base64 encoded) pub pub_key: Option, + + /// Target specific overrides + pub overrides: HashMap, } impl Default for PkgMeta { @@ -77,10 +86,39 @@ impl Default for PkgMeta { pkg_fmt: PkgFmt::default(), bin_dir: DEFAULT_BIN_PATH.to_string(), pub_key: None, + overrides: HashMap::new(), } } } +impl PkgMeta { + /// Merge configuration overrides into object + pub fn merge(&mut self, pkg_override: &PkgOverride) { + if let Some(o) = pkg_override.pkg_fmt { + self.pkg_fmt = o; + } + } +} + +/// Target specific overrides for binary installation +/// +/// Exposed via `[package.metadata.TARGET]` in `Cargo.toml` +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "kebab-case", default)] +pub struct PkgOverride { + /// Format for package downloads + pub pkg_fmt: Option, +} + +impl Default for PkgOverride { + fn default() -> Self { + Self { + pkg_fmt: None, + } + } +} + + #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct BinMeta { diff --git a/src/main.rs b/src/main.rs index a3dab985..e232eee6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -97,11 +97,18 @@ async fn main() -> Result<(), anyhow::Error> { let manifest = load_manifest_path(manifest_path.join("Cargo.toml"))?; let package = manifest.package.unwrap(); - let (meta, binaries) = ( + let (mut meta, binaries) = ( package.metadata.map(|m| m.binstall ).flatten().unwrap_or(PkgMeta::default()), manifest.bin, ); + // Merge any overrides + if let Some(o) = meta.overrides.remove(&opts.target) { + meta.merge(&o); + } + + debug!("Found metadata: {:?}", meta); + // Generate context for URL interpolation let ctx = Context { name: opts.name.clone(), From fcc88a673e429b2dc58250faea965ae13ebed737 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 8 Apr 2021 18:44:19 +1200 Subject: [PATCH 2/6] remove incorrect default doc line --- src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 01faa24b..fdb3af39 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,7 +24,6 @@ pub const DEFAULT_BIN_PATH: &'static str = "{ name }-{ target }-v{ version }/{ b /// Binary format enumeration -/// This defaults to .zip on windows and .tgz on all other platforms #[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] #[derive(Display, EnumString, EnumVariantNames)] #[strum(serialize_all = "snake_case")] From ddadcd6d320f4bc651589111845e455a3f2df12a Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 8 Apr 2021 18:55:08 +1200 Subject: [PATCH 3/6] bump tokio/reqwest and swap to rustls / remove openssl --- .github/workflows/rust.yml | 24 -- Cargo.lock | 447 +++++++++++++++++++++---------------- Cargo.toml | 6 +- 3 files changed, 253 insertions(+), 224 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 18186add..842c607e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,13 +57,6 @@ jobs: ${{ env.HOME }}/.cargo" target - - name: Install openssl (apt armv7) - if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }} - uses: ryankurte/action-apt@v0.3.0 - with: - arch: armhf - packages: libssl-dev:armhf libssl1.1:armhf zlib1g-dev:armhf zlib1g:armhf libc-dev:armhf - - name: Install cross toolchain (armv7) if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }} run: sudo apt install gcc-arm-linux-gnueabihf @@ -74,23 +67,6 @@ jobs: echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV echo "LZMA_API_STATIC=1" >> $GITHUB_ENV - - name: Install openssl (vcpkg) - if: ${{ matrix.os == 'windows-latest' }} - timeout-minutes: 30 - run: | - vcpkg integrate install - vcpkg install openssl:x64-windows-static - echo "OPENSSL_DIR=C:/vcpkg/installed/x64-windows-static/" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - echo "OPENSSL_ROOT_DIR=C:/vcpkg/installed/x64-windows-static/" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - echo "OPENSSL_STATIC=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - - - name: Cache vcpkg - if: ${{ matrix.os == 'windows-latest' }} - uses: actions/cache@v2 - with: - key: ${{ matrix.os }}-${{ matrix.target }} - path: C:/vcpkg - - name: Build release uses: actions-rs/cargo@v1 with: diff --git a/Cargo.lock b/Cargo.lock index 1889b065..f81dc1ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,7 +23,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -52,7 +52,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -102,6 +102,12 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + [[package]] name = "bzip2" version = "0.3.3" @@ -217,7 +223,7 @@ dependencies = [ "num-traits", "serde", "time", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -277,9 +283,9 @@ dependencies = [ [[package]] name = "crates_io_api" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fc34993d70c88226800d0f23bb51c96c7dfb285e6a1f96134b7a4d8b81d5a4" +checksum = "5fb38f290ea3b9521e536be22d072cd93a04dd385552ba6c6bfb851513a3e5e9" dependencies = [ "chrono", "futures", @@ -329,7 +335,7 @@ checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" dependencies = [ "libc", "redox_users", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -362,8 +368,8 @@ checksum = "0c122a393ea57648015bf06fbd3d372378992e86b9ff5a7a497b076a28c79efe" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall", - "winapi 0.3.9", + "redox_syscall 0.1.57", + "winapi", ] [[package]] @@ -415,22 +421,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "futures" version = "0.3.8" @@ -519,7 +509,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project 1.0.2", + "pin-project", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -560,11 +550,11 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "h2" -version = "0.2.7" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" +checksum = "fc018e188373e2777d0ef2467ebff62a08e66c3f5857b23c8fbec3018210dc00" dependencies = [ - "bytes", + "bytes 1.0.1", "fnv", "futures-core", "futures-sink", @@ -575,7 +565,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "tracing-futures", ] [[package]] @@ -617,7 +606,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2456aef2e6b6a9784192ae780c0f15bc57df0e918585282325e8c8ac27737654" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -626,19 +615,20 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84129d298a6d57d246960ff8eb831ca4af3f96d29e2e28848dae275408658e26" dependencies = [ - "bytes", + "bytes 0.5.6", "fnv", "itoa", ] [[package]] name = "http-body" -version = "0.3.1" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +checksum = "5dfb77c123b4e2f72a2069aeae0b4b4949cc7e966df277813fc16347e7549737" dependencies = [ - "bytes", + "bytes 1.0.1", "http", + "pin-project-lite", ] [[package]] @@ -661,11 +651,11 @@ checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a" [[package]] name = "hyper" -version = "0.13.9" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ad767baac13b44d4529fcf58ba2cd0995e36e7b435bc5b039de6f47e880dbf" +checksum = "8bf09f61b52cfcf4c00de50df88ae423d6c02354e385a86341133b5338630ad1" dependencies = [ - "bytes", + "bytes 1.0.1", "futures-channel", "futures-core", "futures-util", @@ -675,7 +665,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project 1.0.2", + "pin-project", "socket2", "tokio", "tower-service", @@ -684,16 +674,31 @@ dependencies = [ ] [[package]] -name = "hyper-tls" -version = "0.4.3" +name = "hyper-rustls" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" +checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" dependencies = [ - "bytes", + "futures-util", + "hyper", + "log", + "rustls", + "tokio", + "tokio-rustls", + "webpki", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes 1.0.1", "hyper", "native-tls", "tokio", - "tokio-tls", + "tokio-native-tls", ] [[package]] @@ -718,12 +723,12 @@ dependencies = [ ] [[package]] -name = "iovec" -version = "0.1.4" +name = "instant" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" dependencies = [ - "libc", + "cfg-if 1.0.0", ] [[package]] @@ -756,16 +761,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -774,9 +769,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.81" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" +checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41" [[package]] name = "libgit2-sys" @@ -818,6 +813,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "lock_api" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176" +dependencies = [ + "scopeguard", +] + [[package]] name = "log" version = "0.4.14" @@ -856,16 +860,6 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "mime_guess" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "miniz_oxide" version = "0.3.7" @@ -877,33 +871,24 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.23" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956" dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", "libc", "log", "miow", - "net2", - "slab", - "winapi 0.2.8", + "ntapi", + "winapi", ] [[package]] name = "miow" -version = "0.2.2" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "winapi", ] [[package]] @@ -925,14 +910,12 @@ dependencies = [ ] [[package]] -name = "net2" -version = "0.2.37" +name = "ntapi" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1003,6 +986,31 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "parking_lot" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall 0.2.5", + "smallvec", + "winapi", +] + [[package]] name = "percent-encoding" version = "2.1.0" @@ -1018,33 +1026,13 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "pin-project" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" -dependencies = [ - "pin-project-internal 0.4.27", -] - [[package]] name = "pin-project" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ccc2237c2c489783abd8c4c80e5450fc0e98644555b1364da68cc29aa151ca7" dependencies = [ - "pin-project-internal 1.0.2", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "pin-project-internal", ] [[package]] @@ -1058,12 +1046,6 @@ dependencies = [ "syn", ] -[[package]] -name = "pin-project-lite" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" - [[package]] name = "pin-project-lite" version = "0.2.0" @@ -1152,7 +1134,7 @@ dependencies = [ "libc", "rand_core 0.3.1", "rdrand", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1226,6 +1208,15 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +[[package]] +name = "redox_syscall" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_users" version = "0.3.5" @@ -1233,7 +1224,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" dependencies = [ "getrandom", - "redox_syscall", + "redox_syscall 0.1.57", "rust-argon2", ] @@ -1261,45 +1252,63 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] name = "reqwest" -version = "0.10.10" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c" +checksum = "bf12057f289428dbf5c591c74bf10392e4a8003f993405a902f20117019022d4" dependencies = [ "base64", - "bytes", + "bytes 1.0.1", "encoding_rs", "futures-core", "futures-util", "http", "http-body", "hyper", + "hyper-rustls", "hyper-tls", "ipnet", "js-sys", "lazy_static", "log", "mime", - "mime_guess", "native-tls", "percent-encoding", - "pin-project-lite 0.2.0", + "pin-project-lite", + "rustls", "serde", "serde_json", "serde_urlencoded", "tokio", - "tokio-tls", + "tokio-native-tls", + "tokio-rustls", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", "winreg", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + [[package]] name = "rust-argon2" version = "0.8.3" @@ -1312,6 +1321,19 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "rustls" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "064fd21ff87c6e87ed4506e68beb42459caa4a0e2eb144932e6776768556980b" +dependencies = [ + "base64", + "log", + "ring", + "sct", + "webpki", +] + [[package]] name = "ryu" version = "1.0.5" @@ -1325,7 +1347,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi 0.3.9", + "winapi", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "sct" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" +dependencies = [ + "ring", + "untrusted", ] [[package]] @@ -1413,6 +1451,15 @@ dependencies = [ "serde", ] +[[package]] +name = "signal-hook-registry" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" +dependencies = [ + "libc", +] + [[package]] name = "simplelog" version = "0.9.0" @@ -1430,6 +1477,12 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +[[package]] +name = "smallvec" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" + [[package]] name = "smartstring" version = "0.2.6" @@ -1442,15 +1495,20 @@ dependencies = [ [[package]] name = "socket2" -version = "0.3.19" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2" dependencies = [ - "cfg-if 1.0.0", "libc", - "winapi 0.3.9", + "winapi", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "static_assertions" version = "1.1.0" @@ -1524,7 +1582,7 @@ checksum = "489997b7557e9a43e192c527face4feacc78bfbe6eed67fd55c4c9e381cba290" dependencies = [ "filetime", "libc", - "redox_syscall", + "redox_syscall 0.1.57", "xattr", ] @@ -1547,9 +1605,9 @@ dependencies = [ "cfg-if 0.1.10", "libc", "rand 0.7.3", - "redox_syscall", + "redox_syscall 0.1.57", "remove_dir_all", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1607,7 +1665,7 @@ checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1637,28 +1695,29 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "0.2.24" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099837d3464c16a808060bb3f02263b412f6fafcb5d01c533d309985fbeebe48" +checksum = "134af885d758d645f0f0505c9a8b3f9bf8a348fd822e112ab5248138348f1722" dependencies = [ - "bytes", - "fnv", - "futures-core", - "iovec", - "lazy_static", + "autocfg", + "bytes 1.0.1", + "libc", "memchr", "mio", "num_cpus", - "pin-project-lite 0.1.11", - "slab", + "once_cell", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", "tokio-macros", + "winapi", ] [[package]] name = "tokio-macros" -version = "0.2.6" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" +checksum = "caf7b11a536f46a809a8a9f0bb4237020f70ecbf115b842360afb127ea2fda57" dependencies = [ "proc-macro2", "quote", @@ -1666,26 +1725,37 @@ dependencies = [ ] [[package]] -name = "tokio-tls" -version = "0.3.1" +name = "tokio-native-tls" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" dependencies = [ "native-tls", "tokio", ] [[package]] -name = "tokio-util" -version = "0.3.1" +name = "tokio-rustls" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ - "bytes", + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-util" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5143d049e85af7fbc36f5454d990e62c2df705b3589f123b71f441b6b59f443f" +dependencies = [ + "bytes 1.0.1", "futures-core", "futures-sink", "log", - "pin-project-lite 0.1.11", + "pin-project-lite", "tokio", ] @@ -1711,8 +1781,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" dependencies = [ "cfg-if 1.0.0", - "log", - "pin-project-lite 0.2.0", + "pin-project-lite", "tracing-core", ] @@ -1725,16 +1794,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "tracing-futures" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c" -dependencies = [ - "pin-project 0.4.27", - "tracing", -] - [[package]] name = "try-lock" version = "0.2.3" @@ -1747,15 +1806,6 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" -[[package]] -name = "unicase" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.4" @@ -1792,6 +1842,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "2.2.0" @@ -1923,10 +1979,23 @@ dependencies = [ ] [[package]] -name = "winapi" -version = "0.2.8" +name = "webpki" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" +dependencies = [ + "webpki", +] [[package]] name = "winapi" @@ -1938,12 +2007,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1956,7 +2019,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1971,17 +2034,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 9743ea9f..c1f4d305 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,15 +17,15 @@ bin-dir = "{ bin }{ format }" pkg-fmt = "zip" [dependencies] -crates_io_api = "0.6.1" +crates_io_api = "0.7.0" cargo_metadata = "0.12.2" tinytemplate = "1.2.0" -tokio = { version = "0.2.24", features = [ "macros" ] } +tokio = { version = "1.4.0", features = [ "full" ] } log = "0.4.14" structopt = "0.3.21" simplelog = "0.9.0" anyhow = "1.0.40" -reqwest = "0.10.10" +reqwest = { version = "0.11.2", features = [ "rustls-tls" ], default-features = false } tempdir = "0.3.7" flate2 = "1.0.14" tar = "0.4.30" From 122a5fbdc3ef6601cc1184b151f8dd15a867f53c Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 8 Apr 2021 20:39:52 +1200 Subject: [PATCH 4/6] re-add openssl for armv7, probs broken --- .github/dependabot.yml | 2 +- .github/workflows/rust.yml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5f8b768d..5e4980b5 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,5 +5,5 @@ updates: - package-ecosystem: "cargo" directory: "/" schedule: - interval: "daily" + interval: "weekly" diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 842c607e..034d3a13 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -46,6 +46,13 @@ jobs: toolchain: nightly target: ${{ matrix.target }} override: true + + - name: Install openssl (apt armv7) + if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }} + uses: ryankurte/action-apt@v0.3.0 + with: + arch: armhf + packages: libssl-dev:armhf libssl1.1:armhf zlib1g-dev:armhf zlib1g:armhf libc-dev:armhf - name: Configure caching uses: actions/cache@v2 From 612d19d0fb3e17157130b71a8f03f9edf4865095 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 8 Apr 2021 20:49:44 +1200 Subject: [PATCH 5/6] fix windows artefact type for testing --- .github/workflows/rust.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 034d3a13..006f8be5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -118,12 +118,15 @@ jobs: - target: x86_64-unknown-linux-gnu os: ubuntu-latest output: cargo-binstall + archive: tgz - target: x86_64-apple-darwin os: macos-latest output: cargo-binstall + archive: tgz - target: x86_64-pc-windows-msvc os: windows-latest output: cargo-binstall.exe + archive: zip steps: - uses: actions/checkout@v2 @@ -131,10 +134,15 @@ jobs: - uses: actions/download-artifact@v2 with: - name: cargo-binstall-${{ matrix.target }}.tgz + name: cargo-binstall-${{ matrix.target }}.${{ matrix.archive }} - - name: "Extract build artifact" + - name: "Extract build artifact (tgz)" + if: ${{ matrix.target != 'x86_64-pc-windows-msvc' }} run: tar -xvf cargo-binstall-${{ matrix.target }}.tgz + - name: "Extract build artifact (zip)" + if: ${{ matrix.target == 'x86_64-pc-windows-msvc' }} + run: tar.exe -xvf cargo-binstall-${{ matrix.target }}.zip + - name: "Run binstall" run: ./${{ matrix.output }} cargo-binstall --manifest-path . --no-confirm From 76a7fb00c90598150531cd4a2a91c841cc8df43b Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 8 Apr 2021 21:26:44 +1200 Subject: [PATCH 6/6] add pkg-url and pkg-fmt overrides --- README.md | 2 +- src/lib.rs | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index eae7f1c0..bfa5cdea 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ Template variables use the format `{ VAR }` where `VAR` is the name of the varia - `bin` is the name of a specific binary, inferred from the crate configuration - `target` is the rust target name (defaults to your architecture, but can be overridden using the `--target` command line option if required(). -Package format can be overridden on a per-target basis, for example, if your `x86_64-pc-windows-msvc` builds use `zip` archives this can be set via: +`pkg-url`, `pkg-fmt` and `bin-path` can be overridden on a per-target basis if required, for example, if your `x86_64-pc-windows-msvc` builds use `zip` archives this could be set via: ``` [package.metadata.binstall.overrides.x86_64-pc-windows-msvc] diff --git a/src/lib.rs b/src/lib.rs index fdb3af39..682e60c5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -93,8 +93,14 @@ impl Default for PkgMeta { impl PkgMeta { /// Merge configuration overrides into object pub fn merge(&mut self, pkg_override: &PkgOverride) { - if let Some(o) = pkg_override.pkg_fmt { - self.pkg_fmt = o; + if let Some(o) = &pkg_override.pkg_url { + self.pkg_url = o.clone(); + } + if let Some(o) = &pkg_override.pkg_fmt { + self.pkg_fmt = *o; + } + if let Some(o) = &pkg_override.bin_dir { + self.bin_dir = o.clone(); } } } @@ -105,14 +111,22 @@ impl PkgMeta { #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "kebab-case", default)] pub struct PkgOverride { - /// Format for package downloads + /// URL template override for package downloads + pub pkg_url: Option, + + /// Format override for package downloads pub pkg_fmt: Option, + + /// Path template override for binary files in packages + pub bin_dir: Option, } impl Default for PkgOverride { fn default() -> Self { Self { + pkg_url: None, pkg_fmt: None, + bin_dir: None, } } }