Compare commits

...

2107 commits
v0.6.0 ... main

Author SHA1 Message Date
github-actions[bot]
a803508dbf
dep: Upgrade transitive dependencies (#2130)
Co-authored-by: github-actions <github-actions@github.com>
2025-04-18 04:02:19 +00:00
github-actions[bot]
acc44cb207
dep: Upgrade transitive dependencies (#2122)
Co-authored-by: github-actions <github-actions@github.com>
2025-04-11 08:26:47 +00:00
dependabot[bot]
b288890787
build(deps): bump tj-actions/changed-files from 0b975f61488402a699abcebd6a1e25924cf85218 to 6f67ee9ac810f0192ea7b3d2086406f97847bcf9 (#2115)
build(deps): bump tj-actions/changed-files

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 0b975f61488402a699abcebd6a1e25924cf85218 to 6f67ee9ac810f0192ea7b3d2086406f97847bcf9.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](0b975f6148...6f67ee9ac8)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-version: 6f67ee9ac810f0192ea7b3d2086406f97847bcf9
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-07 01:52:11 +00:00
github-actions[bot]
63aaa5c193
release: cargo-binstall v1.12.3 (#2114)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2025-04-06 04:47:09 +00:00
github-actions[bot]
e986d53f05
chore: release (#2106)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-05 11:02:32 +00:00
github-actions[bot]
d7a1d1aeac
dep: Upgrade transitive dependencies (#2113)
Co-authored-by: github-actions <github-actions@github.com>
2025-04-05 10:31:27 +00:00
github-actions[bot]
96d8992410
dep: Upgrade transitive dependencies (#2110)
Co-authored-by: github-actions <github-actions@github.com>
2025-04-04 14:57:01 +00:00
Jiahao XU
b49bcb7a16
Fix clippy lints (#2111)
* Fix indentation of docs in extracted_files.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Optimize parse_header_retry_after

Use next_back instead of last

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix doc indentation in cargo_config.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2025-04-04 14:14:17 +00:00
github-actions[bot]
9c0726d197
dep: Upgrade transitive dependencies (#2105)
Co-authored-by: github-actions <github-actions@github.com>
2025-03-28 07:20:30 +00:00
github-actions[bot]
b9bf440070
release: cargo-binstall v1.12.2 (#2101)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2025-03-20 14:03:34 +00:00
github-actions[bot]
08cf94c5bf
chore: release (#2095)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-19 15:24:05 +00:00
Jiahao XU
88fd813c05
Use zlib-rs for gitoxide and avoid pulling in zlib-ng (#2099)
Since we already use zlib-rs there is no point in pulling in zlib-ng

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-03-19 14:25:08 +00:00
Jiahao XU
028b24de4d
Fix clippy warnings for detect-targets and binstalk-downloader (#2098)
binstalk-downloader clippy warning is specific to windows

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-03-19 14:19:43 +00:00
dependabot[bot]
bb0d6c1f9c
build(deps): bump windows from 0.60.0 to 0.61.1 in the deps group across 1 directory (#2097)
build(deps): bump windows in the deps group across 1 directory

Bumps the deps group with 1 update in the / directory: [windows](https://github.com/microsoft/windows-rs).


Updates `windows` from 0.60.0 to 0.61.1
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/commits)

---
updated-dependencies:
- dependency-name: windows
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-19 14:10:25 +00:00
Jiahao XU
ce998d1af4
dep: Bump hickory-resolver to 0.25.1 (#2096)
* dep: Bump hickory-resolver to 0.25.0

Fix #2089 

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix use of hickory-resolver features

And bump hickory-resolver to 0.25.1

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update lockfile and bump transitive dependencies

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix use of hickory-dns updated API

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-03-19 13:33:44 +00:00
elsirion
d8ecdcaeec
fix: actually check if lock was acquired (#2091) 2025-03-19 09:41:51 +00:00
dependabot[bot]
7790943190
build(deps): bump tj-actions/changed-files from 0fee5fb278312d962ff465bb38dc4cae9f446de2 to 0b975f61488402a699abcebd6a1e25924cf85218 (#2092)
build(deps): bump tj-actions/changed-files

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 0fee5fb278312d962ff465bb38dc4cae9f446de2 to 0b975f61488402a699abcebd6a1e25924cf85218.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](0fee5fb278...0b975f6148)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-19 01:47:44 +00:00
dependabot[bot]
2a0dbc27d2
build(deps): bump tj-actions/changed-files from 531f5f7d163941f0c1c04e0ff4d8bb243ac4366f to 0fee5fb278312d962ff465bb38dc4cae9f446de2 (#2088)
build(deps): bump tj-actions/changed-files

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 531f5f7d163941f0c1c04e0ff4d8bb243ac4366f to 0fee5fb278312d962ff465bb38dc4cae9f446de2.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](531f5f7d16...0fee5fb278)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-18 02:58:25 +00:00
dependabot[bot]
e24cc406c6
build(deps): bump tj-actions/changed-files from 9200e69727eb73eb060652b19946b8a2fdfb654b to 531f5f7d163941f0c1c04e0ff4d8bb243ac4366f (#2087)
build(deps): bump tj-actions/changed-files

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 9200e69727eb73eb060652b19946b8a2fdfb654b to 531f5f7d163941f0c1c04e0ff4d8bb243ac4366f.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](9200e69727...531f5f7d16)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-17 02:11:09 +00:00
github-actions[bot]
89e5015914
release: cargo-binstall v1.12.1 (#2085)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2025-03-15 06:13:23 +00:00
Félix Saparelli
e017e53588
security: pin tj-actions/changed-files to a non-compromised commit (#2086)
pin tj-actions/changed-files to a non-compromised commit

https://www.stepsecurity.io/blog/harden-runner-detection-tj-actions-changed-files-action-is-compromised

Signed-off-by: Félix Saparelli <felix@passcod.name>
2025-03-15 05:14:48 +00:00
github-actions[bot]
e2ef5918cf
chore: release (#2080)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-15 03:38:12 +00:00
dependabot[bot]
120bca5a45
build(deps): bump the deps group with 2 updates (#2084)
Bumps the deps group with 2 updates: [async-trait](https://github.com/dtolnay/async-trait) and [cargo_toml](https://gitlab.com/lib.rs/cargo_toml).


Updates `async-trait` from 0.1.87 to 0.1.88
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.87...0.1.88)

Updates `cargo_toml` from 0.21.0 to 0.22.1
- [Commits](https://gitlab.com/lib.rs/cargo_toml/commits/v0.22.1)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: cargo_toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-15 01:25:01 +00:00
github-actions[bot]
17c2ba863b
dep: Upgrade transitive dependencies (#2083)
Co-authored-by: github-actions <github-actions@github.com>
2025-03-14 07:02:47 +00:00
dependabot[bot]
ed23038614
build(deps): bump tokio from 1.43.0 to 1.44.0 in the deps group (#2079)
Bumps the deps group with 1 update: [tokio](https://github.com/tokio-rs/tokio).


Updates `tokio` from 1.43.0 to 1.44.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.43.0...tokio-1.44.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-08 02:18:01 +00:00
github-actions[bot]
acd08f1845
release: cargo-binstall v1.12.0 (#2078)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2025-03-07 14:58:55 +00:00
github-actions[bot]
b243c176fe
chore: release (#2073)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-07 13:49:46 +00:00
Jiahao XU
268efdf6e6
feat: Use CARGO_BUILD_TARGET as fallback for --target (#2075)
* feat: Use `CARGO_BUILD_TARGET` as fallback for `--target`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix e2e-tests: Unset CARGO_BUILD_TARGET before running e2e-tests

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-03-07 13:18:15 +00:00
github-actions[bot]
451450603f
dep: Upgrade transitive dependencies (#2077)
Co-authored-by: github-actions <github-actions@github.com>
2025-03-07 07:14:11 +00:00
Jiahao XU
92973c1392
Fix detect-targets musl fallback for android and alpine (#2076)
Android does not have `-unknown-` in target and alpine uses
`-alpine-` instead of `-unknown-`, so the musl fallback must be
taken special care when generating

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-03-06 19:56:49 +00:00
Jiahao XU
a8daf8eb3b
Use bzip2/libbz2-rs-sys (#2071)
Also upgrade rc-zip-sync so that it uses bzip the same major version
v0.5.2 as our crate, so that it doesn't pull in c bzip and rust bzip
at the same time.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-03-04 13:20:35 +00:00
dependabot[bot]
d9da8aaba4
build(deps): bump the deps group with 3 updates (#2072)
Some checks failed
Release-plz / Release-plz (push) Has been cancelled
* build(deps): bump the deps group with 3 updates

Bumps the deps group with 3 updates: [compact_str](https://github.com/ParkMyCar/compact_str), [bzip2](https://github.com/trifectatechfoundation/bzip2-rs) and [fs4](https://github.com/al8n/fs4-rs).


Updates `compact_str` from 0.8.1 to 0.9.0
- [Changelog](https://github.com/ParkMyCar/compact_str/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ParkMyCar/compact_str/compare/v0.8.1...v0.9.0)

Updates `bzip2` from 0.5.1 to 0.5.2
- [Release notes](https://github.com/trifectatechfoundation/bzip2-rs/releases)
- [Commits](https://github.com/trifectatechfoundation/bzip2-rs/compare/v0.5.1...v0.5.2)

Updates `fs4` from 0.12.0 to 0.13.0
- [Release notes](https://github.com/al8n/fs4-rs/releases)
- [Changelog](https://github.com/al8n/fs4-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/al8n/fs4-rs/commits)

---
updated-dependencies:
- dependency-name: compact_str
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: bzip2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: fs4
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix use of fs4::fs_std::FileExt::try_lock*

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2025-03-01 07:11:06 +00:00
Jiahao XU
7c38109b23
Simplify release-pr.yml (#2070)
Some checks are pending
Release-plz / Release-plz (push) Waiting to run
We only want to use it for cargo-binstall release

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2025-02-28 13:29:25 +00:00
github-actions[bot]
a799bb428c
release: cargo-binstall v1.11.2 (#2069)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2025-02-28 13:01:26 +00:00
github-actions[bot]
708a489062
chore: release (#2067)
Some checks are pending
Release-plz / Release-plz (push) Waiting to run
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-28 11:55:33 +00:00
Jiahao XU
712ad730a6
Use flate2/zlib-rs for dev/release build (#2068)
* Add feature zlib-rs to binstalk-downloader

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Add feature zlib-rs to binstalk

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Add feature zlib-rs to cargo-binstall

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Enable zlib-rs for CI build pipeline

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2025-02-28 09:08:34 +00:00
github-actions[bot]
72ddf9c3f4
dep: Upgrade transitive dependencies (#2066)
Some checks are pending
Release-plz / Release-plz (push) Waiting to run
Co-authored-by: github-actions <github-actions@github.com>
2025-02-28 03:49:21 +00:00
github-actions[bot]
6010abb1da
release: cargo-binstall v1.11.1 (#2065)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2025-02-23 01:37:27 +00:00
github-actions[bot]
f71ab715ab
chore: release (#2061)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-22 15:38:19 +00:00
Jiahao XU
8ee6c537e4
Log when FileLock::drop fails to unlock file (#2064)
* Add optional dependency tracing to fs-lock

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Add optional logging to FileLock::drop

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Enable fs-lock/tracing in binstalk-manifest

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Add FileLock::set_file_path

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update create_if_not_exist to return FileLock on successs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update create_if_not_exist usage in mod binstall_crates_v1

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Simplify create_if_not_exist

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Refactor mod crates_manifests to use create_if_not_exist

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Set file path for FileLock

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Set file path for file lock in mod cargo_config

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix fs-lock impl

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Import Path in fs-lock lib.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix fs-lock lib.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix fs-lock lib.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix typo in crates_manifests.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix calling create_if_not_exist in crates_manifests.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fox fmt crates_manifests.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix fmt in lib.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2025-02-22 14:33:36 +00:00
dependabot[bot]
86a7e90175
build(deps): bump windows from 0.59.0 to 0.60.0 in the deps group across 1 directory (#2063)
build(deps): bump windows in the deps group across 1 directory

Bumps the deps group with 1 update in the / directory: [windows](https://github.com/microsoft/windows-rs).


Updates `windows` from 0.59.0 to 0.60.0
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.59.0...0.60.0)

---
updated-dependencies:
- dependency-name: windows
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-22 11:18:19 +00:00
github-actions[bot]
583cdc48b0
dep: Upgrade transitive dependencies (#2062)
Co-authored-by: github-actions <github-actions@github.com>
2025-02-22 10:51:34 +00:00
Jiahao XU
395a586265
Fix fs-lock error on nightly (#2059)
* Fix fs-lock error on nightly

Since File::*lock* API is stablised on 1.87, it overrides fs4::fs_std::FileExt

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix other fs-lock method

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix unit-tests when no test is run

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2025-02-22 10:21:02 +00:00
github-actions[bot]
ac0e34cc77
release: cargo-binstall v1.11.0 (#2053)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2025-02-15 09:20:04 +00:00
github-actions[bot]
cdc492db98
chore: release (#2051)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-15 08:22:41 +00:00
Josh McKinney
95a9818565
feat: add color and wrapping to help text (#2052)
* feat: add color to help text

Uses the same coloring that cargo uses to make it easier to skim read the help

* fix: wrap help text

* fix: shorten value placeholders in help text

* fix: docs for override help text
2025-02-15 07:40:19 +00:00
github-actions[bot]
2c624c26f4
dep: Upgrade transitive dependencies (#2050)
Co-authored-by: github-actions <github-actions@github.com>
2025-02-14 07:48:22 +00:00
github-actions[bot]
c175bb02c4
release: cargo-binstall v1.10.23 (#2048)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2025-02-12 00:21:51 +00:00
github-actions[bot]
8a18d5f024
chore: release (#2040)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-11 16:10:36 +00:00
dependabot[bot]
04a243ff8f
build(deps): bump the deps group with 2 updates (#2044)
Bumps the deps group with 2 updates: [strum](https://github.com/Peternator7/strum) and [strum_macros](https://github.com/Peternator7/strum).


Updates `strum` from 0.26.3 to 0.27.0
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/compare/v0.26.3...v0.27.0)

Updates `strum_macros` from 0.26.4 to 0.27.0
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits/v0.27.0)

---
updated-dependencies:
- dependency-name: strum
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: strum_macros
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-11 11:03:28 +00:00
github-actions[bot]
8c130934bf
dep: Upgrade transitive dependencies (#2043)
Co-authored-by: github-actions <github-actions@github.com>
2025-02-11 10:20:00 +00:00
Jiahao XU
9b8ba9902d
Upgrade hickory-resolver to 0.25.0-alpha.5 (#2038)
* Upgrade hickory-resolver to 0.25.0-alpha.5

Update dependencies

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix compilation for hickory-resolver

Cleanup use of removed feature

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix resolver.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Pin hickory-resolver to avoid breakage

Cargo considers 0.25.0-alpha.* to be compatible while they can contain breaking changes between alpha versions.

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2025-02-11 09:54:04 +00:00
github-actions[bot]
7918038770
dep: Upgrade transitive dependencies (#2039)
Co-authored-by: github-actions <github-actions@github.com>
2025-02-08 10:45:39 +00:00
github-actions[bot]
a3f88b5cbf
chore: release (#2031)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-04 21:30:08 +00:00
Félix Saparelli
8dd91862fb
feat(downloader): allow remote::Client to be customised (#2035)
This is for usage outside of binstall itself.

Sometimes it's useful to be able to specify more reqwest options, such as doing custom DNS resolution. This leaves the existing API identical but adds a couple methods that make it possible to construct a client with custom options.

Signed-off-by: Félix Saparelli <felix@passcod.name>
2025-02-04 11:30:31 +00:00
dependabot[bot]
f68f769899
build(deps): bump openssl from 0.10.69 to 0.10.70 in the cargo group (#2034)
Bumps the cargo group with 1 update: [openssl](https://github.com/sfackler/rust-openssl).


Updates `openssl` from 0.10.69 to 0.10.70
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.69...openssl-v0.10.70)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: indirect
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-03 20:25:43 +00:00
github-actions[bot]
38b5ccd8fe
dep: Upgrade transitive dependencies (#2033)
Co-authored-by: github-actions <github-actions@github.com>
2025-01-31 06:46:28 +00:00
github-actions[bot]
2b6f5de5d2
dep: Upgrade transitive dependencies (#2030)
Co-authored-by: github-actions <github-actions@github.com>
2025-01-24 07:01:51 +00:00
github-actions[bot]
639cca9737
release: cargo-binstall v1.10.22 (#2029)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2025-01-19 06:37:17 +00:00
github-actions[bot]
bd6f0c6b14
chore: release (#2027)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-19 02:58:41 +00:00
github-actions[bot]
4c9e82a8ad
dep: Upgrade transitive dependencies (#2028)
Co-authored-by: github-actions <github-actions@github.com>
2025-01-19 02:22:20 +00:00
github-actions[bot]
18b803e946
dep: Upgrade transitive dependencies (#2026)
Co-authored-by: github-actions <github-actions@github.com>
2025-01-17 07:04:51 +00:00
github-actions[bot]
aa7d47ed36
release: cargo-binstall v1.10.21 (#2024)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2025-01-13 14:12:56 +00:00
github-actions[bot]
9d2dbb3dff
chore: release (#2023)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-13 13:41:19 +00:00
dependabot[bot]
33a38e49e6
build(deps): bump dirs from 5.0.1 to 6.0.0 in the deps group (#2022)
Bumps the deps group with 1 update: [dirs](https://github.com/soc/dirs-rs).


Updates `dirs` from 5.0.1 to 6.0.0
- [Commits](https://github.com/soc/dirs-rs/commits)

---
updated-dependencies:
- dependency-name: dirs
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-13 12:25:42 +00:00
github-actions[bot]
4e1592c8c6
dep: Upgrade transitive dependencies (#2021)
Co-authored-by: github-actions <github-actions@github.com>
2025-01-13 11:32:23 +00:00
Jiahao XU
9d375f9461
Reduce log version requirements back to 0.4.22 (#2020)
Since new versions are yanked

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2025-01-12 06:35:47 +00:00
github-actions[bot]
7bcb061e88
release: cargo-binstall v1.10.20 (#2016)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2025-01-11 06:31:30 +00:00
github-actions[bot]
c6a51aaf3e
chore: release (#2014)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-11 04:00:58 +00:00
dependabot[bot]
fa7478ca78
build(deps): bump the deps group with 3 updates (#2015)
Bumps the deps group with 3 updates: [windows](https://github.com/microsoft/windows-rs), [log](https://github.com/rust-lang/log) and [thiserror](https://github.com/dtolnay/thiserror).


Updates `windows` from 0.58.0 to 0.59.0
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.58.0...0.59.0)

Updates `log` from 0.4.22 to 0.4.24
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.22...0.4.24)

Updates `thiserror` from 2.0.10 to 2.0.11
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/2.0.10...2.0.11)

---
updated-dependencies:
- dependency-name: windows
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-11 02:20:03 +00:00
github-actions[bot]
f15549e0c7
dep: Upgrade transitive dependencies (#2013)
Co-authored-by: github-actions <github-actions@github.com>
2025-01-10 10:43:37 +00:00
Jiahao XU
67b2c6aada
Fix creating PR in upgrade-transitive-deps.yml (#2012)
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2025-01-10 06:55:03 +00:00
github-actions[bot]
1f43e1af11
release: cargo-binstall v1.10.19 (#2011)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2025-01-04 05:18:15 +00:00
github-actions[bot]
158fb2fb14
chore: release (#2009)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-04 02:16:37 +00:00
dependabot[bot]
b491e5e81d
build(deps): bump the deps group with 2 updates (#2010)
Bumps the deps group with 2 updates: [itertools](https://github.com/rust-itertools/itertools) and [async-trait](https://github.com/dtolnay/async-trait).


Updates `itertools` from 0.13.0 to 0.14.0
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-itertools/itertools/compare/v0.13.0...v0.14.0)

Updates `async-trait` from 0.1.83 to 0.1.84
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.83...0.1.84)

---
updated-dependencies:
- dependency-name: itertools
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-04 01:46:19 +00:00
github-actions[bot]
15571ebca8
dep: Upgrade transitive dependencies (#2008)
Co-authored-by: github-actions <github-actions@github.com>
2025-01-03 03:58:23 +00:00
github-actions[bot]
f43d7fca03
release: cargo-binstall v1.10.18 (#2006)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-12-28 05:20:10 +00:00
github-actions[bot]
f1f4d98da7
chore: release (#2001)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-28 01:33:57 +00:00
github-actions[bot]
1d16cbc439
dep: Upgrade transitive dependencies (#2005)
Co-authored-by: github-actions <github-actions@github.com>
2024-12-28 00:10:16 +00:00
github-actions[bot]
0ae1928c13
dep: Upgrade transitive dependencies (#2000)
Co-authored-by: github-actions <github-actions@github.com>
2024-12-20 04:48:11 +00:00
github-actions[bot]
9bc0ba964d
release: cargo-binstall v1.10.17 (#1998)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-12-14 07:15:39 +00:00
github-actions[bot]
7604d8d286
chore: release (#1996)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-14 05:14:05 +00:00
dependabot[bot]
299c771d8f
build(deps): bump the deps group with 2 updates (#1997)
Bumps the deps group with 2 updates: [thiserror](https://github.com/dtolnay/thiserror) and [bzip2](https://github.com/trifectatechfoundation/bzip2-rs).


Updates `thiserror` from 2.0.6 to 2.0.7
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/2.0.6...2.0.7)

Updates `bzip2` from 0.4.4 to 0.5.0
- [Release notes](https://github.com/trifectatechfoundation/bzip2-rs/releases)
- [Commits](https://github.com/trifectatechfoundation/bzip2-rs/compare/0.4.4...v0.5.0)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: bzip2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-14 02:14:33 +00:00
github-actions[bot]
c827565f9a
dep: Upgrade transitive dependencies (#1995)
Co-authored-by: github-actions <github-actions@github.com>
2024-12-13 10:27:01 +00:00
github-actions[bot]
b8ce712a75
release: cargo-binstall v1.10.16 (#1994)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-12-07 06:06:30 +00:00
github-actions[bot]
c8e29f204e
chore: release (#1992)
* chore: release

* Apply suggestions from code review

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-12-07 04:55:43 +00:00
dependabot[bot]
e9f25187d7
build(deps): bump the deps group with 3 updates (#1993)
* build(deps): bump the deps group with 3 updates

Bumps the deps group with 3 updates: [target-lexicon](https://github.com/bytecodealliance/target-lexicon), [cargo_toml](https://gitlab.com/lib.rs/cargo_toml) and [fs4](https://github.com/al8n/fs4-rs).


Updates `target-lexicon` from 0.12.16 to 0.13.0
- [Commits](https://github.com/bytecodealliance/target-lexicon/compare/v0.12.16...v0.13.0)

Updates `cargo_toml` from 0.20.5 to 0.21.0
- [Commits](https://gitlab.com/lib.rs/cargo_toml/commits/main)

Updates `fs4` from 0.11.1 to 0.12.0
- [Release notes](https://github.com/al8n/fs4-rs/releases)
- [Commits](https://github.com/al8n/fs4-rs/commits)

---
updated-dependencies:
- dependency-name: target-lexicon
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: cargo_toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: fs4
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix use of cargo-toml in parse-meta.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-12-07 04:05:38 +00:00
github-actions[bot]
7384dab8cf
dep: Upgrade transitive dependencies (#1991)
Co-authored-by: github-actions <github-actions@github.com>
2024-12-06 04:00:48 +00:00
github-actions[bot]
3e50dfbbc5
release: cargo-binstall v1.10.15 (#1989)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-11-29 11:04:41 +00:00
Jiahao XU
d22433799a
Fix permission of release-pr.yml (#1988)
It needs permission pull-request to create PR

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-11-29 10:39:52 +00:00
Jiahao XU
f95b696a7a
Run CI on main whenever dependencies have changed (#1987)
To update the cache.

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-11-29 10:22:18 +00:00
github-actions[bot]
b78dfd2890
chore: release (#1986)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-29 10:13:39 +00:00
github-actions[bot]
84683f1ff6
dep: Upgrade transitive dependencies (#1985)
* dep: Upgrade transitive dependencies

* Fix clippy lint error in signing.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix must_use warning in bin/build.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix cargo-fmt in bin/ build.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-11-29 08:24:35 +00:00
Trevor Gross
fc2684f0d9
Make install-from-binstall-release work with POSIX sh (#1984)
This script would be useful to run in Docker containers, which don't
always have `bash` available (e.g. Alpine). It just needs a few small
adjustments to make this work, so apply those changes here.

Tested this script in an Alpine container.
2024-11-26 09:04:48 +00:00
dependabot[bot]
ec715d4202
build(deps): bump rustls from 0.23.17 to 0.23.18 in the cargo group (#1983)
Bumps the cargo group with 1 update: [rustls](https://github.com/rustls/rustls).


Updates `rustls` from 0.23.17 to 0.23.18
- [Release notes](https://github.com/rustls/rustls/releases)
- [Changelog](https://github.com/rustls/rustls/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustls/rustls/compare/v/0.23.17...v/0.23.18)

---
updated-dependencies:
- dependency-name: rustls
  dependency-type: indirect
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-25 22:16:30 +00:00
github-actions[bot]
84ca29d5c1
release: cargo-binstall v1.10.14 (#1982)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-11-23 05:43:50 +00:00
github-actions[bot]
d0e37e3ce9
chore: release (#1980)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-23 03:46:10 +00:00
dependabot[bot]
2f84637d23
build(deps): bump the deps group with 2 updates (#1981)
Bumps the deps group with 2 updates: [embed-resource](https://github.com/nabijaczleweli/rust-embed-resource) and [url](https://github.com/servo/rust-url).


Updates `embed-resource` from 2.5.1 to 3.0.1
- [Release notes](https://github.com/nabijaczleweli/rust-embed-resource/releases)
- [Commits](https://github.com/nabijaczleweli/rust-embed-resource/compare/v2.5.1...v3.0.1)

Updates `url` from 2.5.3 to 2.5.4
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v2.5.3...v2.5.4)

---
updated-dependencies:
- dependency-name: embed-resource
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: deps
- dependency-name: url
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-23 02:17:23 +00:00
github-actions[bot]
7b5b928d50
dep: Upgrade transitive dependencies (#1979)
Co-authored-by: github-actions <github-actions@github.com>
2024-11-22 08:39:08 +00:00
Martijn Pieters
dabb630e7f
ci: Correct variable used in install tests (#1977)
The `STRIP_V` env var should be set from the `set_binstall_version`
matrix variable.

While here, ensure that the install-script workflow is run whenever
the workflow itself is changed (in addition to the install scripts
themselves).
2024-11-20 11:12:13 +00:00
Martijn Pieters
266e627928
Fix installer downloads for specific releases (#1976)
* Fix installer downloads for specific releases

Github download urls for a specific release uses the pattern `../releases/download/[RELEASE]/..`, which differs from the latest release URL which uses `../releases/latest/download/..`.

For convenience, if `BINSTALL_VERSION` is set but doesn't start with `v`, the v is prefixed.

* ci: Set BINSTALL_VERSION in install script tests

When running the install-script workflow in Github Actions, add matrix
options for not setting the variable, setting it to the latest release
with the `v` prefix, and setting it to the latest release without the
`v` prefix.
2024-11-20 08:08:08 +00:00
github-actions[bot]
2417642284
release: cargo-binstall v1.10.13 (#1973)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-11-18 09:44:41 +00:00
github-actions[bot]
10a53e7bfb
chore: release (#1972)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-18 08:29:17 +00:00
Christian Bruckmayer
b1aaafcd75
Use git credential helper (#1871)
* Use git credential helper

* Fix compilation

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add back `gh auth token` in `gh_token::get`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix confusing `.expect` msg

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-11-18 08:04:34 +00:00
github-actions[bot]
8dbc22a45b
dep: Upgrade transitive dependencies (#1969)
* dep: Upgrade transitive dependencies

* Fix self-install failure

reflink_or_copy now fails if the dest already exists

9e0b2cf427

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-11-16 05:43:14 +00:00
github-actions[bot]
dae59123eb
release: cargo-binstall v1.10.12 (#1968)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-11-09 09:17:15 +00:00
github-actions[bot]
3677ac112d
chore: release (#1965)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-09 07:22:29 +00:00
Jiahao XU
c9d5e6de40
feature: faster self-install without rate limit issue (#1963)
* Add new hidden option `--self-install`

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix typo

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Optimize: Only call `LazyJobserverClient::new` when necessary

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* `--self-install` should include a path to a binary

On windows, we cannot just copy an executable with process running from it, so better to copy it to a temporary location.

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Impl manifest update and basic API of `self_install`

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Add dep atomic-file-install to cargo-binstall

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Impl `self_install`

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Make `--self-install` a boolean flag

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Accept no duration in `MainExit::new`

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Impl self-install mode in main_impl.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Use `--self-install` mode in install-from-binstall-release.sh

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Use `--self-install` in install-from-binstall-release.ps1

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix import in mod entry

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix call of `self_install` in `main_impl`

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix `--self-install` clap doc

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix `entry::self_install`

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Apply suggestions from code review

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix parsing semver number in entry.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix compilation in entry.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* fix entry.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix fmt in bin_util.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix fmt in entry.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Use --self-install if supported in unix install script

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Use --self-install if available in powershell install script

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix install-from-binstall-release.ps1

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fi install-from-binstall-release.ps1

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix install-from-binstall-release.ps1

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Create self-install.sh

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Add e2e-test-self-install to justfile

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix args::parse() for self-install mode

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix args parsing: Do no require positional arg if --self-install is present

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-11-09 06:19:35 +00:00
github-actions[bot]
b1137ece8c
dep: Upgrade transitive dependencies (#1967)
Co-authored-by: github-actions <github-actions@github.com>
2024-11-09 05:07:10 +00:00
dependabot[bot]
02ca607932
build(deps): bump the deps group with 3 updates (#1966)
* build(deps): bump the deps group with 3 updates

Bumps the deps group with 3 updates: [file-format](https://github.com/mmalecot/file-format), [thiserror](https://github.com/dtolnay/thiserror) and [hickory-resolver](https://github.com/hickory-dns/hickory-dns).


Updates `file-format` from 0.25.0 to 0.26.0
- [Release notes](https://github.com/mmalecot/file-format/releases)
- [Changelog](https://github.com/mmalecot/file-format/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mmalecot/file-format/compare/v0.25.0...v0.26.0)

Updates `thiserror` from 1.0.68 to 2.0.1
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.68...2.0.1)

Updates `hickory-resolver` from 0.25.0-alpha.2 to 0.25.0-alpha.3
- [Release notes](https://github.com/hickory-dns/hickory-dns/releases)
- [Changelog](https://github.com/hickory-dns/hickory-dns/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hickory-dns/hickory-dns/compare/v0.25.0-alpha.2...v0.25.0-alpha.3)

---
updated-dependencies:
- dependency-name: file-format
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: deps
- dependency-name: hickory-resolver
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix import in resolver.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix get_configs() in resolver.rs on Windows

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-11-09 03:47:05 +00:00
github-actions[bot]
27e2db85b4
dep: Upgrade transitive dependencies (#1964)
Co-authored-by: github-actions <github-actions@github.com>
2024-11-08 10:52:34 +00:00
github-actions[bot]
02e9225fbd
release: cargo-binstall v1.10.11 (#1960)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-11-05 20:34:55 +00:00
github-actions[bot]
674f04f95f
chore: release (#1958)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-05 12:18:49 +00:00
github-actions[bot]
1af0df13e5
dep: Upgrade transitive dependencies (#1959)
Co-authored-by: github-actions <github-actions@github.com>
2024-11-05 11:38:14 +00:00
Patrick José Pereira
44b388c9fd
install-from-binstall-release: Add user-agent into curl (#1956)
It appears that github API now enforces the user-agent

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2024-11-05 10:44:09 +00:00
Patrick José Pereira
ecbd4fdff1
install-from-binstall-release: Add BINSTALL_VERSION (#1955)
This allow the users to choose different versions of cargo-binstall

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2024-11-05 10:42:22 +00:00
dependabot[bot]
4bf3685328
build(deps): bump the deps group with 3 updates (#1954)
Bumps the deps group with 3 updates: [thiserror](https://github.com/dtolnay/thiserror), [url](https://github.com/servo/rust-url) and [fs4](https://github.com/al8n/fs4-rs).


Updates `thiserror` from 1.0.66 to 1.0.68
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.66...1.0.68)

Updates `url` from 2.5.2 to 2.5.3
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v2.5.2...v2.5.3)

Updates `fs4` from 0.10.0 to 0.11.0
- [Release notes](https://github.com/al8n/fs4-rs/releases)
- [Commits](https://github.com/al8n/fs4-rs/commits)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: url
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: fs4
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 10:36:13 +00:00
Jiahao XU
04d28b1f5c
CI: Fix just-setup (#1957)
* Fix just-setup

 - install rust toolchain before calling install-action, just in case there's no available binary
 - configure THP/malloc at the start of action

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix rust installation

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix target passed to install-action

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Add missing shell

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix typo

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix passing target to install-action

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-11-05 10:30:30 +00:00
github-actions[bot]
2c1f156332
release: cargo-binstall v1.10.10 (#1951)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-11-02 02:45:51 +00:00
github-actions[bot]
8644e54e84
chore: release (#1944)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-11-02 01:25:13 +00:00
Jiahao XU
a944df0498
Improve UI orompt for installation (#1950)
Fixed #1943

The UI now looks like

```
WARN The package cargo-binstall v1.10.9 (aarch64-apple-darwin) has been downloaded from github.com
INFO This will install the following binaries:
INFO   - cargo-binstall => /tmp/e/bin/cargo-binstall
````

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-11-02 00:52:37 +00:00
github-actions[bot]
48f8cf9b86
dep: Upgrade transitive dependencies (#1949)
Co-authored-by: github-actions <github-actions@github.com>
2024-11-01 07:23:52 +00:00
pepa65
81a8218794
Yes/NO defaults to "no" when just enter is pressed (#1948)
* yes/NO in interface

* Implement No as default (when only Enter is pressed)

* Update README.md

Mark the default as [yes]

Signed-off-by: pepa65 <pepa65@passchier.net>

* Update ui.rs

Mark the default as [yes]

Signed-off-by: pepa65 <pepa65@passchier.net>

* Update ui.rs

Do not break on yes/y/YES/Y/"", break on no/n/NO/N, and keep asking otherwise

Signed-off-by: pepa65 <pepa65@passchier.net>

* Update ui.rs

After testing empty didn't work correctly

Signed-off-by: pepa65 <pepa65@passchier.net>

---------

Signed-off-by: pepa65 <pepa65@passchier.net>
2024-10-30 13:00:56 +00:00
Jiahao XU
e704abe7ac
Use rc-zip-sync for zip extraction (#1942)
* Use rc-zip-sync for zip extraction

Fixed #1080

In this commit, binstalk-downloader is updated to
- first download the zip into a temporary file, since
  there is no correct way to extract zip from a stream.
- then use rc-zip-sync to read from the zip and extract
  it to filesystem.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix returned `ExtractedFiles` in `do_extract_zip`

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix clippy in zip_extraction.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-10-30 00:16:54 +00:00
github-actions[bot]
c16790a16f
release: cargo-binstall v1.10.9 (#1941)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-10-26 02:51:55 +00:00
github-actions[bot]
afd20e9396
chore: release (#1937)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-26 01:49:47 +00:00
github-actions[bot]
a284b4e69e
dep: Upgrade transitive dependencies (#1940)
Co-authored-by: github-actions <github-actions@github.com>
2024-10-25 12:36:08 +00:00
github-actions[bot]
92a022bad4
dep: Upgrade transitive dependencies (#1936)
Co-authored-by: github-actions <github-actions@github.com>
2024-10-18 07:36:53 +00:00
Jiahao XU
a85dc994eb
CI: Run ci.yml on every Sat (#1934)
Make sure we have up-to-date cache.

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-10-13 00:50:57 +00:00
github-actions[bot]
4675f622c9
release: cargo-binstall v1.10.8 (#1931)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-10-13 00:45:03 +00:00
github-actions[bot]
731592f357
chore: release (#1933)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-12 15:08:00 +00:00
PukNgae Cryolitia
5069cb6638
fix(gh_api_client): remote client should never being shared everywhere bacause the underlying connection pool will be reused. (#1930)
The client pool contains connections associated with a runtime when the runtime closes, the client may panic at seeing the connection disappear "abruptly".

Reported-by: https://archriscv.felixc.at/.status/log.htm?url=logs/cargo-binstall/cargo-binstall-1.8.0-1.log
Link: https://github.com/seanmonstar/reqwest/issues/1148
2024-10-12 12:32:04 +00:00
Jiahao XU
61c9231401
CI: Fix binstalk-git-repo-api on PR of forks (#1932)
* Rm CI_UNIT_TEST_GITHUB_TOKEN fallback for unit-tests

As it would break unit testing

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* CI: Fix gh_api_client.rs test

Ignore empty gh token

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update crates/binstalk-git-repo-api/src/gh_api_client.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update crates/binstalk-git-repo-api/src/gh_api_client.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-10-12 10:12:53 +00:00
github-actions[bot]
a8227ae6a4
chore: release (#1928)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-12 03:58:24 +00:00
dependabot[bot]
e7f98b2a3d
build(deps): bump fs4 from 0.9.1 to 0.10.0 in the deps group (#1929)
Bumps the deps group with 1 update: [fs4](https://github.com/al8n/fs4-rs).


Updates `fs4` from 0.9.1 to 0.10.0
- [Release notes](https://github.com/al8n/fs4-rs/releases)
- [Commits](https://github.com/al8n/fs4-rs/commits/0.10.0)

---
updated-dependencies:
- dependency-name: fs4
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-12 01:46:19 +00:00
github-actions[bot]
2a7634c909
dep: Upgrade transitive dependencies (#1927)
Co-authored-by: github-actions <github-actions@github.com>
2024-10-11 08:37:06 +00:00
github-actions[bot]
3ed2912cc1
release: cargo-binstall v1.10.7 (#1926)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-10-04 12:03:43 +00:00
github-actions[bot]
a7794f08a6
chore: release (#1924)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-04 10:54:17 +00:00
github-actions[bot]
f80bf0ccf7
dep: Upgrade transitive dependencies (#1925)
Co-authored-by: github-actions <github-actions@github.com>
2024-10-04 10:27:53 +00:00
github-actions[bot]
d05a8d0cc0
dep: Upgrade transitive dependencies (#1923)
Co-authored-by: github-actions <github-actions@github.com>
2024-09-27 04:10:45 +00:00
github-actions[bot]
3a99ae3c15
release: cargo-binstall v1.10.6 (#1922)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-09-22 10:17:00 +00:00
github-actions[bot]
4a15b12fd1
chore: release (#1916)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-22 08:59:21 +00:00
John Vandenberg
2917b32788
allow setting no_confirm via envvar (#1921) 2024-09-22 07:06:01 +00:00
github-actions[bot]
e3321fbac5
dep: Upgrade transitive dependencies (#1919)
Co-authored-by: github-actions <github-actions@github.com>
2024-09-20 10:30:53 +00:00
github-actions[bot]
b296b4e92e
dep: Upgrade transitive dependencies (#1915)
Co-authored-by: github-actions <github-actions@github.com>
2024-09-13 09:08:21 +00:00
github-actions[bot]
f9144d57df
release: cargo-binstall v1.10.5 (#1914)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-09-11 09:06:06 +00:00
github-actions[bot]
8c9e183587
chore: release (#1911)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-11 08:37:44 +00:00
David Laban
c8dec953cc
report to new stats server (with status) (#1912)
* docstrings for things that I was curious about

* report to new stats server, with status

* Arc<Self> needs a clone

* fix stats url in docs

* fix stats url handling
2024-09-11 08:15:15 +00:00
Jiahao XU
a88335d05b
Improve quickinstall telemetry failure message (#1910)
Fixed #1896

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-09-08 04:20:04 +00:00
github-actions[bot]
780584e44b
release: cargo-binstall v1.10.4 (#1908)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-09-06 22:43:53 +00:00
github-actions[bot]
89203c196c
chore: release (#1902)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-09-06 13:37:48 +00:00
github-actions[bot]
04978e949e
dep: Upgrade transitive dependencies (#1907)
Co-authored-by: github-actions <github-actions@github.com>
2024-09-06 12:55:55 +00:00
github-actions[bot]
659ad8172f
dep: Upgrade transitive dependencies (#1906)
Co-authored-by: github-actions <github-actions@github.com>
2024-09-06 09:05:08 +00:00
Jiahao XU
a53d51c083
Send telemetry report to quickinstall if no pre-built is found (#1905)
* Send telemetry report to quickinstall if no pre-built is found

quickinstall telemtry is overloaded cargo-bins/cargo-quickinstall#268, it only needs report when the pre-built is not available in upstream.

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix resolve.rs

And optimize sending telemtry: Remove unnecessary `<Arc as Clone>::clone`

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix fmt of resolve.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-09-05 14:43:38 +00:00
dependabot[bot]
e4bbbff1fd
build(deps): bump quinn-proto from 0.11.6 to 0.11.8 in the cargo group (#1904)
Bumps the cargo group with 1 update: [quinn-proto](https://github.com/quinn-rs/quinn).


Updates `quinn-proto` from 0.11.6 to 0.11.8
- [Release notes](https://github.com/quinn-rs/quinn/releases)
- [Commits](https://github.com/quinn-rs/quinn/compare/quinn-proto-0.11.6...quinn-proto-0.11.8)

---
updated-dependencies:
- dependency-name: quinn-proto
  dependency-type: indirect
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-04 00:39:25 +00:00
github-actions[bot]
8e9ef12ec8
dep: Upgrade transitive dependencies (#1901)
Co-authored-by: github-actions <github-actions@github.com>
2024-08-30 09:19:41 +00:00
Jiahao XU
3331364a65
reduce default for maximum_resolution_timeout to 15s (#1900)
If then default is too long, then users would still have to wait a long time if they hit rate limit.

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-08-29 12:45:33 +00:00
Jiahao XU
069afedf19
Speedup ci: Exclude workspace from macOS SIP and windows defenders (#1899)
* Enable macOS dev mode in CI

to speedup CI

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Enable dev drive on windows to speedup CI

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Use dev drive for target

which is the most write-heavy part.

The read to the workspace can be cached as it is really small

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Setup dev drive for cargo/rust home

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Exclude target, cargo/rustup home from windows defender

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Exclude the entire workspace from

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix action.yml

Add missing shell, and merge steps for adding windows defender exclusion

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix adding windows defender exclusion path

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix use of Add-MpPreference

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix pwsh

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix creating second dev drive

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix second dev drive setup

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix caching: Do not mount dev drive at target

Since it contains files that are not accessible.

Also remove use of dev drive for cargo/rustup home since it prevents caching (rust-cache does not read from env).

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Disable dev drive for windows as a failed experiment

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-08-25 12:15:41 +00:00
github-actions[bot]
9330730a2a
release: cargo-binstall v1.10.3 (#1898)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-08-25 09:18:31 +00:00
github-actions[bot]
05bfcbce0e
chore: release (#1883)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-25 08:37:25 +00:00
github-actions[bot]
5ae11b35d7
dep: Upgrade transitive dependencies (#1897)
Co-authored-by: github-actions <github-actions@github.com>
2024-08-25 07:55:45 +00:00
dependabot[bot]
50bee16581
build(deps): bump tj-actions/changed-files from 44 to 45 (#1893)
Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 44 to 45.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](https://github.com/tj-actions/changed-files/compare/v44...v45)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-22 03:22:31 +00:00
Alejandro González
b599493600
docs: mention quickinstall telemetry collection in --help and README (#1890)
* docs: mention `quickinstall` telemetry collection in `--help` and README

These changes describe the usage statistics collected when the
`quickinstall` strategy is used by default, according to the discussion
and details brought forward on
https://github.com/cargo-bins/cargo-binstall/issues/1884. Both the
project README and the CLI long help contain clear disclosures of such
statistics collection now.

Signed-off-by: Alejandro González <me@alegon.dev>

* docs: add some more data collection details

Signed-off-by: Alejandro González <me@alegon.dev>

---------

Signed-off-by: Alejandro González <me@alegon.dev>
2024-08-20 10:24:13 +00:00
Jiahao XU
6cb09fd1e2
Add link for all supported pkg-fmt in SUPPORT.md (#1887)
* Add link for all supported pkg-fmt in SUPPORT.md

Fix #1885

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update SUPPORT.md

Co-authored-by: pinage404 <pinage404@gmail.com>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: pinage404 <pinage404@gmail.com>
2024-08-16 22:57:12 +00:00
github-actions[bot]
448bb02a7f
dep: Upgrade transitive dependencies (#1882)
Co-authored-by: github-actions <github-actions@github.com>
2024-08-16 03:46:47 +00:00
github-actions[bot]
c4abcb90a5
release: cargo-binstall v1.10.2 (#1881)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-08-13 09:15:54 +00:00
github-actions[bot]
ad67d44ff6
release: cargo-binstall v1.10.1 (#1880)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-08-12 14:55:46 +00:00
github-actions[bot]
2c00df4c90
chore: release (#1878)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-12 14:22:35 +00:00
Jiahao XU
d02d7b2a69
Fix setting release to latest in release-cli.yml (#1879)
* Fix setting release to latest in release-cli.yml

Using gh-release-edit

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update .github/workflows/release-cli.yml

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-08-12 13:57:22 +00:00
Jiahao XU
a8eea5bc72
Enable happy eyeballs when using hickory-dns (#1877)
* Enable happy eyeballs when using hickory-dns

Ported from seanmonstar/reqwest#2378

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix imports in resolver.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix fmt in resolver.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix fmt in resolver.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix resolver.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix import on windows in resolver.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-08-11 07:26:09 +00:00
Jiahao XU
43012ceb2c
Fix release-plz.toml (#1876)
Set git_release_latest=false in workspace

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-08-10 08:40:05 +00:00
github-actions[bot]
d35fecfd64
release: cargo-binstall v1.10.0 (#1875)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-08-10 08:24:15 +00:00
github-actions[bot]
53512b9271
chore: release (#1870)
* chore: release

* Bump dependents of binstall-types to next major version

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-08-10 07:46:44 +00:00
github-actions[bot]
e9b36b0632
dep: Upgrade transitive dependencies (#1874)
Co-authored-by: github-actions <github-actions@github.com>
2024-08-10 05:02:06 +00:00
Jiahao XU
96f5445e52
dep: Bump hickory-resolver to 0.25.0-alpha.2 (#1869)
* dep: Bump hickory-resolver to 0.25.0-alpha.2

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Remove workaround for ring 0.16 on aarc64-pc-windows-msvc

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-08-10 04:31:24 +00:00
Jiahao XU
b854f3f52c
feature: Merge disable strategies (#1868)
* feat: Merge --disable-strategies with ones in cargo manifest

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update doc

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update e2e-test-strategies

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix typo in option doc in crates/bin/src/args.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-08-07 14:04:00 +00:00
Jiahao XU
90d47f76b1
Fix release-plz.toml (#1866)
Do not set release as latest, since that would break installation script/action.

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-08-05 10:42:00 +00:00
github-actions[bot]
23ee8ab6b7
release: cargo-binstall v1.9.0 (#1863)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-08-04 05:32:22 +00:00
github-actions[bot]
cf7c8f9656
chore: release (#1853)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-04 03:04:47 +00:00
Jiahao XU
52f2db4f57
Add --maximum-resolution-timeout (#1862)
* Add --maximum-resolution-timeout

Fixed #1823

* Display default value for `--maximum-resolution-timeout` in help
2024-08-04 02:13:18 +00:00
github-actions[bot]
de55e465f5
dep: Upgrade transitive dependencies (#1861)
Co-authored-by: github-actions <github-actions@github.com>
2024-08-03 05:48:40 +00:00
Jiahao XU
ee94b8b639
Fix: --strategies on CLI do not seem to override disabled-strategies in the manifest (#1857)
* Fix cli override in entry.rs

Forward `args.disabled_strategies`

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix `args::parse`: Do not free disabled_strategies

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix passing of cli_overrides

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Create strategies-test-override-Cargo.toml

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Add e2e-tests for cli-overrides

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix entry.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* fix entry.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix entry.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update strategies.sh

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Compute cli_overrides in args::parse

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* fix use of args::parse main_impl.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update entry.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix args::parse

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix typo in args.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix args.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix fmt in args.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* fix fmt in main_impl.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* update e2e-test-strategies

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update e2e-tests/strategies.sh

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update e2e-tests/strategies.sh

Make sure both --strategies and --disable-strategies is tested

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update strategies.sh

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-08-03 05:27:23 +00:00
dependabot[bot]
cdbb121112
build(deps): bump the deps group across 1 directory with 2 updates (#1859)
* build(deps): bump the deps group across 1 directory with 2 updates

Bumps the deps group with 2 updates in the / directory: [fs4](https://github.com/al8n/fs4-rs) and [windows-sys](https://github.com/microsoft/windows-rs).


Updates `fs4` from 0.8.4 to 0.9.1
- [Release notes](https://github.com/al8n/fs4-rs/releases)
- [Commits](https://github.com/al8n/fs4-rs/commits)

Updates `windows-sys` from 0.52.0 to 0.59.0
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.52.0...0.59.0)

---
updated-dependencies:
- dependency-name: fs4
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: windows-sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix use of fs4

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix windows.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Rm drop impl for LibraryHandle

As unmounting dynlib might cause UB

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fix clippy in windows.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-08-03 05:03:10 +00:00
Jiahao XU
5d57d4506e
Fix CI blocked due to cargo-binstall rate-limit (#1860)
* Update gh-action.yml

Use CI_RELEASE_TEST_GITHUB_TOKEN if found as that one has less power

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update install-script.yml

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* RM outdated comment in gh-action.yml

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Pass github token to cargo-bins/cargo-binstall action in release-cli.yml

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Pass github-token to taiki-e/install-action in release-pr.yml

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-08-03 04:40:18 +00:00
github-actions[bot]
ad892911c6
dep: Upgrade transitive dependencies (#1856)
Co-authored-by: github-actions <github-actions@github.com>
2024-08-02 05:04:46 +00:00
Jiahao XU
9f3bfa9ca3
Switch back to macos-latest (#1855)
macos-latest is now an alias of macos-14 M1

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-07-31 12:49:13 +00:00
Jiahao XU
c635ad6f95
CI: Add release-plz to release library crates (#1850)
* Create release-plz.yml

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Disable release-plz for cargo-binstall

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Félix Saparelli <felix@passcod.name>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: Félix Saparelli <felix@passcod.name>
2024-07-29 03:52:03 +00:00
github-actions[bot]
f2a184de0e
release: cargo-binstall v1.8.0 (#1849)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-07-26 11:34:38 +00:00
github-actions[bot]
40a083f65d
release: binstalk v0.27.0 (#1848)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-07-26 10:49:28 +00:00
github-actions[bot]
091b39d278
release: binstalk-fetchers v0.8.0 (#1847)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-07-26 10:21:55 +00:00
github-actions[bot]
8b314728d8
release: binstalk-registry v0.10.0 (#1846)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-07-26 09:40:36 +00:00
github-actions[bot]
08d8946dde
release: binstalk-git-repo-api v0.4.0 (#1845)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-07-26 09:39:17 +00:00
github-actions[bot]
40ec708bd8
release: binstalk-bins v0.5.0 (#1843)
chore: Release

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-07-26 09:38:04 +00:00
github-actions[bot]
75d46eeaab
release: binstalk-manifests v0.14.0 (#1844)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-07-26 09:25:15 +00:00
github-actions[bot]
78f26622b2
release: binstalk-downloader v0.12.0 (#1842)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-07-26 09:11:23 +00:00
github-actions[bot]
24c7c1a4bb
release: cargo-toml-workspace v6.0.1 (#1840)
chore: Release

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-07-26 08:57:35 +00:00
github-actions[bot]
58d638726b
release: binstalk-types v0.8.0 (#1841)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-07-26 08:37:08 +00:00
Jiahao XU
6b4dbb4caa
Fix: Ignore invalid Github Token (#1839)
* Fix: Ignore empty Github Token

Empty GitHub Token is invalid, it should not be used.

* Fix compilation

And detect more invalid tokens

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* fix

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-07-26 08:21:36 +00:00
Jiahao XU
e017be2247
Add env for --disable-strategies (#1838)
Fixed #1833
2024-07-26 06:46:04 +00:00
Jiahao XU
6809601273
Add new option to --disable-telemetry to disable quickinstall statistics collection (#1831)
* Add new option `--disable-quick-install-stats`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Send quickinstall stats in parallel

This commit also make sure'the stats is always sent for
each fetcher, regardless of whether it is picked or not,
to make sure that the quick-install stats collection gets
the full infomration of possible targets.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rename option to `--disable-telemetry`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update args.rs

Co-authored-by: Félix Saparelli <felix@passcod.name>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update args.rs

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Co-authored-by: Félix Saparelli <felix@passcod.name>
2024-07-26 06:03:38 +00:00
Jiahao XU
fa105bb8d7
Update doc in SUPPORT.md for disabled-strategies (#1830)
* Update doc in SUPPORT.md for disabled-strategies

For #1828 and #1721

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update SUPPORT.md

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-07-26 04:26:56 +00:00
github-actions[bot]
6df132a9d5
dep: Upgrade transitive dependencies (#1837)
Co-authored-by: github-actions <github-actions@github.com>
2024-07-26 03:34:19 +00:00
Jiahao XU
871e1eaf68
Fix 1.80 cargo clippy errors (#1834)
Fix 1.80 clippy lint errors

Fix 1.80 linting

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-07-25 15:10:59 +00:00
Jiahao XU
53f342ab1c
Enable vendored native-tls if native-tls and static is enabled (#1832)
Fixed #1694

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-07-25 02:25:43 +00:00
Jiahao XU
3f29fbe83a
Feature: SupportdDisable of strategies for crate using Cargo.toml (#1828)
* Refactor: Move `Strategy` to `binstalk-types`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add serialisation test for `Strategy`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add support to disable strategies via crate `Cargo.toml`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add e2e-test

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `Cargo.toml` disabled strategy checking for compile strategy

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Optimize `resolve_inner`: Cache meta override

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add compile-time length checking for `Strategy`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* More optimization

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix order of override: cli options alwayus takes precedence

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add missing manifest for e2e-test

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-07-23 14:05:22 +00:00
dependabot[bot]
09d61d081d
build(deps): bump openssl from 0.10.64 to 0.10.66 in the cargo group (#1829)
Bumps the cargo group with 1 update: [openssl](https://github.com/sfackler/rust-openssl).


Updates `openssl` from 0.10.64 to 0.10.66
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.64...openssl-v0.10.66)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: indirect
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 22:12:40 +00:00
github-actions[bot]
fbe6e4c83a
dep: Upgrade transitive dependencies (#1825)
Co-authored-by: github-actions <github-actions@github.com>
2024-07-19 04:03:34 +00:00
Jiahao XU
eba07fb147
Fix v1 manifest format for git and local path (#1821)
* Bump simple-git to v0.2.10

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix v1 manifest format for git and local path

Fixed #1815

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix v1 format for custom registry

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Remove unused functions

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix compilation

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update git.sh

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Fixed git.sh for windows

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* fixx git.sh for win

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* Update git.sh

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* fix git.sh

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-07-17 05:34:12 +00:00
Jiahao XU
5a316b765f
Fix url link in README.md (#1820)
Fixed  #1819

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-07-15 14:10:12 +00:00
Kristof Mattei
fdfc89c287
fix: normalize GitHub URLs ending in .git to not ending in .git (#1804)
* fix: normalize GitHub URLs ending in .git to not ending in .git

* Refactor `Data::get_repo_info`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `get_repo_info` for repo with `.git` suffix

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add e2e-tests to cover it

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Always try geting the redirected url

This would help:
 - redirect public gh repo `.git` to its canonical form
 - redirect public gh repo, which has been recently renamed
 - cases where redirection is needed to get the real repo

This commit make it fallbacks to the previou surl, if getting
the redirected url fail, in case the repository is private.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add more e2e-tests

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Optimize: Do not try redirect if gh_get_repo_info fail

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Minor refactor

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-07-14 14:45:41 +00:00
Jiahao XU
74af0e7f8a
Mark binstalk_manifests::cargo_crates_v1::CratesToml::insert private (#1818)
It uses a private type so it should not have public visibility.

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-07-13 08:49:45 +00:00
dependabot[bot]
0fe605f7f0
build(deps): bump compact_str from 0.7.1 to 0.8.0 in the deps group (#1817)
* build(deps): bump compact_str from 0.7.1 to 0.8.0 in the deps group

Bumps the deps group with 1 update: [compact_str](https://github.com/ParkMyCar/compact_str).


Updates `compact_str` from 0.7.1 to 0.8.0
- [Changelog](https://github.com/ParkMyCar/compact_str/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ParkMyCar/compact_str/commits)

---
updated-dependencies:
- dependency-name: compact_str
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix compilation error and deprecations

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Use `CompactString::const_new` when possible

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-07-13 04:10:11 +00:00
github-actions[bot]
a92ad4952f
dep: Upgrade transitive dependencies (#1816)
Co-authored-by: github-actions <github-actions@github.com>
2024-07-12 03:49:02 +00:00
Yuki Nagato
8705f1c345
Raspberry-pi (#1814)
* Get install script to work on raspberry pi

* cleanup
2024-07-11 03:36:58 +00:00
github-actions[bot]
7032b06746
release: cargo-binstall v1.7.4 (#1813)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-07-06 05:50:06 +00:00
github-actions[bot]
928e28a51c
release: atomic-file-install v1.0.5 (#1812)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-07-06 05:06:54 +00:00
Jiahao XU
0a9f17f1ba
Speedup and prevent rate limit in gh-action.yml (#1811)
By passing github token

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
2024-07-06 04:27:28 +00:00
github-actions[bot]
d401c48296
dep: Upgrade transitive dependencies (#1810)
Co-authored-by: github-actions <github-actions@github.com>
2024-07-06 02:33:00 +00:00
dependabot[bot]
832834058d
build(deps): bump the deps group with 2 updates (#1808)
Bumps the deps group with 2 updates: [windows](https://github.com/microsoft/windows-rs) and [zstd](https://github.com/gyscos/zstd-rs).


Updates `windows` from 0.57.0 to 0.58.0
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.57.0...0.58.0)

Updates `zstd` from 0.13.1 to 0.13.2
- [Release notes](https://github.com/gyscos/zstd-rs/releases)
- [Commits](https://github.com/gyscos/zstd-rs/compare/v0.13.1...v0.13.2)

---
updated-dependencies:
- dependency-name: windows
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: zstd
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-06 02:06:54 +00:00
github-actions[bot]
bda3c7568b
dep: Upgrade transitive dependencies (#1807)
Co-authored-by: github-actions <github-actions@github.com>
2024-07-05 04:47:12 +00:00
github-actions[bot]
a39cf031f9
dep: Upgrade transitive dependencies (#1802)
Co-authored-by: github-actions <github-actions@github.com>
2024-06-28 03:40:06 +00:00
github-actions[bot]
76814e4e8f
release: cargo-binstall v1.7.3 (#1799)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-23 14:46:16 +00:00
github-actions[bot]
3236512293
release: binstalk v0.26.1 (#1798)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-23 13:17:55 +00:00
github-actions[bot]
27e3b2672d
release: binstalk-fetchers v0.7.1 (#1797)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-23 12:14:44 +00:00
Jiahao XU
ac7bac651d
Run artifact discover in sequential instead of in parallel (#1796)
* Perform artifact discovery in sequential

Run different `fetcher.find()` in sequential

* FuturesResolver: Fallback to other future if one error

* Fix typo

* Apply cargo fmt

* Parallelise `<QuickInstall as Fetcher>::find`

Check for signature in parallel to the package

* Download signature in `<QuickInstall as Fetcher>::find`

So that the signature download can be done in parallel.

* Bump msrv for binstalk-fetchers to 1.70

* Update crates/binstalk-fetchers/src/futures_resolver.rs

Co-authored-by: Félix Saparelli <felix@passcod.name>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>

* cargo fmt

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Félix Saparelli <felix@passcod.name>
2024-06-23 10:42:03 +00:00
github-actions[bot]
ebdca1126e
dep: Upgrade transitive dependencies (#1794)
Co-authored-by: github-actions <github-actions@github.com>
2024-06-21 03:53:44 +00:00
github-actions[bot]
c8fc23b4b5
release: cargo-binstall v1.7.2 (#1792)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-20 10:40:44 +00:00
Jiahao XU
1b21c1d468
Include instruction to install using homebrew (#1793)
* Include instruction to install using homebrew

cargo-binstall is now in homebrew-core, so update our REAMDE to reflect that!

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update README.md

 - Fix typo
 - Add link to homebrew

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-20 10:12:26 +00:00
github-actions[bot]
77565d8e40
release: binstalk v0.26.0 (#1791)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-20 00:30:15 +00:00
Jiahao XU
050c337da1
Fix typo in release-pr.yml inputs (#1790)
Stupid mistakes introduced in #1789

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-19 14:29:09 +00:00
Jiahao XU
45b25fede5
CI: Allow semver-check in release-pr.yml to be disabled via inputs (#1789)
In case buliding of previous version fail due to new releases in upstream.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-19 14:07:23 +00:00
dependabot[bot]
c49072c565
build(deps): bump cargo-bins/release-pr from 2.1.2 to 2.1.3 (#1788)
Bumps [cargo-bins/release-pr](https://github.com/cargo-bins/release-pr) from 2.1.2 to 2.1.3.
- [Release notes](https://github.com/cargo-bins/release-pr/releases)
- [Commits](https://github.com/cargo-bins/release-pr/compare/v2.1.2...v2.1.3)

---
updated-dependencies:
- dependency-name: cargo-bins/release-pr
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-19 13:15:52 +00:00
Jiahao XU
374fc45b61
Bump cargo-bins/release-pr from 2.1.1 to 2.1.2 (#1787)
To reduce action output

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-19 08:48:47 +00:00
github-actions[bot]
9fdd1ad32a
release: binstalk-fetchers v0.7.0 (#1786)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-19 08:03:02 +00:00
github-actions[bot]
384789d1c9
release: binstalk-git-repo-api v0.3.0 (#1785)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-18 14:44:56 +00:00
github-actions[bot]
4bd5e79115
release: binstalk-downloader v0.11.5 (#1784)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-18 14:21:59 +00:00
Jiahao XU
ef7ca1ba9f
Re enable h3 in reqwest and remove impl Sync on returned Future in binstalk-git-repo-api (#1783)
* Upgrade transitive dependencies

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Re-enable h3

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `binstalk-git-repo-api`

Remove `Sync` bound on returned `Future`, since `tokio::spawn` does not require it

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-18 13:30:23 +00:00
Jiahao XU
fc1117d0e4
Disable use of lld (#1782)
* Update justfile to use lld on macOS and Linux

When cargo-zigbuild is not used

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Delete .cargo/config.toml

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update justfile to use lld as long as cargo-zigbuild isn't used

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Disable lld again

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-18 11:58:51 +00:00
github-actions[bot]
ee16116583
release: binstalk-downloader v0.11.4 (#1777)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-15 16:05:37 +00:00
Jiahao XU
3505b6ae5b
Fix docs.rs build of binstalk-downloader (#1776)
Fixed docs.rs build

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-15 15:39:14 +00:00
Jiahao XU
b9e8267cec
Speedup Linux CI (#1775)
* Speedup Linux CI

Use transparent huge page, according to https://kobzol.github.io/rust/rustc/2023/10/21/make-rust-compiler-5percent-faster.html it gives a nice 5% speedup

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix action.yml

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-15 15:08:25 +00:00
github-actions[bot]
0d7080e6a9
release: cargo-binstall v1.7.1 (#1774)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-15 07:27:29 +00:00
github-actions[bot]
6ed611c66e
release: binstalk v0.25.0 (#1773)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-15 07:00:10 +00:00
github-actions[bot]
08f66b0083
release: binstalk-fetchers v0.6.0 (#1772)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-15 06:36:08 +00:00
github-actions[bot]
ed31bc17e5
release: binstalk-git-repo-api v0.2.0 (#1771)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-15 06:02:41 +00:00
Jiahao XU
fff6aa8122
Improve use of github token (#1769)
* Add new dep zeroize

* Use Zeroizing to avoid leaking the token

* Optimize gh-auth-token

Spawn it as a task, and only await it
when using GhApiClient

* Fix binstalk-git-repo-api unit tests
2024-06-15 05:42:09 +00:00
Jiahao XU
e3c8c40806
Run ci.yml every Monday (#1767)
Just to keep the cache hot while making sure cargo-binstall can compile on latest stable/nightly rust

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-15 01:32:07 +00:00
github-actions[bot]
9891eac34c
release: cargo-binstall v1.7.0 (#1765)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-15 00:27:27 +00:00
Jiahao XU
59ba0cb92a
Speedup compilation on windows (#1766)
* Speedup compilation on windows

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Speedup CI on macOS

Use lld

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-15 00:02:21 +00:00
Jiahao XU
07dd868fa6
Fix release-dry-run (#1764)
Dry run publish in merge_queue CI for release PR

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-14 13:36:31 +00:00
Jiahao XU
4c68c80ab8
Add env var BINSTALL_NO_DISCOVER_GITHUB_TOKEN (#1763)
* Add env var BINSTALL_NO_DISCOVER_GITHUB_TOKEN

For #1733

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix fmt

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix fmt

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-14 13:21:14 +00:00
github-actions[bot]
5c9a7b2c80
release: binstalk v0.24.1 (#1762)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-14 13:12:01 +00:00
github-actions[bot]
b71b3ce472
release: binstalk-downloader v0.11.3 (#1759)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-14 12:38:01 +00:00
Jiahao XU
540fa79c6b
CI: Fix publish (#1760)
* Fix publish in release-cli.yml

Using latest stable rust

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix publish in release.yml

Use latest stable rust

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Run release-dry-run in merge queue only

Running it twice on PR pipeline and merge queue pipeline only wastes time and causes rate limit.

For PR that modifies release-dry-run and wants to test it, they can temporarily run release-dry-run on PR pipeline.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-14 11:33:20 +00:00
Jiahao XU
610504957f
Fix release-pr.yml (#1758)
Always use latest stable rust

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-14 10:25:13 +00:00
github-actions[bot]
77b0b68ea9
release: binstalk-registry v0.9.1 (#1756)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-14 10:04:28 +00:00
Jiahao XU
475fd61cd7
Do not run ci.yml on push to main (#1757)
All commits should be submit via PR, and merge_queue already run ci.yml, with up-to-date source code.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-14 09:29:41 +00:00
github-actions[bot]
d3cd0a2ad4
release: binstalk-fetchers v0.5.1 (#1755)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-14 08:13:57 +00:00
Jiahao XU
34cca9f415
Use io::Error::downcast in 1.79 (#1754)
* Bump msrv of binstalk-downloader, binstalk and cargo-binstall to 1.79

* Update From<io::Error> for DownloadError

to use io::Error::downcast

* Update From<io::Error> for BinstallError

* fix dmt
2024-06-14 08:00:53 +00:00
Tomas Olvecky
dfa230f039
Use binary name when searching for artifacts (#1747)
* Use binary name when searching for artifacts

When there is a single binary declared in the manifest and
it differs from the package name, add it to the list of handles
used for pre-built artifact fetching.

* Simplify `binary_name` assignment with a `match`

* Add e2e test

* Only attempt to use the binary name with `GhCrateMeta` fetcher

* Avoid too much over-allocating.

Technically it should also check if gh-crate-meta resolver is enabled, but it is unlikely for it to be disabled and overallocating for extra n-target should be fine, it is an improvement over doubling the space allocated if the binary_name is Some.

* Fix fmt in crates/binstalk/src/ops/resolve.rs

---------

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-14 04:52:37 +00:00
github-actions[bot]
a220952fd6
dep: Upgrade transitive dependencies (#1753)
Co-authored-by: github-actions <github-actions@github.com>
2024-06-14 03:46:47 +00:00
Jiahao XU
bb1e2cf363
Fix missing ' upgrade-transitive-deps.yml (#1752) 2024-06-14 03:28:11 +00:00
Jiahao XU
45d96a5b13
Fix install-from-binstall-release.sh (#1751)
Fixed #1750
2024-06-14 00:55:06 +00:00
Jiahao XU
ba0e752b9c
Fix upgrade-transitive-deps.yml (#1749)
Fix use of gh-pr-create
2024-06-13 14:24:09 +00:00
Jiahao XU
05f488322e
Add cargo-binstall installation path to GITHUB_PATH (#1748)
* Add cargo-binstall installation path to GITHUB_PATH in install-from-binstall-release.sh

Fixed #1714

* Add cargo-binstall installation path to GITHUB_PATH in install-from-binstall-release.ps1

* Update install-script.yml to test

* Fix use of env var in install-from-binstall-release.ps1
2024-06-13 13:43:39 +00:00
github-actions[bot]
9a270f03b6
release: binstalk v0.24.0 (#1743)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-13 11:41:33 +00:00
Jiahao XU
cd85622b13
Improve gh token auto scraping (#1746)
* Log the gh-auth token retrieval failure on debug level

Fixed #1733

* Make gh_token::get an async function

* Improve returned err msg in gh_token::get

* Update use of gh_token::get() in entry.rs

* Fix typos

* Fix unclosed ()

* Fix unclosed ()

* Fix gh_token.rs

* Fix entry.rs

* Fix fmt in entry.rs

* Fix fmt in gh_token.rs

* Fix fmt in gh_token.rs

* Fix fmt in gh_token.rs

* Fix fmt in entry.rs
2024-06-13 10:50:47 +00:00
Jiahao XU
22217acc51
Fix job changed-files ci.yml (#1745)
Fix sed expression
2024-06-13 10:19:00 +00:00
Jiahao XU
d524db3784
Fix ci and improve efficiency (#1744)
* Fix job changed-file in ci.yml

* Do not run job e2e-tests on PR

which might not have access to GitHub Token in secrets, if opened by non-maintainer

* Provide GITHUB_TOKEN fallback if the secrets is not accessible

* Fix regex expression passed to sed
2024-06-13 09:32:38 +00:00
Remo Senekowitsch
250814f530
fix(resolve): prefer official binaries (#1741)
* prefer official binaries with secondary targets over quickinstall binaries

* chore(test): add jj-cli to live e2e test
2024-06-13 18:26:30 +10:00
Jiahao XU
38f8eb4b1a
Fix passing GITHUB_TOKEN in ci.yml (#1742)
Fix CI
2024-06-13 18:10:23 +10:00
github-actions[bot]
734906d5fd
release: binstalk-git-repo-api v0.1.1 (#1740)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-13 03:41:38 +00:00
github-actions[bot]
f567e3bd9e
release: binstalk-downloader v0.11.2 (#1739)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-13 02:54:38 +00:00
github-actions[bot]
66f303393f
release: binstalk-registry v0.9.0 (#1736)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-13 00:30:42 +00:00
github-actions[bot]
07c8dd7e8a
release: binstalk-fetchers v0.5.0 (#1735)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-12 21:26:20 +00:00
Jiahao XU
e334e3153a
Compile all tests in justfile target unit-tests
To make sure all code is valid.

And to improve caching of CI job unit-tests.
2024-06-13 00:37:19 +10:00
Jiahao XU
4687726c66
Improve derbugg logging (#1738)
* Improve derbugg logging

Make it more readable

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix excessive logging

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-13 00:25:24 +10:00
Jiahao XU
a2d2c5d85c
Disable e2e-tests on x86_64h-apple-darwin
macos-14-arm64 cannot execute executable built for x86_64h
2024-06-13 00:17:30 +10:00
Jiahao XU
60a194be90
Improve ci (#1737)
* Run e2e-test on x86_64h-apple-darwin

Since it is a target built with `build-std`, we need to make sure it is
runnable.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `upgrade-transitive-deps`

Fill in PR description, so that reviewer can just re-open it to run the CI.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-13 00:03:27 +10:00
github-actions[bot]
49d0bb71a0
dep: Upgrade transitive dependencies (#1734)
Co-authored-by: github-actions <github-actions@github.com>
2024-06-12 13:02:02 +00:00
github-actions[bot]
8fe7b92631
release: binstalk-git-repo-api v0.1.0 (#1728)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-12 11:31:53 +00:00
Jiahao XU
7941387b73
Fix job changed-files (#1732)
* Fix job `changed-files`

Convert `ALL_CHANGED_FILES` to multiple lines before processing

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Run e2e-tests and unit-tests on aarch64-apple-darwin

Since the CI now uses M1 instead of x86_64, built a native executable
instead of relying on rosetta

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Run unit-tests on Linux-only

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-12 20:56:59 +10:00
Jiahao XU
6622bf1ae3
Speedup binstalk-git-repo-api unit testing (#1731)
* Share `remote::Client` between tests when in cargo-test

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Run rate-limited binstalk-git-repo-api test in serial

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update client-side rate limit to 1 request per 300ms

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Reduce test cases in `rate_limited_test_has_release_artifact_and_download_artifacts`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add `cargo-nextest` that I forgot

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix unit testing: Pass auth-token to restful API

to avoid rate limit

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-12 20:34:50 +10:00
Jiahao XU
4d7a91aa4c
Fix job changed-files in ci.yml (#1730)
* Fix job changed-files in ci.yml

When there are multiple crates, it would be in multiple lines, breaking github output

* Fix job changed-files in ci.yml

When no crate is changed, command cut will fail.

* Fix job unit-tests in ci.yml

If noo crate is changed, do not run cargo-nextest.

* Fix ci.yml syntax
2024-06-12 19:47:41 +10:00
Jiahao XU
2feac66e14
Speedup ci: Only run tests on change (#1729)
* Fix unit test for `GhApiClient`

Set client-side rate limit to 1 request per 200 ms

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Only run `detect-targets` test if changed

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Only run unit tests for crates that are changed

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix job `changed-files`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix job `changed-files`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix shell error in job `changed-files`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* FIx separator for `changed-files`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix passning of craetes to run

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix passing of `CARGO_NEXTEST_ADDITIONAL_ARGS`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix deciding which crates to test on windows

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix just recipe `unit-tests`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Split test into two jobs

so that they will have they own cache (since different feature flags are used).

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-12 12:29:16 +10:00
github-actions[bot]
9a0367b3ec
release: binstalk-downloader v0.11.1 (#1726)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-11 13:31:35 +00:00
Jiahao XU
238e0f6318
Fix rate limit checking in GhApiClient (#1725)
* Fix rate limit checking in `GhApiClient`

 - Mv logic into `binstalk_downloader`
 - Check for `RETRY_AFTER` and `x-ratelimit-remaining` on any status code

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix clippy lint

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-11 22:37:48 +10:00
Jiahao XU
3aae883467
Speedup ci (#1724)
* Optimize binstalk-git-repo-api

Use a dedicated github token in CI

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Speedup CI using `cargo-nextest`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix release profile override on Windows

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Optimize unit test in binstalk-registry

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Use `secrets.CI_RELEASE_TEST_GITHUB_TOKEN` for just-setup

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix unit testing in justfile

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add retry on rate limit in unit testing

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Only use `CI_UNIT_TEST_GITHUB_TOKEN` in unit testing

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `test_get_repo_info`: Retry on rate limit

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `test_has_release_artifact_and_download_artifacts`

Retry on rate limit

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-11 00:12:44 +10:00
Jiahao XU
52f172c713
Fix binstalk_fetchers::FetchError definition (#1711)
Rm useless cfg on it
2024-06-10 12:17:45 +00:00
github-actions[bot]
5bcc243741
release: binstalk-downloader v0.11.0 (#1722)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-10 08:11:05 +00:00
Jiahao XU
1dbd2460a3
Support private github repository (#1690)
* Refactor: Create new crate binstalk-git-repo-api

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix CI lint warnings

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `just check`: Rm deleted features from `cargo-hack` check

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Extract  new mod error

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Ret artifact url in `has_release_artifact`

So that we can use it to download from private repositories.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Move `test_graph_ql_error_type` to mod `error`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix running `cargo test` in `binstalk-git-repo-api``

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Remove unnecessary import in mod `error::test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rename mod `request`` to `release_artifacts`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Impl draft version of fetching repo info

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Move `HasReleaseArtifacts` failure variants into `GhApiError`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Use `GhRepo` in `GhRelease`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix testing

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Return `'static` future

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Make sure `'static` Future is returned

To make it easier to create generic function

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add logging to unit testing

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix unit testing

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Extract new fn `GhApiClient::do_fetch`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rm unused `percent_encode_http_url_path`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `cargo test` run on CI

`cargo test` run all tests in one process.

As such, `set_global_default` would fail on the second call.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Optimize `GhApiClient::do_fetch`: Avoid unnecessary restful API call

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Rm param `auth_token` for restful API fn

which is always set to `None`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Impl new API `GhApiClient::get_repo_info`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix unit test for `GhApiClient::get_repo_info`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor testing: Parameter-ize testing

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Parallelise `test_get_repo_info`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Create parameter-ised `test_has_release_artifact`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Parallelize `test_has_release_artifact`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: `gh_api_client::test::create_client` shall not be `async`

as there is no `.await` in it.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Return `Url` in `GhApiClient::has_release_artifact`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Impl new API `GhApiClient::download_artifact`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Remove unused deps added to binstalk-git-repo-api

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix clippy lints

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add new API `GhApiClient::remote_client`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add `GhApiClient::has_gh_token`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add `GhRepo::try_extract_from_url`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rename `ReleaseArtifactUrl` to `GhReleaseArtifactUrl`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add new fn `Download::with_data_verifier`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* feature: Support private repository

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix clippy lints

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add e2e-test/private-github-repo

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix clippy lints

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `launch_baseline_find_tasks`: Retry on rate limit

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix test failure: Retry on rate limit

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Temporarily enable debug output for e2e-test-private-github-repo

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `get_repo_info`: Retry on rate limit

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Improve `debug!` logging

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add more debug logging

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add more debugging

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add more debug logging

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Apply suggestions from code review

* Fix compilation

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix cargo fmt

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add crate binstalk-git-repo-api to release-pr.yml

* Update crates/binstalk-git-repo-api/Cargo.toml

* Apply suggestions from code review

* Update crates/binstalk/Cargo.toml

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-10 06:02:12 +00:00
github-actions[bot]
48ee0b0e3e
release: cargo-binstall v1.6.9 (#1719)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-08 06:00:33 +00:00
github-actions[bot]
02dbe21500
release: atomic-file-install v1.0.4 (#1718)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-06-08 03:41:59 +00:00
github-actions[bot]
bd058392bb
dep: Upgrade transitive dependencies (#1717)
Co-authored-by: github-actions <github-actions@github.com>
2024-06-08 02:46:07 +00:00
dependabot[bot]
ed173e2b5f
build(deps): bump windows from 0.56.0 to 0.57.0 in the deps group (#1716)
Bumps the deps group with 1 update: [windows](https://github.com/microsoft/windows-rs).


Updates `windows` from 0.56.0 to 0.57.0
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.56.0...0.57.0)

---
updated-dependencies:
- dependency-name: windows
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-08 01:31:46 +00:00
github-actions[bot]
dc229e7fc7
dep: Upgrade transitive dependencies (#1715)
Co-authored-by: github-actions <github-actions@github.com>
2024-06-07 03:51:09 +00:00
github-actions[bot]
734c24b926
dep: Upgrade transitive dependencies (#1713)
Co-authored-by: github-actions <github-actions@github.com>
2024-05-31 09:19:59 +00:00
github-actions[bot]
2d221debd8
release: cargo-binstall v1.6.8 (#1710)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-25 01:39:17 +00:00
github-actions[bot]
88b4dd4e65
dep: Upgrade transitive dependencies (#1709)
Co-authored-by: github-actions <github-actions@github.com>
2024-05-24 08:40:07 +00:00
github-actions[bot]
4545b16e0b
release: cargo-binstall v1.6.7 (#1707)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-18 06:13:50 +00:00
github-actions[bot]
6cede2e8dc
release: binstalk v0.23.1 (#1706)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-18 05:20:48 +00:00
github-actions[bot]
abc0dbee67
release: binstalk-fetchers v0.4.1 (#1705)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-18 04:23:54 +00:00
dependabot[bot]
45307909c3
build(deps): bump the deps group with 2 updates (#1704)
Bumps the deps group with 2 updates: [itertools](https://github.com/rust-itertools/itertools) and [thiserror](https://github.com/dtolnay/thiserror).


Updates `itertools` from 0.12.1 to 0.13.0
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-itertools/itertools/compare/v0.12.1...v0.13.0)

Updates `thiserror` from 1.0.60 to 1.0.61
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.60...1.0.61)

---
updated-dependencies:
- dependency-name: itertools
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-18 03:28:12 +00:00
github-actions[bot]
ec08340fc3
dep: Upgrade transitive dependencies (#1703)
Co-authored-by: github-actions <github-actions@github.com>
2024-05-17 09:03:37 +00:00
github-actions[bot]
496eda8439
release: cargo-binstall v1.6.6 (#1697)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-11 03:35:50 +00:00
dependabot[bot]
e74127b04e
build(deps): bump file-format from 0.24.0 to 0.25.0 in the deps group (#1696)
Bumps the deps group with 1 update: [file-format](https://github.com/mmalecot/file-format).


Updates `file-format` from 0.24.0 to 0.25.0
- [Release notes](https://github.com/mmalecot/file-format/releases)
- [Changelog](https://github.com/mmalecot/file-format/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mmalecot/file-format/compare/v0.24.0...v0.25.0)

---
updated-dependencies:
- dependency-name: file-format
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-11 01:43:39 +00:00
github-actions[bot]
331e0efb51
dep: Upgrade transitive dependencies (#1695)
Co-authored-by: github-actions <github-actions@github.com>
2024-05-10 03:38:43 +00:00
github-actions[bot]
dfdaf6952e
release: cargo-binstall v1.6.5 (#1686)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-03 08:19:06 +00:00
github-actions[bot]
25a21830cc
dep: Upgrade transitive dependencies (#1685)
Co-authored-by: github-actions <github-actions@github.com>
2024-05-03 05:43:23 +00:00
github-actions[bot]
11f5feac08
release: binstalk v0.23.0 (#1678)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-03 02:07:00 +00:00
github-actions[bot]
27bc4a2d2a
release: detect-targets v0.1.17 (#1682)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-03 00:29:20 +00:00
github-actions[bot]
bf077e1e3a
release: binstalk-downloader v0.10.3 (#1684)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-03 00:19:19 +00:00
Jiahao XU
2d856bf1c0
Speedup ci by using personal access token for testing (#1680)
* Use secrets,CI_TEST_GITHUB_TOKEN for testing in ci.yml

* Run e2e-test in release-packages.yml using secrets.CI_TEST_GITHUB_TOKEN

* Use CI_RELEASE_TEST_GITHUB_TOKEN in e2e-test in release-packages.yml
2024-05-02 23:44:23 +00:00
Jiahao XU
6ef3b665f4
Fix clippy lint error in 1.78.0 (#1679)
* Bump msrv of binstalk-downloader to 1.70.0

* Fix trait bound in multiple places

for copy_file_to_mpsc

* Rm super-trait trait bounds for FusedStream

* Bump detect-targets msrv to 1.62.0

* Bump cargo-binstall msrv to 1.70.0
2024-05-02 23:03:12 +00:00
github-actions[bot]
aaaa2b1387
release: atomic-file-install v1.0.3 (#1673)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-02 12:06:53 +00:00
github-actions[bot]
ce5f37738f
release: binstalk-registry v0.8.0 (#1677)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-02 11:15:21 +00:00
github-actions[bot]
a9fad9fce4
release: cargo-toml-workspace v6.0.0 (#1676)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-02 10:22:24 +00:00
github-actions[bot]
d515e11a8b
release: binstalk-downloader v0.10.2 (#1675)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-02 09:08:24 +00:00
github-actions[bot]
65a3c2c918
release: detect-targets v0.1.16 (#1674)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-05-02 09:02:44 +00:00
Jiahao XU
3198712328
Bump release-pr to v2.1.1 (#1672) 2024-05-02 05:27:20 +00:00
github-actions[bot]
ecd8942897
dep: Upgrade transitive dependencies (#1670)
Co-authored-by: github-actions <github-actions@github.com>
2024-04-26 03:31:43 +00:00
Jiahao XU
fda8cac41a
Bump reqwest to 0.12.4 and enable feature zstd (#1667)
to support compression using zstd.

Also enable `http2` (which is now enabled by other deps of this crate).

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-04-24 07:32:39 +00:00
dependabot[bot]
55024b0771
build(deps): bump the deps group with 2 updates (#1664)
Bumps the deps group with 2 updates: [toml_edit](https://github.com/toml-rs/toml) and [cargo_toml](https://gitlab.com/lib.rs/cargo_toml).


Updates `toml_edit` from 0.22.11 to 0.22.12
- [Commits](https://github.com/toml-rs/toml/compare/v0.22.11...v0.22.12)

Updates `cargo_toml` from 0.19.2 to 0.20.0
- [Commits](https://gitlab.com/lib.rs/cargo_toml/compare/v0.19.2...v0.20.0)

---
updated-dependencies:
- dependency-name: toml_edit
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: cargo_toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-20 02:12:40 +00:00
dependabot[bot]
f45dd80b4d
build(deps): bump rustls from 0.21.10 to 0.21.11 (#1663)
Bumps [rustls](https://github.com/rustls/rustls) from 0.21.10 to 0.21.11.
- [Release notes](https://github.com/rustls/rustls/releases)
- [Changelog](https://github.com/rustls/rustls/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustls/rustls/compare/v/0.21.10...v/0.21.11)

---
updated-dependencies:
- dependency-name: rustls
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-20 01:54:12 +00:00
github-actions[bot]
6476c3bdd9
dep: Upgrade transitive dependencies (#1662)
Co-authored-by: github-actions <github-actions@github.com>
2024-04-19 03:32:40 +00:00
dependabot[bot]
479dd07d14
build(deps): bump the deps group with 2 updates (#1661)
Bumps the deps group with 2 updates: [windows](https://github.com/microsoft/windows-rs) and [either](https://github.com/rayon-rs/either).


Updates `windows` from 0.54.0 to 0.56.0
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.54.0...0.56.0)

Updates `either` from 1.10.0 to 1.11.0
- [Commits](https://github.com/rayon-rs/either/compare/1.10.0...1.11.0)

---
updated-dependencies:
- dependency-name: windows
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: either
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-13 01:38:03 +00:00
github-actions[bot]
9ca98efb51
dep: Upgrade transitive dependencies (#1660)
Co-authored-by: github-actions <github-actions@github.com>
2024-04-12 03:47:18 +00:00
dependabot[bot]
f1b7cd4430
build(deps): bump async_zip from 0.0.16 to 0.0.17 in the deps group (#1659)
* build(deps): bump async_zip from 0.0.16 to 0.0.17 in the deps group

Bumps the deps group with 1 update: [async_zip](https://github.com/Majored/rs-async-zip).


Updates `async_zip` from 0.0.16 to 0.0.17
- [Release notes](https://github.com/Majored/rs-async-zip/releases)
- [Commits](https://github.com/Majored/rs-async-zip/compare/v0.0.16...v0.0.17)

---
updated-dependencies:
- dependency-name: async_zip
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix `extract_zip_entry` generic bound

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-04-06 03:38:11 +00:00
Jiahao XU
fe2a4d8b0c
Remove dep windows-dll and replace it with manual loading (#1658)
Fixed #1629

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-04-06 02:08:10 +00:00
github-actions[bot]
48039ed739
dep: Upgrade transitive dependencies (#1656)
Co-authored-by: github-actions <github-actions@github.com>
2024-04-05 07:44:33 +00:00
Jiahao XU
397fa7200f
Bump dep reqwest in binstalk-downloader from 0.11.26 to 0.12.0 (#1655)
* Bump dep reqwest in binstalk-downloader from 0.11.26 to 0.12.0

reqwest 0.11.27 is still used in gix, but it will be upgraded in
next gix release.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix feature selection: Forward tls feature to `simple-git`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-04-02 21:26:39 +00:00
github-actions[bot]
8de3ec8fb7
dep: Upgrade transitive dependencies (#1654)
Co-authored-by: github-actions <github-actions@github.com>
2024-03-29 08:58:04 +00:00
github-actions[bot]
d76e2d8d77
dep: Upgrade transitive dependencies (#1651)
* dep: Upgrade transitive dependencies

* Apply clippy suggestions

* Apply clippy suggestion

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-03-22 05:24:21 +00:00
dependabot[bot]
0e9e505697
build(deps): bump geekyeggo/delete-artifact from 4 to 5 (#1650)
Bumps [geekyeggo/delete-artifact](https://github.com/geekyeggo/delete-artifact) from 4 to 5.
- [Release notes](https://github.com/geekyeggo/delete-artifact/releases)
- [Changelog](https://github.com/GeekyEggo/delete-artifact/blob/main/CHANGELOG.md)
- [Commits](https://github.com/geekyeggo/delete-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: geekyeggo/delete-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-19 07:47:44 +00:00
dependabot[bot]
69a701d12e
build(deps): bump the deps group with 2 updates (#1649)
Bumps the deps group with 2 updates: [clap](https://github.com/clap-rs/clap) and [simple-git](https://github.com/cargo-bins/simple-git).


Updates `clap` from 4.5.2 to 4.5.3
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.5.2...v4.5.3)

Updates `simple-git` from 0.2.3 to 0.2.4
- [Release notes](https://github.com/cargo-bins/simple-git/releases)
- [Commits](https://github.com/cargo-bins/simple-git/commits/0.2.4)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: simple-git
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-16 01:54:37 +00:00
github-actions[bot]
6b95a97e15
dep: Upgrade transitive dependencies (#1647)
Co-authored-by: github-actions <github-actions@github.com>
2024-03-15 09:26:01 +00:00
dependabot[bot]
cf2473129b
build(deps): bump mathieudutour/github-tag-action from 6.1 to 6.2 (#1646)
Bumps [mathieudutour/github-tag-action](https://github.com/mathieudutour/github-tag-action) from 6.1 to 6.2.
- [Release notes](https://github.com/mathieudutour/github-tag-action/releases)
- [Commits](https://github.com/mathieudutour/github-tag-action/compare/v6.1...v6.2)

---
updated-dependencies:
- dependency-name: mathieudutour/github-tag-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-12 02:11:47 +00:00
github-actions[bot]
be2934e283
release: cargo-binstall v1.6.4 (#1645)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-03-09 05:28:33 +00:00
github-actions[bot]
6d3dcadfee
release: fs-lock v0.1.3 (#1642)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-03-09 03:33:53 +00:00
github-actions[bot]
3d2f72a8c5
release: atomic-file-install v1.0.2 (#1643)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-03-09 03:33:48 +00:00
github-actions[bot]
a5e534224c
release: binstalk-downloader v0.10.1 (#1644)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-03-09 03:33:43 +00:00
dependabot[bot]
fda8f98cdf
build(deps): bump the deps group with 2 updates (#1641)
Bumps the deps group with 2 updates: [reqwest](https://github.com/seanmonstar/reqwest) and [fs4](https://github.com/al8n/fs4-rs).


Updates `reqwest` from 0.11.24 to 0.11.25
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.24...v0.11.25)

Updates `fs4` from 0.8.0 to 0.8.1
- [Release notes](https://github.com/al8n/fs4-rs/releases)
- [Commits](https://github.com/al8n/fs4-rs/commits)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: fs4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-09 01:55:36 +00:00
github-actions[bot]
91cf432f87
dep: Upgrade transitive dependencies (#1640)
Co-authored-by: github-actions <github-actions@github.com>
2024-03-08 03:33:12 +00:00
dependabot[bot]
70a90ecb27
build(deps): bump mio from 0.8.10 to 0.8.11 (#1639)
Bumps [mio](https://github.com/tokio-rs/mio) from 0.8.10 to 0.8.11.
- [Release notes](https://github.com/tokio-rs/mio/releases)
- [Changelog](https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/mio/compare/v0.8.10...v0.8.11)

---
updated-dependencies:
- dependency-name: mio
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-04 23:34:13 +00:00
dependabot[bot]
1fd99af959
build(deps): bump the deps group with 3 updates (#1637)
Bumps the deps group with 3 updates: [reflink-copy](https://github.com/cargo-bins/reflink-copy), [windows](https://github.com/microsoft/windows-rs) and [fs4](https://github.com/al8n/fs4-rs).


Updates `reflink-copy` from 0.1.14 to 0.1.15
- [Release notes](https://github.com/cargo-bins/reflink-copy/releases)
- [Commits](https://github.com/cargo-bins/reflink-copy/compare/0.1.14...0.1.15)

Updates `windows` from 0.53.0 to 0.54.0
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.53.0...0.54.0)

Updates `fs4` from 0.7.0 to 0.8.0
- [Release notes](https://github.com/al8n/fs4-rs/releases)
- [Commits](https://github.com/al8n/fs4-rs/commits)

---
updated-dependencies:
- dependency-name: reflink-copy
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: windows
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: fs4
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-02 04:11:52 +00:00
github-actions[bot]
130021ca5f
dep: Upgrade transitive dependencies (#1636)
Co-authored-by: github-actions <github-actions@github.com>
2024-03-01 06:17:19 +00:00
dependabot[bot]
5dea671585
build(deps): bump the deps group with 2 updates (#1633)
Bumps the deps group with 2 updates: [windows](https://github.com/microsoft/windows-rs) and [default-net](https://github.com/shellrow/default-net).


Updates `windows` from 0.52.0 to 0.53.0
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.52.0...0.53.0)

Updates `default-net` from 0.21.0 to 0.22.0
- [Release notes](https://github.com/shellrow/default-net/releases)
- [Commits](https://github.com/shellrow/default-net/compare/v0.21.0...v0.22.0)

---
updated-dependencies:
- dependency-name: windows
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: default-net
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-24 01:58:35 +00:00
github-actions[bot]
fbb49b4eb6
dep: Upgrade transitive dependencies (#1630)
* dep: Upgrade transitive dependencies

* CI: Use make 4.4.1 on macOS

Siuce cc 1.0.86 only works with make >=4.3

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* CI: Bump actions/cache to v4

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* CI: Fix copying of make compilation bash code

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* CI: Fix make compilation

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* CI: Speedup make compilation

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix CI: Add missing `shell`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* CI: FIx parallism for compiling make

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-02-23 13:03:58 +00:00
Ilkka Poutanen
6dd4a155fb
Typo fix (#1631) 2024-02-23 11:21:05 +00:00
Jiahao XU
1928e2ccb3
Refactor: Mv leon and leon-macros into another repo (#1628)
* Refactor: Mv leon and leon-macros into another repo

It's moved to https://github.com/cargo-bins/leon

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix CI: Rm `cargo-hack` check for `leon`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-02-20 13:16:47 +00:00
github-actions[bot]
2d29534754
dep: Upgrade transitive dependencies (#1625)
Co-authored-by: github-actions <github-actions@github.com>
2024-02-16 08:49:43 +00:00
github-actions[bot]
0c219ebf51
release: cargo-binstall v1.6.3 (#1624)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-13 09:05:03 +00:00
github-actions[bot]
4c9cff3365
dep: Upgrade transitive dependencies (#1623)
Co-authored-by: github-actions <github-actions@github.com>
2024-02-13 07:59:52 +00:00
github-actions[bot]
83442b013e
release: binstalk v0.22.0 (#1622)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-13 07:14:29 +00:00
github-actions[bot]
22dabf1497
release: binstalk-registry v0.7.0 (#1620)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-12 13:17:36 +00:00
github-actions[bot]
1c95c73a38
release: binstalk-manifests v0.13.0 (#1619)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-12 12:24:16 +00:00
github-actions[bot]
1d783172e3
release: binstalk-fetchers v0.4.0 (#1618)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-12 11:20:24 +00:00
github-actions[bot]
4cde7f075d
release: binstalk-bins v0.4.0 (#1617)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-12 10:27:28 +00:00
github-actions[bot]
e8934cdc8a
release: leon-macros v1.0.1 (#1616)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-12 09:50:11 +00:00
Jiahao XU
add9310d5e
Fix release-pr.yml: Do not run semver-checks for leon-macros (#1614)
leon-macros is a proc-macro crate and cargo-semver-checks cannot perform semver checks on proc-macro crates.
2024-02-12 07:14:02 +00:00
github-actions[bot]
5a8af0fb99
release: leon v3.0.0 (#1613)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-12 04:31:10 +00:00
dependabot[bot]
42215f774a
build(deps): bump the deps group with 5 updates (#1612)
* build(deps): bump the deps group with 5 updates

Bumps the deps group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [file-format](https://github.com/mmalecot/file-format) | `0.23.0` | `0.24.0` |
| [miette](https://github.com/zkat/miette) | `5.10.0` | `7.0.0` |
| [supports-color](https://github.com/zkat/supports-color) | `2.1.0` | `3.0.0` |
| [simple-git](https://github.com/cargo-bins/simple-git) | `0.2.2` | `0.2.3` |
| [toml_edit](https://github.com/toml-rs/toml) | `0.21.1` | `0.22.4` |


Updates `file-format` from 0.23.0 to 0.24.0
- [Release notes](https://github.com/mmalecot/file-format/releases)
- [Changelog](https://github.com/mmalecot/file-format/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mmalecot/file-format/compare/v0.23.0...v0.24.0)

Updates `miette` from 5.10.0 to 7.0.0
- [Release notes](https://github.com/zkat/miette/releases)
- [Changelog](https://github.com/zkat/miette/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zkat/miette/compare/miette-derive-v5.10.0...miette-derive-v7.0.0)

Updates `supports-color` from 2.1.0 to 3.0.0
- [Release notes](https://github.com/zkat/supports-color/releases)
- [Changelog](https://github.com/zkat/supports-color/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zkat/supports-color/compare/v2.1.0...v3.0.0)

Updates `simple-git` from 0.2.2 to 0.2.3
- [Commits](https://github.com/cargo-bins/simple-git/commits)

Updates `toml_edit` from 0.21.1 to 0.22.4
- [Commits](https://github.com/toml-rs/toml/compare/v0.21.1...v0.22.4)

---
updated-dependencies:
- dependency-name: file-format
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: miette
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: deps
- dependency-name: supports-color
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: deps
- dependency-name: simple-git
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: toml_edit
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix compilation of `leon` when feature `cli` is enabled

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-02-11 12:55:47 +00:00
Jiahao XU
c450f442cb
Refactor: Move simple-git into a new repo (#1611)
Moved to https://github.com/cargo-bins/simple-git

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-02-09 05:38:28 +00:00
github-actions[bot]
8e29d416b4
dep: Upgrade transitive dependencies (#1610)
Co-authored-by: github-actions <github-actions@github.com>
2024-02-09 04:33:20 +00:00
github-actions[bot]
3f271cce2b
release: cargo-binstall v1.6.2 (#1608)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-04 01:50:56 +00:00
github-actions[bot]
76611ebef3
dep: Upgrade transitive dependencies (#1607)
Co-authored-by: github-actions <github-actions@github.com>
2024-02-03 21:37:12 +00:00
github-actions[bot]
1f49dcaa28
release: binstalk v0.21.0 (#1606)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-03 15:03:04 +00:00
github-actions[bot]
f8bb014705
release: binstalk-registry v0.6.0 (#1605)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-03 14:03:24 +00:00
github-actions[bot]
9e57c9cd71
release: binstalk-manifests v0.12.0 (#1602)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-03 12:59:58 +00:00
github-actions[bot]
290ebbb7e9
release: binstalk-bins v0.3.0 (#1603)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-03 11:55:48 +00:00
github-actions[bot]
3e52d2d0f4
release: binstalk-fetchers v0.3.0 (#1601)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-03 10:56:08 +00:00
github-actions[bot]
4ff5700c64
release: binstalk-downloader v0.10.0 (#1600)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-03 09:44:13 +00:00
github-actions[bot]
42f2eb834e
release: cargo-toml-workspace v5.0.0 (#1599)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-03 07:25:52 +00:00
github-actions[bot]
23a7890db2
release: binstalk-types v0.7.0 (#1598)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-02-03 03:52:00 +00:00
dependabot[bot]
923c317bd4
build(deps): bump the deps group with 3 updates (#1596)
Bumps the deps group with 3 updates: [strum](https://github.com/Peternator7/strum), [strum_macros](https://github.com/Peternator7/strum) and [cargo_toml](https://gitlab.com/lib.rs/cargo_toml).


Updates `strum` from 0.25.0 to 0.26.1
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits/v0.26.1)

Updates `strum_macros` from 0.25.3 to 0.26.1
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits/v0.26.1)

Updates `cargo_toml` from 0.18.0 to 0.19.1
- [Commits](https://gitlab.com/lib.rs/cargo_toml/commits/main)

---
updated-dependencies:
- dependency-name: strum
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: strum_macros
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: cargo_toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-03 02:47:42 +00:00
github-actions[bot]
c300d8cd35
dep: Upgrade transitive dependencies (#1593)
Co-authored-by: github-actions <github-actions@github.com>
2024-02-02 03:37:30 +00:00
Jiahao XU
6dc2a0a823
Fix: Load system-wide native cert on rustls (#1589)
* Fix: Load system-wide native cert on rustls

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update `Cargo.lock`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-01-31 14:28:34 +00:00
Jiahao XU
9cf7b15df8
CI: Use runner macos-14 which uses M1 machine (#1590)
* CI: Use runner `macos-14` which uses M1 machine

`macos-14` provides 3-core M1, 7G mem and 14G stroage, while `macos-latest`
(`macos-13` as of writing) provides 4-core intel, 14G mem and 14G
storage.

While the memory is cut by half and core count reduce by 1, I believe
that it would still speedup the CI since M1 is much more powerful than
previous Intel CPU used in `macos-13`.

It would also allow us to run tests on aarch64-apple-darwin and on
universal-apple-darwin, if necessary.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* CI: Fix `e2e-test-subcrate`: Bump `cargo-audit` ver to v0.18.3

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-01-31 14:26:57 +00:00
Jiahao XU
dba9dd5ff0
build(deps): bump actions/{up, down}load-artifact from 3 to 4 (#1591)
Revert "Revert "build(deps): bump actions/{up, down}load-artifact from 3 to 4…"

This reverts commit f5da25cc56.
2024-01-31 14:26:11 +00:00
github-actions[bot]
12b2824a3b
dep: Upgrade transitive dependencies (#1587)
Co-authored-by: github-actions <github-actions@github.com>
2024-01-26 04:04:15 +00:00
github-actions[bot]
a7c691873d
release: cargo-binstall v1.6.1 (#1586)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-01-21 09:12:02 +00:00
Jiahao XU
01ddf00b54
Fix Unmatched checksum error (#1585)
Fixed #1575

Always consume the stream if a `data_verifier` is provided in
`binstalk_download::Download`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-01-21 06:50:20 +00:00
github-actions[bot]
7f70a4e8ee
release: simple-git v0.2.2 (#1584)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-01-21 00:19:23 +00:00
Jiahao XU
70ebed3702
Update <simple_git::GitUrl as Display>::fmt impl (#1582)
Forward it to `<gix::Url as Display>::fmt` now that `gix::Url`
implements `Display`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-01-20 16:42:49 +00:00
Jiahao XU
32b73b1ee9
Update crates.io description for cargo-binstall (#1583)
Since the one on GitHub has changed.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-01-20 14:46:34 +00:00
dependabot[bot]
412d42001a
build(deps): bump the deps group with 1 update (#1581)
Bumps the deps group with 1 update: [gix](https://github.com/Byron/gitoxide).


Updates `gix` from 0.57.1 to 0.58.0
- [Release notes](https://github.com/Byron/gitoxide/releases)
- [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Byron/gitoxide/compare/gix-v0.57.1...gix-v0.58.0)

---
updated-dependencies:
- dependency-name: gix
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 09:00:04 +00:00
github-actions[bot]
7fc0a333e3
release: binstalk v0.20.1 (#1580)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-01-20 08:06:39 +00:00
github-actions[bot]
0c74d017f9
release: detect-targets v0.1.15 (#1579)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-01-20 06:16:31 +00:00
github-actions[bot]
87f71b76cd
dep: Upgrade transitive dependencies (#1578)
Co-authored-by: github-actions <github-actions@github.com>
2024-01-19 03:42:30 +00:00
FlareFlo
857a2caf34
Fix missing spaces in error log (#1577) 2024-01-19 02:20:37 +00:00
Jiahao XU
8befa3d649
Fix detect-targets on android targets (#1576)
* Fix detect-targets on android targets

By enabling linux fallback on Android.

Also add CI regression test for aarch64-linux-android target.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix CI: Add job `detect-targets-android-check` as required for merging

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-01-15 23:02:40 +00:00
Félix Saparelli
d02776c7fc
detect-target: fallback on targets we don't explicitly have support for (#1574)
See #1573
2024-01-14 11:59:24 +00:00
github-actions[bot]
7d25079422
release: cargo-binstall v1.6.0 (#1571)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-01-13 09:44:33 +00:00
github-actions[bot]
b497939ec6
release: binstalk v0.20.0 (#1570)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-01-13 08:28:22 +00:00
github-actions[bot]
8313dea231
release: binstalk-registry v0.5.0 (#1569)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-01-13 06:42:42 +00:00
github-actions[bot]
338b043354
release: cargo-toml-workspace v4.0.0 (#1568)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-01-13 04:54:16 +00:00
dependabot[bot]
69c5c3714c
build(deps): bump the deps group with 2 updates (#1567)
Bumps the deps group with 2 updates: [vergen](https://github.com/rustyhorde/vergen) and [cargo_toml](https://gitlab.com/lib.rs/cargo_toml).


Updates `vergen` from 8.2.6 to 8.2.7
- [Release notes](https://github.com/rustyhorde/vergen/releases)
- [Commits](https://github.com/rustyhorde/vergen/compare/8.2.6...8.2.7)

Updates `cargo_toml` from 0.17.2 to 0.18.0
- [Commits](https://gitlab.com/lib.rs/cargo_toml/commits/v0.18.0)

---
updated-dependencies:
- dependency-name: vergen
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: cargo_toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-13 03:11:53 +00:00
Jacob Hummer
b415b0d7e6
Fix install-from-binstall-release.sh for Git Bash users on Windows (#1562)
* Update install-from-binstall-release.sh

* Update install-from-binstall-release.sh

* Update install-from-binstall-release.sh

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update install-from-binstall-release.sh

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update install-script.yml

* Update install-from-binstall-release.sh

* Update install-script.yml

---------

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-01-13 02:22:51 +00:00
github-actions[bot]
7222a8279d
dep: Upgrade transitive dependencies (#1563)
Co-authored-by: github-actions <github-actions@github.com>
2024-01-13 02:02:37 +00:00
Jiahao XU
9df18b1a48
Disable zlib-ng for aarch64 linux and re-enable it for x64 linux (#1565)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-01-13 00:51:42 +00:00
Jiahao XU
c08b8d232a
feat: Impl new option --continue-on-failure (#1559)
* feat: Impl new option `--continue-on-failure`

Resolve #1548

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add new e2e-tests continue-on-failure

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rm dup line ion `e2e-tests/live.sh`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix shellcheck

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `BinstallError::crate_errors` if `errors.len()` is 1

In that case, it should return `Some(Self::CrateContext(_))` instead of
`Some(Self::Errors(_))`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add more tests to `e2e-tests/continue-on-failure.sh`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Propagate crate errors on `confirm()` err

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Test having two errors in `e2e-tests/continue-on-failure.sh`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-01-08 12:09:45 +00:00
Jiahao XU
f5da25cc56
Revert "build(deps): bump actions/{up, down}load-artifact from 3 to 4" (#1561)
Revert "build(deps): bump actions/{up, down}load-artifact from 3 to 4 (#1533)"

This reverts commit fea489032a.
2024-01-07 14:46:30 +00:00
github-actions[bot]
763885b3a5
release: cargo-binstall v1.5.0 (#1558)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-01-07 00:46:33 +00:00
github-actions[bot]
5341d050b9
release: simple-git v0.2.1 (#1557)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2024-01-06 13:07:50 +00:00
Dustin Blackman
b14f78b982
feat: Add strategies environment variable (#1555) 2024-01-06 12:39:54 +00:00
dependabot[bot]
dca22b6548
build(deps): bump the deps group with 1 update (#1556)
Bumps the deps group with 1 update: [embed-resource](https://github.com/nabijaczleweli/rust-embed-resource).


Updates `embed-resource` from 2.4.0 to 2.4.1
- [Release notes](https://github.com/nabijaczleweli/rust-embed-resource/releases)
- [Commits](https://github.com/nabijaczleweli/rust-embed-resource/compare/v2.4.0...v2.4.1)

---
updated-dependencies:
- dependency-name: embed-resource
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-06 03:20:08 +00:00
github-actions[bot]
5d030ffc8b
dep: Upgrade transitive dependencies (#1553)
Co-authored-by: github-actions <github-actions@github.com>
2024-01-05 14:19:52 +00:00
dependabot[bot]
cfb41882a2
build(deps): bump the deps group with 1 update (#1550)
Bumps the deps group with 1 update: [gix](https://github.com/Byron/gitoxide).


Updates `gix` from 0.56.0 to 0.57.0
- [Release notes](https://github.com/Byron/gitoxide/releases)
- [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Byron/gitoxide/compare/gix-v0.56.0...gix-v0.57.0)

---
updated-dependencies:
- dependency-name: gix
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-30 02:23:48 +00:00
github-actions[bot]
c27f2ae258
dep: Upgrade transitive dependencies (#1549)
Co-authored-by: github-actions <github-actions@github.com>
2023-12-29 06:29:26 +00:00
github-actions[bot]
b48410fbe8
release: cargo-binstall v1.4.9 (#1546)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-12-26 11:04:59 +00:00
github-actions[bot]
c014531bc4
release: binstalk-downloader v0.9.6 (#1545)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-12-26 08:36:48 +00:00
dependabot[bot]
2c23023069
build(deps): bump the deps group with 4 updates (#1542)
* build(deps): bump the deps group with 4 updates

Bumps the deps group with 4 updates: [thiserror](https://github.com/dtolnay/thiserror), [async_zip](https://github.com/Majored/rs-async-zip), [futures-util](https://github.com/rust-lang/futures-rs) and [syn](https://github.com/dtolnay/syn).


Updates `thiserror` from 1.0.51 to 1.0.52
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.51...1.0.52)

Updates `async_zip` from 0.0.15 to 0.0.16
- [Release notes](https://github.com/Majored/rs-async-zip/releases)
- [Commits](https://github.com/Majored/rs-async-zip/commits/v0.0.16)

Updates `futures-util` from 0.3.29 to 0.3.30
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.29...0.3.30)

Updates `syn` from 2.0.42 to 2.0.43
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.42...2.0.43)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: async_zip
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: futures-util
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix compilation of `extract_zip_entry`: Relax generic bound

Use `futures_io::AsyncRead`, which is the most relaxed bound possible.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* ENable feature `async_zip/deflate64`

New compression algorithm introduced

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update transitive deps

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-12-26 07:01:59 +00:00
dependabot[bot]
55bb7f3805
build(deps): bump geekyeggo/delete-artifact from 2 to 4 (#1541)
Bumps [geekyeggo/delete-artifact](https://github.com/geekyeggo/delete-artifact) from 2 to 4.
- [Release notes](https://github.com/geekyeggo/delete-artifact/releases)
- [Changelog](https://github.com/GeekyEggo/delete-artifact/blob/main/CHANGELOG.md)
- [Commits](https://github.com/geekyeggo/delete-artifact/compare/v2...v4)

---
updated-dependencies:
- dependency-name: geekyeggo/delete-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-25 04:12:29 +00:00
github-actions[bot]
bdda03dfd4
dep: Upgrade transitive dependencies (#1536)
Co-authored-by: github-actions <github-actions@github.com>
2023-12-22 04:10:35 +00:00
Jiahao XU
fea489032a
build(deps): bump actions/{up, down}load-artifact from 3 to 4 (#1533)
* build(deps): bump actions/upload-artifact from 3 to 4

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump actions/download-artifact from 3 to 4

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-19 09:37:26 +00:00
github-actions[bot]
ef85500736
release: cargo-binstall v1.4.8 (#1532)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-12-16 04:40:00 +00:00
github-actions[bot]
63179d9993
release: binstalk-registry v0.4.1 (#1531)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-12-16 02:23:28 +00:00
dependabot[bot]
f23a619a61
build(deps): bump the deps group with 3 updates (#1530)
Bumps the deps group with 3 updates: [file-format](https://github.com/mmalecot/file-format), [home](https://github.com/rust-lang/cargo) and [thiserror](https://github.com/dtolnay/thiserror).


Updates `file-format` from 0.22.0 to 0.23.0
- [Release notes](https://github.com/mmalecot/file-format/releases)
- [Changelog](https://github.com/mmalecot/file-format/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mmalecot/file-format/compare/v0.22.0...v0.23.0)

Updates `home` from 0.5.5 to 0.5.9
- [Changelog](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cargo/commits)

Updates `thiserror` from 1.0.50 to 1.0.51
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.50...1.0.51)

---
updated-dependencies:
- dependency-name: file-format
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: home
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-16 01:15:39 +00:00
Marcus Griep
b296ac5315
fix: remove a trailing slash in registry index URL (#1528) 2023-12-15 06:14:21 +00:00
github-actions[bot]
f29543e555
dep: Upgrade transitive dependencies (#1527)
Co-authored-by: github-actions <github-actions@github.com>
2023-12-15 04:46:30 +00:00
Félix Saparelli
c8e93d4a24
Renew readme (#1524)
- Reorders sections to show Binstall's value upfront
- Clarifies and simplifies language
- Updates the sample output
- Includes cargo-run-bin (#1514)
- Places the github actions in more prominence in the Install section
- Unifies appellation by consistently using the "Binstall" name except for commands
- Changes the arch labels in the install table to reflect common/official usage
2023-12-13 06:39:08 +00:00
github-actions[bot]
f6a95fa733
release: cargo-binstall v1.4.7 (#1523)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-12-12 04:02:34 +00:00
github-actions[bot]
3d22e1b8f4
release: binstalk v0.19.0 (#1522)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-12-12 02:40:07 +00:00
github-actions[bot]
0e87113cc5
release: binstalk-registry v0.4.0 (#1521)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-12-11 23:54:34 +00:00
github-actions[bot]
f0bfa54944
release: simple-git v0.2.0 (#1520)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-12-11 22:37:04 +00:00
Jiahao XU
09debccace
freat: Avoid breaking changes due to gix upgrade (#1518)
Wrap all error type in a new type so that we don't have to release new
major versions after upgrading depoendency gix`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-12-11 14:08:13 +00:00
github-actions[bot]
8bb3557eda
dep: Upgrade transitive dependencies (#1517)
Co-authored-by: github-actions <github-actions@github.com>
2023-12-11 13:17:23 +00:00
dependabot[bot]
b2ddd176e3
build(deps): bump the deps group with 2 updates (#1516)
Bumps the deps group with 2 updates: [tokio](https://github.com/tokio-rs/tokio) and [gix](https://github.com/Byron/gitoxide).


Updates `tokio` from 1.34.0 to 1.35.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.34.0...tokio-1.35.0)

Updates `gix` from 0.55.2 to 0.56.0
- [Release notes](https://github.com/Byron/gitoxide/releases)
- [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Byron/gitoxide/compare/gix-v0.55.2...gix-v0.56.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: gix
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-09 01:29:41 +00:00
github-actions[bot]
f56e3eeb06
dep: Upgrade transitive dependencies (#1515)
Co-authored-by: github-actions <github-actions@github.com>
2023-12-08 04:14:21 +00:00
github-actions[bot]
0717044540
dep: Upgrade transitive dependencies (#1513)
Co-authored-by: github-actions <github-actions@github.com>
2023-12-01 08:04:25 +00:00
dependabot[bot]
c177fd2101
build(deps): bump the deps group with 1 update (#1511)
Bumps the deps group with 1 update: [command-group](https://github.com/watchexec/command-group).

- [Changelog](https://github.com/watchexec/command-group/blob/main/CHANGELOG.md)
- [Commits](https://github.com/watchexec/command-group/compare/v4.1.0...v5.0.1)

---
updated-dependencies:
- dependency-name: command-group
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-25 04:00:15 +00:00
github-actions[bot]
1882dfabe4
dep: Upgrade transitive dependencies (#1510)
Co-authored-by: github-actions <github-actions@github.com>
2023-11-24 04:35:49 +00:00
Christopher Durham
469fc1783e
Use $Env:CARGO_HOME in ps1 install script (#1509) 2023-11-20 07:22:38 +00:00
github-actions[bot]
05f90e651d
release: cargo-binstall v1.4.6 (#1508)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-18 10:57:12 +00:00
github-actions[bot]
3738f11f30
release: binstalk v0.18.1 (#1507)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-18 06:41:26 +00:00
github-actions[bot]
7e6223a8e2
release: binstalk-fetchers v0.2.2 (#1506)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-18 05:53:27 +00:00
github-actions[bot]
47d573fd2d
release: detect-targets v0.1.14 (#1504)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-18 05:20:55 +00:00
github-actions[bot]
7dfb617c95
release: binstalk-downloader v0.9.5 (#1505)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-18 04:50:46 +00:00
github-actions[bot]
cbabc33ccf
release: atomic-file-install v1.0.1 (#1503)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-18 04:37:08 +00:00
dependabot[bot]
a62f22050b
build(deps): bump the deps group with 4 updates (#1502)
Bumps the deps group with 4 updates: [windows](https://github.com/microsoft/windows-rs), [itertools](https://github.com/rust-itertools/itertools), [default-net](https://github.com/shellrow/default-net) and [windows-sys](https://github.com/microsoft/windows-rs).


Updates `windows` from 0.51.1 to 0.52.0
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.51.1...0.52.0)

Updates `itertools` from 0.11.0 to 0.12.0
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-itertools/itertools/compare/v0.11.0...v0.12.0)

Updates `default-net` from 0.20.0 to 0.21.0
- [Release notes](https://github.com/shellrow/default-net/releases)
- [Commits](https://github.com/shellrow/default-net/compare/v0.20.0...v0.21.0)

Updates `windows-sys` from 0.48.0 to 0.52.0
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.48.0...0.52.0)

---
updated-dependencies:
- dependency-name: windows
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: itertools
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: default-net
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: windows-sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-18 03:04:12 +00:00
github-actions[bot]
0a5be72322
dep: Upgrade transitive dependencies (#1498)
Co-authored-by: github-actions <github-actions@github.com>
2023-11-17 05:33:38 +00:00
github-actions[bot]
aabe107726
release: fs-lock v0.1.2 (#1497)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-17 01:01:45 +00:00
Dawid Ciężarkiewicz
645579430a
feat(fs-lock): new_try_exclusive and new_try_shared (#1496)
In certain situations it's useful to attempt to lock the file.
2023-11-16 22:35:08 +00:00
Yuri Astrakhan
9d8dc94d8d
Fix badge (#1494)
It was pointing to an non-existent CI job, changed it to CI workflow.
2023-11-14 03:03:31 +00:00
github-actions[bot]
d345b2c14b
release: cargo-binstall v1.4.5 (#1492)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-12 10:59:27 +00:00
github-actions[bot]
5b8608d367
release: binstalk v0.18.0 (#1493)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-11 23:36:51 +00:00
github-actions[bot]
122e64ab25
release: binstalk-manifests v0.11.0 (#1484)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-11 18:53:10 +00:00
Jiahao XU
4599a70839
Fix CI: Dry-run cargo-publish on crate to be published (#1490)
* Fix CI: Dry-run `cargo-publish` on crate to be published

If there's no crate to publish, do not dry-run `cargo-publish`.

Only dry-run `cargo-publish` on crate to be published to avoid
`cargo-publish` error on `cargo-binstall` when one of its direct
dependencies is bumped.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix passing of crate to `release-cli.yml`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix passing of `needs.pr-info.outpus.crate`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `release-dry-run`: Only run if is release or is not PR event

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix passing of crate

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rm `just-setup` from `release-cli.yml` since it cannot be cached

release is trigged by the closing of PR, so the cache is saved under the
branch `release/*` which cannot be reused.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix dry-run publish

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-11-11 14:17:16 +00:00
Jiahao XU
26b6db2244
Fix release-cli.yml: Do not dry run cargo-publish (#1487)
* Fix `release-cli.yml`: Do not dry run `cargo-publish`

If dependencies of `carog-binstall` is bumped, then `cargo-publish` dry
run will fail since the dependency has not published yet

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Speedup step publish in `release-cli.yml`

Use `just-setup` to cache rust/zig compilation, also
disable all features to reduce dependencies pulled in.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* `release-cli.yml`: Restore rust cache before ephermal-crate.sh is run

which writes the key to `Cargo.toml` and invalidates the cache.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-11-11 11:11:09 +00:00
github-actions[bot]
86237aa611
release: binstalk-registry v0.3.0 (#1486)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-11 09:50:21 +00:00
github-actions[bot]
c874f2e0dc
release: binstalk-downloader v0.9.4 (#1485)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-11 08:05:41 +00:00
github-actions[bot]
6e974813f8
release: cargo-toml-workspace v3.0.0 (#1483)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-11-11 08:00:28 +00:00
Jiahao XU
5064e4e188
CI: Cache zig global_cache to speedup build (#1481)
* CI: Cache zig global_cache to speedup build

This can be helpful in two situations:
 - If `cc` is bumped to a new release, then all the `*-sys` crates will
   be rebuilt even if their source doesn't change.
   Caching zig global_cache would avoid expensive rebuilds.
 - For target `x86_64h-apple-darwin`, it uses build-std which means the
   rust cache is quite ineffective (only build-dependencies are cached),
   so we would also need zig global_cache to avoid rebuilding c
   dependencies in CI.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix missing `shell: bash`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix CI: Create symlink to `zig`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* CI: Fix getting output from prev step in just-setup

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* CI: Include job_id `github.job` in zig cache key

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-11-11 07:34:36 +00:00
dependabot[bot]
8dff97a0a2
build(deps): bump the deps group with 5 updates (#1482)
Bumps the deps group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [clap](https://github.com/clap-rs/clap) | `4.4.7` | `4.4.8` |
| [file-format](https://github.com/mmalecot/file-format) | `0.21.0` | `0.22.0` |
| [command-group](https://github.com/watchexec/command-group) | `3.0.0` | `4.1.0` |
| [toml_edit](https://github.com/toml-rs/toml) | `0.20.7` | `0.21.0` |
| [default-net](https://github.com/shellrow/default-net) | `0.19.0` | `0.20.0` |


Updates `clap` from 4.4.7 to 4.4.8
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.4.7...v4.4.8)

Updates `file-format` from 0.21.0 to 0.22.0
- [Release notes](https://github.com/mmalecot/file-format/releases)
- [Changelog](https://github.com/mmalecot/file-format/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mmalecot/file-format/compare/v0.21.0...v0.22.0)

Updates `command-group` from 3.0.0 to 4.1.0
- [Changelog](https://github.com/watchexec/command-group/blob/main/CHANGELOG.md)
- [Commits](https://github.com/watchexec/command-group/compare/v3.0.0...v4.1.0)

Updates `toml_edit` from 0.20.7 to 0.21.0
- [Commits](https://github.com/toml-rs/toml/compare/v0.20.7...v0.21.0)

Updates `default-net` from 0.19.0 to 0.20.0
- [Release notes](https://github.com/shellrow/default-net/releases)
- [Commits](https://github.com/shellrow/default-net/compare/v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: file-format
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: command-group
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: deps
- dependency-name: toml_edit
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: default-net
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-11 06:32:43 +00:00
github-actions[bot]
70afd8419d
dep: Upgrade transitive dependencies (#1480)
Co-authored-by: github-actions <github-actions@github.com>
2023-11-10 03:53:23 +00:00
Jiahao XU
d76a40bf7d
Rm unnecessary warning msg "Failed to read git credential file" (#1479)
* Rm unnecessary warning msg "Failed to read git credential file"

Fixed #1476

If `gh auth token` executed successfully and binstall obtained a gh
token from it, then there's no reason to issue any warning msg.

Only when binstall cannot read from `.git-credential` and
`gh auth token` failed does binstall need to issue warning.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix clippy warning

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-11-08 22:06:32 +00:00
dependabot[bot]
3414c4ee83
build(deps): bump the deps group with 3 updates (#1478)
Bumps the deps group with 3 updates: [command-group](https://github.com/watchexec/command-group), [default-net](https://github.com/shellrow/default-net) and [cargo_toml](https://gitlab.com/lib.rs/cargo_toml).


Updates `command-group` from 2.1.0 to 3.0.0
- [Changelog](https://github.com/watchexec/command-group/blob/main/CHANGELOG.md)
- [Commits](https://github.com/watchexec/command-group/compare/v2.1.0...v3.0.0)

Updates `default-net` from 0.18.0 to 0.19.0
- [Release notes](https://github.com/shellrow/default-net/releases)
- [Commits](https://github.com/shellrow/default-net/compare/v0.18.0...v0.19.0)

Updates `cargo_toml` from 0.16.3 to 0.17.0
- [Commits](https://gitlab.com/lib.rs/cargo_toml/compare/v0.16.3...v0.17.0)

---
updated-dependencies:
- dependency-name: command-group
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: deps
- dependency-name: default-net
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: cargo_toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-04 01:44:22 +00:00
github-actions[bot]
6454a1df05
dep: Upgrade transitive dependencies (#1477)
Co-authored-by: github-actions <github-actions@github.com>
2023-11-03 03:46:55 +00:00
dependabot[bot]
b86bf5f2e1
build(deps): bump the deps group with 2 updates (#1475)
Bumps the deps group with 2 updates: [tracing-log](https://github.com/tokio-rs/tracing) and [toml_edit](https://github.com/toml-rs/toml).


Updates `tracing-log` from 0.1.4 to 0.2.0
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-log-0.1.4...tracing-log-0.2.0)

Updates `toml_edit` from 0.20.5 to 0.20.7
- [Commits](https://github.com/toml-rs/toml/compare/v0.20.5...v0.20.7)

---
updated-dependencies:
- dependency-name: tracing-log
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: toml_edit
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-28 01:41:46 +00:00
github-actions[bot]
24f5796a7c
dep: Upgrade transitive dependencies (#1474)
Co-authored-by: github-actions <github-actions@github.com>
2023-10-27 03:54:06 +00:00
github-actions[bot]
dc20cb7eb3
release: cargo-binstall v1.4.4 (#1473)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-10-22 13:29:59 +00:00
github-actions[bot]
b935529fd0
dep: Upgrade transitive dependencies (#1472)
Co-authored-by: github-actions <github-actions@github.com>
2023-10-22 12:40:16 +00:00
github-actions[bot]
61748689b3
release: binstalk-downloader v0.9.3 (#1471)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-10-22 12:20:39 +00:00
github-actions[bot]
9cfc0cd5f9
dep: Upgrade transitive dependencies (#1470)
Co-authored-by: github-actions <github-actions@github.com>
2023-10-20 13:01:33 +00:00
Jiahao XU
8efc19b3c3
dep: Update trust-dns-resolver v0.23.0 => hickory-resolver 0.24.0 (#1467)
It's renamed to hickory-resolver.

Also enabled new feature `hickory-resolver/dns-over-h3` if `rustls` is
enabled.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-10-20 11:48:46 +00:00
Jiahao XU
7e132f690d
Fix CI: Use cargo-hack 0.6.10 (#1468)
* Fix ci: Install deps before caching and include `JUST*` env values in caching key

To make sure caching is done properly and does not accidentally include
(old) pre-built binaries that we don't want.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix missing `shell`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix justfile target `check`: Call `cargo hack check` directly

without using the `CARGO=cargo-zigbuild` env since `leon` does not use
external C/C++ compiler anyway.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* CI: Dowgrade cargo-hack to 0.6.10

This is the last version working

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-10-20 10:37:54 +00:00
dependabot[bot]
4de2d0f49c
build(deps): bump the deps group with 6 updates (#1465)
Bumps the deps group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [tracing](https://github.com/tokio-rs/tracing) | `0.1.37` | `0.1.39` |
| [async-compression](https://github.com/Nullus157/async-compression) | `0.4.3` | `0.4.4` |
| [flate2](https://github.com/rust-lang/flate2-rs) | `1.0.27` | `1.0.28` |
| [zstd](https://github.com/gyscos/zstd-rs) | `0.12.4` | `0.13.0` |
| [default-net](https://github.com/shellrow/default-net) | `0.17.0` | `0.18.0` |
| [gix](https://github.com/Byron/gitoxide) | `0.54.1` | `0.55.2` |


Updates `tracing` from 0.1.37 to 0.1.39
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.37...tracing-0.1.39)

Updates `async-compression` from 0.4.3 to 0.4.4
- [Release notes](https://github.com/Nullus157/async-compression/releases)
- [Changelog](https://github.com/Nullus157/async-compression/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Nullus157/async-compression/compare/async-compression-v0.4.3...async-compression-v0.4.4)

Updates `flate2` from 1.0.27 to 1.0.28
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.0.27...1.0.28)

Updates `zstd` from 0.12.4 to 0.13.0
- [Release notes](https://github.com/gyscos/zstd-rs/releases)
- [Commits](https://github.com/gyscos/zstd-rs/compare/v0.12.4...v0.13.0)

Updates `default-net` from 0.17.0 to 0.18.0
- [Release notes](https://github.com/shellrow/default-net/releases)
- [Commits](https://github.com/shellrow/default-net/compare/v0.17.0...v0.18.0)

Updates `gix` from 0.54.1 to 0.55.2
- [Release notes](https://github.com/Byron/gitoxide/releases)
- [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Byron/gitoxide/compare/gix-v0.54.1...gix-v0.55.2)

---
updated-dependencies:
- dependency-name: tracing
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: async-compression
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: flate2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: zstd
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: default-net
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: gix
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-14 10:01:27 +00:00
dependabot[bot]
449a3973d9
build(deps): bump tracing-core from 0.1.31 to 0.1.32 (#1461)
Bumps [tracing-core](https://github.com/tokio-rs/tracing) from 0.1.31 to 0.1.32.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-core-0.1.31...tracing-core-0.1.32)

---
updated-dependencies:
- dependency-name: tracing-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-14 02:12:29 +00:00
github-actions[bot]
f73d11d0e3
dep: Upgrade transitive dependencies (#1458)
Co-authored-by: github-actions <github-actions@github.com>
2023-10-13 07:07:59 +00:00
George Pollard
c577893878
Change Powershell architecture detection (#1456) 2023-10-13 03:10:12 +00:00
Félix Saparelli
3cf76cd0a9
Downgrade DNS info! to debug! (#1454)
* Downgrade DNS info! to debug!

* Update resolver.rs
2023-10-10 05:51:55 +00:00
github-actions[bot]
e47b908a05
release: cargo-binstall v1.4.3 (#1452)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-10-08 08:21:00 +00:00
github-actions[bot]
3b42aa3d0f
release: binstalk v0.17.1 (#1449)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-10-07 22:52:35 +11:00
github-actions[bot]
6f6426c247
release: binstalk-fetchers v0.2.1 (#1448)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-10-07 08:39:55 +00:00
github-actions[bot]
113e9d40a3
release: binstalk-downloader v0.9.2 (#1447)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-10-07 07:50:55 +00:00
github-actions[bot]
71764ca62c
release: binstalk-types v0.6.1 (#1446)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-10-07 07:08:48 +00:00
github-actions[bot]
274a1975eb
release: fs-lock v0.1.1 (#1443)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-10-07 06:10:11 +00:00
github-actions[bot]
45518cb65e
release: detect-targets v0.1.13 (#1444)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-10-07 06:10:03 +00:00
github-actions[bot]
39d22510b6
release: simple-git v0.1.1 (#1445)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-10-07 06:09:58 +00:00
github-actions[bot]
63db6686d5
dep: Upgrade transitive dependencies (#1442)
Co-authored-by: github-actions <github-actions@github.com>
2023-10-07 04:58:29 +00:00
dependabot[bot]
49592890f9
build(deps): bump the deps group with 2 updates (#1441)
Bumps the deps group with 2 updates: [fs4](https://github.com/al8n/fs4-rs) and [proc-macro2](https://github.com/dtolnay/proc-macro2).


Updates `fs4` from 0.6.6 to 0.7.0
- [Release notes](https://github.com/al8n/fs4-rs/releases)
- [Commits](https://github.com/al8n/fs4-rs/commits/0.7.0)

Updates `proc-macro2` from 1.0.67 to 1.0.68
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.67...1.0.68)

---
updated-dependencies:
- dependency-name: fs4
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-07 02:02:23 +00:00
github-actions[bot]
101737e058
dep: Upgrade transitive dependencies (#1438)
Co-authored-by: github-actions <github-actions@github.com>
2023-10-06 13:04:34 +00:00
Jiahao XU
ceba74870e
Fix clippy errors in cargo v1.73.0 (#1439)
It actually improves the quality of our code!

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-10-06 12:10:42 +00:00
Sculas
af04e45b5a
feat: logging for DNS resolver (also fixes #1417) (#1436)
* feat: logging for dns resolver

* refactor: fix clippy warnings

* refactor: actually fix clippy warnings

* refactor: apply requested changes
2023-10-05 11:00:07 +00:00
dependabot[bot]
59963c712f
build(deps): bump the deps group with 2 updates (#1433)
Bumps the deps group with 2 updates: [file-format](https://github.com/mmalecot/file-format) and [gix](https://github.com/Byron/gitoxide).


Updates `file-format` from 0.20.0 to 0.21.0
- [Release notes](https://github.com/mmalecot/file-format/releases)
- [Changelog](https://github.com/mmalecot/file-format/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mmalecot/file-format/compare/v0.20.0...v0.21.0)

Updates `gix` from 0.53.1 to 0.54.1
- [Release notes](https://github.com/Byron/gitoxide/releases)
- [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Byron/gitoxide/compare/gix-v0.53.1...gix-v0.54.1)

---
updated-dependencies:
- dependency-name: file-format
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: gix
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-30 14:08:07 +00:00
Jiahao XU
78eb0921e3
CI: Skip release-dry-run on pull_request (#1435)
For PRs opened by contributors who are not part of the cargo-bins team and for
PRs opened by dependabot, they cannot access the secrets, thus signing will
always fail.

Skipping release-dry-run on pull_request would fix that for them, while
retaining the signing stage on merge_queue and on main to ensure that the
release workflow is working.

It will also speedup CI for PR.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-30 13:36:23 +00:00
Jiahao XU
a69beccf1a
Bump dep trust-dns-reslver to v0.23.0 (#1432)
* Bump dep trust-dns-reslver to v0.23.0

Since we no longer enables `reqwest/trust-dns-resolver` anymore, we
don't need to keep this dependency is sync with upstream `reqwest`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix compilation

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-30 01:12:27 +00:00
Jiahao XU
8e08c65946
Fix fallback to cargo-install: Use the default target unless user override (#1430)
* Fix fallback to `cargo-install`: Use the default target

which is guaranteed to work, instead of providing a custom `--target`
from `detect-targets`.

The one from `detect-targets` might report musl even if the `rustc`
reports gnu, since OSes like NixOS could use a custom glibc location
that prevent glibc binaries built for other OSes be run for them.

However, if we are compiling the crate and `rustc` defaults to glibc,
then it should be guaranteed to work.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Impl fn `DesiredTargets::get_initialized`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix fallback to `cargo-install`: Use user-provided override targets

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-30 00:22:21 +00:00
Jiahao XU
b56a8c3579
Fix detect-targets glibc detection (#1421)
* Fix `detect-targets` glibc detection

Fixed #1420

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `detect-targets` glibc detection for Fedora

Fedora 37-39 has glibc installed in `/lib64` and `/usr/lib64` instead of
`/lib` or `/usr/lib`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Improve caching in `detect-targets-alpine-test`

Make sure it reuses cached artifacts instead of recompiling everything.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Mv `test-detect-targets-musl.sh` into `.github/scripts/`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor `ci.yml`: Extract new job `detect-targets-build`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* FIx `detect-targets-ubuntu-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Avoid building the entire workspacein `detect-targets-build`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `detect-targets-*-test`: `chmod +x detect-targets`

Also fixed testing on Alpine, to make sure it exits with status 1 on
assertion failure.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix typo

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Cache all crates in `detect-targets-build`

Since `detect-targets` rarely changes and is quite small, it is also
reasonable to cache it.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add job `detect-targets-more-glibc-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add `detect-targets-nix-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `detect-targets-nix-test` executing `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix workflow: Add all `detect-targets-*` jobs to be dep of `tests-pass`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-29 23:46:03 +00:00
Jiahao XU
86060fadc2
.github: build detect-targets with cli-logging (#1428) (#1429)
Without this we get much less useful output if these tests fail.

Co-authored-by: Tamir Duberstein <tamird@gmail.com>
2023-09-29 05:23:03 +00:00
github-actions[bot]
1a244cb0d3
dep: Upgrade transitive dependencies (#1427)
Co-authored-by: github-actions <github-actions@github.com>
2023-09-29 04:04:23 +00:00
Jiahao XU
3d68641a6d
Fix release-packages and release-cli workflow (#1422)
* Fix `release-packages` and `release-cli` workflow

Fixed #1419

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Use `taiki-e/install-action` for `rsign2` & `rage` in `release-packages.yml`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-29 02:49:43 +00:00
github-actions[bot]
6ce60225d4
release: cargo-binstall v1.4.2 (#1418)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-28 02:59:25 +00:00
github-actions[bot]
4344148566
release: binstalk-downloader v0.9.1 (#1416)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-27 22:31:01 +00:00
Jiahao XU
b73c253275
Fix GhApiClient: Accept any auth_token given (#1415)
Fixed #1414

There are many different kinds of gh tokens and they can change the
format at anytime, so we can't check it based on its formats.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-27 12:02:42 +00:00
github-actions[bot]
e41db2a297
release: cargo-binstall v1.4.1 (#1406)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-26 23:42:26 +00:00
Félix Saparelli
216d548fd4
Use explicit write permissions (#1404)
* Use explicit write permissions

* Revert "release: cargo-binstall v1.4.1 (#1403)"

This reverts commit 00941d8b43.
2023-09-26 21:57:51 +00:00
Félix Saparelli
499e6b07fa
Upload packaged crate (#1401)
Upload packaged crate when not releasing
2023-09-26 13:30:47 +00:00
github-actions[bot]
00941d8b43
release: cargo-binstall v1.4.1 (#1403)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-26 13:31:47 +00:00
Félix Saparelli
5d4333d5c8
Fix release build again (#1400)
* Fix build again

* Recommend (r)age over minisign password

* Dry-run the entire release process

* Reorg a bit so dry-run works

* Fix secret name

* Add check on age key

* Pass secrets down

* Use a cross-platform "date"

* Delete signing key artifact to be extra safe

* Last little bits
2023-09-26 11:17:17 +00:00
github-actions[bot]
3f29e13e42
release: cargo-binstall v1.4.0 (#1399)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-26 07:46:42 +00:00
Félix Saparelli
49b37ff1e2
Revert "release: cargo-binstall v1.4.0" and fix (#1398)
* Revert "release: cargo-binstall v1.4.0 (#1397)"

This reverts commit 99e8256018.

* --allow-dirty on publish

* Remove private key file after generation

* Write public key file to bin crate and to package

* Upload public key file to release
2023-09-26 06:47:25 +00:00
github-actions[bot]
99e8256018
release: cargo-binstall v1.4.0 (#1397)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-26 03:42:59 +00:00
github-actions[bot]
bf30d73f53
release: binstalk v0.17.0 (#1396)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-25 12:29:23 +00:00
github-actions[bot]
df74a0d4f6
release: detect-targets v0.1.12 (#1395)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-25 11:38:37 +00:00
github-actions[bot]
f87e0d0b46
dep: Upgrade transitive dependencies (#1394)
Co-authored-by: github-actions <github-actions@github.com>
2023-09-25 11:19:56 +00:00
github-actions[bot]
c8099a9d88
release: binstalk-registry v0.2.0 (#1393)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-25 10:48:42 +00:00
github-actions[bot]
029f767a27
release: binstalk-bins v0.2.0 (#1389)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-25 09:01:12 +00:00
github-actions[bot]
ac357069a3
release: binstalk-fetchers v0.2.0 (#1390)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-25 09:00:55 +00:00
github-actions[bot]
3388ab98b9
release: cargo-toml-workspace v2.0.0 (#1392)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-25 09:00:47 +00:00
github-actions[bot]
1d8dfff3ba
release: binstalk-manifests v0.10.0 (#1388)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-25 05:49:14 +00:00
Jiahao XU
1fe4702bde
Refactor cargo-toml-workspace: Rm dep on binstalk-types (#1386)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-25 05:34:40 +00:00
github-actions[bot]
4ec44749f1
release: binstalk-downloader v0.9.0 (#1387)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-25 05:32:33 +00:00
github-actions[bot]
d39bb918df
release: binstalk-types v0.6.0 (#1384)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-25 02:31:02 +00:00
Jiahao XU
190ef7b8e7
Doc: Provide solutions for common problems encountered during signing (#1383)
* Doc: Provide solutions for common problems encountered during signing

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Apply suggestions from code review

Co-authored-by: Félix Saparelli <felix@passcod.name>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Félix Saparelli <felix@passcod.name>
2023-09-23 13:13:23 +00:00
Tamir Duberstein
2db8e254bc
Investigate incorrect target detection (#1376)
* detect-targets: add debug tracing

See #1375.

* Add new feature `tracing` & `cli-tracing` to `detect-targets

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix clippy lints

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-23 10:45:44 +00:00
Félix Saparelli
680accd0d3
Check quickinstall signatures (#1382)
* Check quickinstall signatures

* e2e test

* We can no longer check presence of signing section early

* Improve UI a little
2023-09-23 08:35:49 +00:00
Félix Saparelli
ee7fcb3210
Sign our releases (#1347)
* Sign our releases

* Use secrets instead of artifacts

* And the universal

* Apparently we can’t use secrets like that?

* Minor fixes to doc

* Private key requires untrusted comment

* Dogfood one deeper
2023-09-23 08:07:19 +00:00
Félix Saparelli
32beba507b
Initial signing support (#1345)
* Add CLI options

* Add manifest types

* Thread signature policy through to fetchers

* Thread signing section through from metadata

* Implement signing validation

* Clippy

* Attempt testing

* Yes and

* Why

* fmt

* Update crates/bin/src/args.rs

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update crates/binstalk-fetchers/src/gh_crate_meta.rs

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update crates/bin/src/args.rs

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update crates/binstalk-fetchers/src/signing.rs

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update crates/binstalk-fetchers/src/signing.rs

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update crates/binstalk-fetchers/src/signing.rs

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update crates/binstalk-fetchers/src/signing.rs

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* fixes

* Finish feature

* Document

* Include all fields in the signing.file template

* Readme document

* Review fixes

* Fail on non-utf8 sig

* Thank goodness for tests

* Run test in ci

* Add rsign2 commands

* Log utf8 error

* Update e2e-tests/signing.sh

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `e2e-tests/signing.sh` MacOS CI failure

Move the tls cert creation into `signing.sh` and sleep for 10s to wait
for https server to start.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor e2e-tests-signing files

 - Use a tempdir generated by `mktemp` for all certificates-related
   files
 - Put other checked-in files into `e2e-tests/signing`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fixed `e2e-tests-signing` connection err in MacOS CI

Wait for server to start up by trying to connect to it.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `e2e-tests-signing` passing `-subj` to `openssl` on Windows

Use single quote instead of double quote to avoid automatic expansion
from bash

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `e2e-tests-signing` waiting for server to startup

Remove `timeout` since it is not supported on MacOS.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Try to fix windows CI by setting `MSYS_NO_PATHCONV=1` on `openssl` cmds

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fixed `e2e-tests-signing` on windows

By using double `//` for the value passed to option `-subj`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fixed infinite loop in `signing/wait-for-server` on Windows

Pass `--ssl-revoke-best-effort` to prevent schannel from checking ssl
revocation status.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add cap on retry attempt in `signing/wait-for-server.sh`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Let `singing/server.py` print output to stderr

so that we can see the error message there.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix running `signing/server.py` on MacOS CI

use `python3` since macos-latest still has python2 installed and
`python` is a symlink to `python2` there.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-23 04:02:56 +00:00
Jiahao XU
efbd20857b
Fix detect-targets on ubuntu 20.04, glibc 2.31 (#1379)
* Fix `detect-targets` on ubuntu 20.04, glibc 2.31

Fixed #1375 and fixed #1378

glibc 2.31 does not support `--version`, so we need to detect and
fallback to passing an executable linked with that glibc to check if it
is indeed glibc.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix compilation faillure on ubuntu-20.04

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-22 23:55:12 +00:00
github-actions[bot]
f6e6a2f899
dep: Upgrade transitive dependencies (#1377)
Co-authored-by: github-actions <github-actions@github.com>
2023-09-22 04:12:28 +00:00
github-actions[bot]
82e5fc4781
release: cargo-binstall v1.3.1 (#1374)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-17 10:16:35 +00:00
github-actions[bot]
e4d4b15536
release: binstalk v0.16.1 (#1373)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-17 07:53:35 +00:00
github-actions[bot]
b2602b81fc
release: binstalk-registry v0.1.1 (#1372)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-17 06:57:16 +00:00
github-actions[bot]
3f3fdd565d
release: binstalk-fetchers v0.1.1 (#1370)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-17 06:04:55 +00:00
github-actions[bot]
53234e81ab
release: binstalk-downloader v0.8.0 (#1369)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-17 03:53:11 +00:00
github-actions[bot]
2c81b749ef
release: binstalk-manifests v0.9.0 (#1368)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-17 01:53:04 +00:00
github-actions[bot]
b78276c03e
release: detect-targets v0.1.11 (#1367)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-09-17 01:39:04 +00:00
github-actions[bot]
390879c5d8
dep: Upgrade transitive dependencies (#1366)
Co-authored-by: github-actions <github-actions@github.com>
2023-09-17 01:26:28 +00:00
Jiahao XU
9c4e3a6642
Minor refactor for binstalk-downloader (#1365)
- Mv `resolver.rs` => `remote/resolver.rs`
 - Fix clippy warnings in `resolver.rs` on unix

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-17 01:06:15 +00:00
Sculas
6560225c03
fix: use custom DNS resolver (#1364)
* add DefaultResolver

* style: fmt

* chore: remove unused feature

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* chore: remove unused `ipconfig/computer` feature

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* chore: update `trust-dns-resolver`

* refactor: apply requested changes

* chore: revert `trust-dns-resolver` upgrade

I mistakenly thought `reqwest` already updated to the newest version, but it hasn't! (no release was made yet)

* refactor: cleanup

---------

Co-authored-by: GNQG <my.t.gnq+dev@gmail.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-16 23:51:07 +00:00
dependabot[bot]
04c5c00669
build(deps): bump the deps group with 2 updates (#1363)
Bumps the deps group with 2 updates: [reflink-copy](https://github.com/cargo-bins/reflink-copy) and [syn](https://github.com/dtolnay/syn).


Updates `reflink-copy` from 0.1.6 to 0.1.7
- [Commits](https://github.com/cargo-bins/reflink-copy/commits)

Updates `syn` from 2.0.33 to 2.0.35
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.33...2.0.35)

---
updated-dependencies:
- dependency-name: reflink-copy
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-16 01:35:20 +00:00
github-actions[bot]
ac8b8132d2
dep: Upgrade transitive dependencies (#1362)
Co-authored-by: github-actions <github-actions@github.com>
2023-09-15 11:43:33 +00:00
dependabot[bot]
e711bcd404
build(deps): bump the deps group with 8 updates (#1361)
Bumps the deps group with 8 updates:

| Package | From | To |
| --- | --- | --- |
| [clap](https://github.com/clap-rs/clap) | `4.4.2` | `4.4.3` |
| [mimalloc](https://github.com/purpleprotocol/mimalloc_rust) | `0.1.38` | `0.1.39` |
| [vergen](https://github.com/rustyhorde/vergen) | `8.2.4` | `8.2.5` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.105` | `1.0.107` |
| [async-compression](https://github.com/Nullus157/async-compression) | `0.4.2` | `0.4.3` |
| [cargo_toml](https://gitlab.com/lib.rs/cargo_toml) | `0.15.3` | `0.16.0` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.66` | `1.0.67` |
| [syn](https://github.com/dtolnay/syn) | `2.0.31` | `2.0.33` |


Updates `clap` from 4.4.2 to 4.4.3
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.4.2...v4.4.3)

Updates `mimalloc` from 0.1.38 to 0.1.39
- [Release notes](https://github.com/purpleprotocol/mimalloc_rust/releases)
- [Commits](https://github.com/purpleprotocol/mimalloc_rust/compare/v0.1.38...v0.1.39)

Updates `vergen` from 8.2.4 to 8.2.5
- [Release notes](https://github.com/rustyhorde/vergen/releases)
- [Commits](https://github.com/rustyhorde/vergen/compare/8.2.4...8.2.5)

Updates `serde_json` from 1.0.105 to 1.0.107
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.105...v1.0.107)

Updates `async-compression` from 0.4.2 to 0.4.3
- [Release notes](https://github.com/Nullus157/async-compression/releases)
- [Changelog](https://github.com/Nullus157/async-compression/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Nullus157/async-compression/compare/async-compression-v0.4.2...async-compression-v0.4.3)

Updates `cargo_toml` from 0.15.3 to 0.16.0
- [Commits](https://gitlab.com/lib.rs/cargo_toml/commits/main)

Updates `proc-macro2` from 1.0.66 to 1.0.67
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.66...1.0.67)

Updates `syn` from 2.0.31 to 2.0.33
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.31...2.0.33)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: mimalloc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: vergen
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: async-compression
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: cargo_toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: deps
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-14 23:11:33 +00:00
Jiahao XU
11d4a80eba
Fixed and simplify dependabot configuration (#1357)
Fixed #1353

Merge all dependabot configuration for cargo into one, with directory
setting to `/` so that it will check for dep updates for entire
workspace while also updating lockfile in PR.

To prevent it from opening too many PRs, it's configured to run on
every Saturday, after `upgrade-transitive-deps.yml` is run.

It will also group all dependencies into one PR to prevent opening too
many PRs.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-14 21:51:36 +00:00
haitrungle
c02350e94c
Fix typo in install-from-binstall-release.sh (#1359) 2023-09-14 21:40:22 +00:00
Jiahao XU
4c339d9a2b
Add GitHub sponsor for maintainer NobodyXu (#1358)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-14 14:09:19 +00:00
Jiahao XU
f31db762b4
dep: Bump gix from v0.52.0 => v0.53.1 (#1354)
* dep: Bump gix from v0.52.0 => v0.53.1

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `gix` compilation: Enable `gix/max-performance-safe`

without this feature, `ThreadSafeRepository` does not implement `Sync`,
causes the `binstalk-registry` compilation to fail.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Enable `gix/comfort` for progress tracing

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fixed gix progress tracking: Enable `gix/progress-tree`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rm feature `gix/{comfort, progress-tree}`

Since they do not enable progress support and merely adds bloat.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix gix progress logging: Allow logging from simple-git

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Re-enable feature `gix/comfort` for more readable logging

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-14 13:31:00 +00:00
dependabot[bot]
f26ab41961
build(deps): update toml_edit requirement from 0.19.11 to 0.20.0 in /crates/binstalk-registry (#1356)
build(deps): update toml_edit requirement in /crates/binstalk-registry

Updates the requirements on [toml_edit](https://github.com/toml-rs/toml) to permit the latest version.
- [Commits](https://github.com/toml-rs/toml/compare/v0.19.11...v0.20.0)

---
updated-dependencies:
- dependency-name: toml_edit
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-14 03:07:40 +00:00
dependabot[bot]
cdb864fcb5
build(deps): update toml_edit requirement from 0.19.10 to 0.20.0 in /crates/binstalk-manifests (#1355)
build(deps): update toml_edit requirement in /crates/binstalk-manifests

Updates the requirements on [toml_edit](https://github.com/toml-rs/toml) to permit the latest version.
- [Commits](https://github.com/toml-rs/toml/compare/v0.19.10...v0.20.0)

---
updated-dependencies:
- dependency-name: toml_edit
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-14 03:07:36 +00:00
github-actions[bot]
984a2ef938
dep: Upgrade transitive dependencies (#1351)
Co-authored-by: github-actions <github-actions@github.com>
2023-09-08 05:26:56 +00:00
dependabot[bot]
c6c36316fd
build(deps): update file-format requirement from 0.19.0 to 0.20.0 in /crates/bin (#1349)
build(deps): update file-format requirement in /crates/bin

Updates the requirements on [file-format](https://github.com/mmalecot/file-format) to permit the latest version.
- [Release notes](https://github.com/mmalecot/file-format/releases)
- [Changelog](https://github.com/mmalecot/file-format/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mmalecot/file-format/compare/v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: file-format
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-08 04:08:18 +00:00
dependabot[bot]
b36674a1c4
build(deps): bump actions/checkout from 3 to 4 (#1348)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-07 01:25:18 +00:00
Jiahao XU
76a692224d
Fix detect-targets on Linux and add CI testing (#1344)
* Testing: Add `detect-targets/src/main.rs`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `detect-targets` linux: `guess_host_triple` could return wrong libc info

so it has to check it manually instead of simply providing alternatives
like other OSes.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `get_ld_flavor` for Alpine's gcompat glibc

Its output is different from regular glibc, so we need to hardcode that
particular cases.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix detection of alpine specific musl target

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add ci testing for Alpine

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add CI test for detect-targets on ubuntu

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor `get_ld_flavor`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix shellcheck

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add more CI test for ubuntu

and fixed typo in it

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rm distro specific target as it breaks `cargo-install` fallback

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Make sure all binaries are built in CI

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add `package.metadata.binstall` for `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix justfile

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `detect-targets-{alpine, ubuntu}-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `detect-targets-ubuntu-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `debug-targets-ubuntu-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* `set -exuo pipefail` in `detect-targets-ubuntu-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Simplify `detect-targets-*-test`: Use `Swatinem/rust-cache@v2` directly

instead of using `just-setup`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rm dup steps in `detect-targets-ubuntu-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add `ls` to detect-targets-alpine-test for debugging

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* FIx `detect-targets-alpine-test`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `get_ld_flavor`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `linux::detect_targets` on ubuntu & glibc system

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* FIx `linux::detect_targets` glibc checking

Check dynlib suffix

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-06 14:17:43 +00:00
dependabot[bot]
d657fbe518
build(deps): bump actions/checkout from 3 to 4 (#1346)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 02:10:48 +00:00
Jiahao XU
0fa315758b
feat detect-targets: Improve support of non-std glibc/musl (#1343)
* feat `detect-targets`: Improve support of non-std glibc/musl

Fixed #1329

 - Refactor: Create `linux::detect_alternative_targets` to reuse code
   from other targets
 - Run `/lib/ld-linux-{cpu_arch}.so.1 --version` for checking glibc
   support instead of running `ldd --version` since it could be non-std
   glibc installation and does not provide
   `/lib/ld-linux-{cpu_arch}.so.1`
 - Check for non-std glibc and add fallback target
   `{cpu_arch}-{distro_name}-linux-gnu{abi}`
 - Add `{cpu_arch}-{distro_name}-linux-musl{abi}` fallback for musl
   libc, specially for Alpine since it has a
   `/lib/ld-musl-{cpu_arch}.so.1`
 - For unknown libc flavor, check for the target provided before
   fallback to musl

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* feat `detect-targets`: Support glibc on musl target

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* feat `detect-targets`: Unify `Libc::{Gnu, Musl}` checks

since we can't really tell if we are on gnu or musl

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-02 23:19:34 +00:00
Jiahao XU
3e67e3624a
feat: Add more logging to binstalk-{downloader, registry} (#1340)
for debugging purposes.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-02 09:38:27 +00:00
Jiahao XU
3c5641610a
feat: Improve resolution logging and verbose logging (#1341)
* feat: Improve resolution logging

Fixed #1336

Log target of the pre-built binaries which will be installed.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix args parsing: `quiet` & `verbose` cannot be set at the same time

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* feat: Implies `--log-level debug` if `--verbose` is set

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-02 09:38:24 +00:00
github-actions[bot]
214163c434
dep: Upgrade transitive dependencies (#1338)
Co-authored-by: github-actions <github-actions@github.com>
2023-09-01 04:08:59 +00:00
Jiahao XU
b4b85c6314
Fixed binstalk-downloader docs.rs build (#1334)
Feature git is removed from binstalk-downloader, however we still enable it on docs.rs build.
2023-09-01 01:18:52 +00:00
Jiahao XU
8a08cdda6f
Fix GitHub token auto discovery (#1335)
* Fix GitHub token auto discovery

Fixed #1333

 - Rm dep `gh-token` since it is broken and we can simply run
   `gh auth token` in `cargo-binstall` instead.
 - binstalk-downloader: Make sure GitHub token is at least 40B long
   and other than the `_`, composes of only alphanumeric characters.
 - Warn on failure to read `git/credential` files
 - Optimize `try_from_home` to avoid heap allocation of `PathBuf`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix typo and clippy

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Simplify `is_valid_gh_token` & `is_ascii_alphanumeric` impl

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Improve err msg in `get_inner`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Improve err msg of `cargo_binstall::gh_token::get`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-09-01 01:14:59 +00:00
xd009642
0ca38ab0e3
Fix binstalk-downloader test: duplicated gnu cargo audit (#1337)
Fix duplicated gnu cargo audit

The gnu cargo audit release was duplicated instead of the gnu and musl
releases both being represented.
2023-08-31 21:40:33 +00:00
Jiahao XU
88702011c6
Use resolver 2 for cargo workspace (#1330)
Since some of our workspace crates still uses edition 2018, we need to
explicitly specify the resolver.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-26 07:33:04 +00:00
github-actions[bot]
d2c3377388
release: cargo-binstall v1.3.0 (#1326)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-25 10:52:36 +00:00
github-actions[bot]
accfb7af4e
dep: Upgrade transitive dependencies (#1327)
Co-authored-by: github-actions <github-actions@github.com>
2023-08-25 10:06:31 +00:00
Jiahao XU
e5567ae526
Fix clippy lint and format (#1328)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-25 08:53:50 +00:00
github-actions[bot]
d768b8c029
release: binstalk v0.16.0 (#1324)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-24 12:51:55 +00:00
Jiahao XU
84004a71a9
ci: Speedup release.yml by removing job test (#1325)
Since the merge_queue requires every PR to be tested, there is no need
to run the test again in `release.yml`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-24 12:51:28 +00:00
github-actions[bot]
58799cbe6f
dep: Upgrade transitive dependencies (#1323)
Co-authored-by: github-actions <github-actions@github.com>
2023-08-24 11:00:32 +00:00
github-actions[bot]
52b81aad2b
release: binstalk-fetchers v0.1.0 (#1322)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-24 10:24:07 +00:00
github-actions[bot]
0d90f515c1
release: binstalk-registry v0.1.0 (#1321)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-24 09:26:49 +00:00
github-actions[bot]
8a9fbfa502
release: binstalk-bins v0.1.0 (#1319)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-24 07:57:10 +00:00
github-actions[bot]
187a016468
release: binstalk-manifests v0.8.1 (#1317)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-24 05:30:01 +00:00
github-actions[bot]
a440b0e4a2
release: simple-git v0.1.0 (#1318)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-24 05:29:13 +00:00
github-actions[bot]
94ac906caa
release: binstalk-downloader v0.7.1 (#1320)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-24 05:28:59 +00:00
Jiahao XU
a28b1a8092
dep: Rm unused dep generic-array in binstalk-downloader (#1312)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-24 01:21:14 +00:00
Jiahao XU
6cc22b2c51
binstalk-fetchers: Add feature quickinstall (#1315)
Also fixed `package.metadata.docs.rs` for `binstalk-registry`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-24 00:05:27 +00:00
Jiahao XU
cb9cb0e937
Fix binstalk_downloader::Download for data-verifier (#1313)
To make sure the `data_verifier` consumes the entire file and produces
the correct checksum.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-24 00:04:57 +00:00
Jiahao XU
b9adaa006f
binstalk-registry: Use crates.io sparse index by default (#1314)
Fixed #1310

Also add rename `fetch_crate_cratesio` => `fetch_crate_cratesio_api` and
put it behind a new feature `crates_io_api`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-24 00:04:06 +00:00
Jiahao XU
0a71b39c90
ci: Fix release.yml being cancelled due to ci.yml (#1316)
Add a unique value to `concurrency.group` in `ci.yml` to prevent it from
being cancelled when releasing crates.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-24 00:03:15 +00:00
Jiahao XU
c99b83b720
dep: Bump reqwest to v0.11.19 (#1308)
Fixed #1292

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-22 13:45:37 +00:00
Jiahao XU
e1f2c4e41f
dep: Bump gix to v0.52.0
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-22 22:01:37 +10:00
dependabot[bot]
c19ee50130
build(deps): update file-format requirement from 0.18.0 to 0.19.0 in /crates/bin (#1307)
build(deps): update file-format requirement in /crates/bin

Updates the requirements on [file-format](https://github.com/mmalecot/file-format) to permit the latest version.
- [Release notes](https://github.com/mmalecot/file-format/releases)
- [Changelog](https://github.com/mmalecot/file-format/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mmalecot/file-format/compare/v0.18.0...v0.19.0)

---
updated-dependencies:
- dependency-name: file-format
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-21 13:10:20 +00:00
github-actions[bot]
382b32a380
release: cargo-toml-workspace v1.0.0 (#1306)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-19 04:51:04 +00:00
github-actions[bot]
251434408a
release: atomic-file-install v1.0.0 (#1305)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-19 04:50:39 +00:00
Jiahao XU
dc77a1ab93
Refactor: Extract new crate simple-git (#1304)
`binstalk-downloader` contains stuff about http(s) before the
git code is moved into it and now it becomes http and git.

While git indeed uses http stuff, which is why I decided to put
it into binstalk-downloader, it is more than just downloading
since it is stateful (can be cached locally and updated)
where as http is stateless.

Also `binstalk-downloader`'s codegen time now increases
dramatically and it also creates extra dependencies for
binstalk-fetchers, delaying its execution.

The git code also don't use anything from `binstalk-downloader`
at all, it makes sense to be an independent crate.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-19 01:08:55 +00:00
github-actions[bot]
20a57a9a9b
dep: Upgrade transitive dependencies (#1303)
Co-authored-by: github-actions <github-actions@github.com>
2023-08-18 05:05:22 +00:00
Jiahao XU
43973d7e86
Refactor cargo-binstall (#1302)
- Move implementation of `main` into the library part of
   `cargo-binstall` to speedup codegen.
 - Move  `manifests.rs` into `binstalk-manifests`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-18 01:59:48 +00:00
dependabot[bot]
4e73d0095f
build(deps): update windows requirement from 0.48.0 to 0.51.0 in /crates/atomic-file-install (#1301)
build(deps): update windows requirement in /crates/atomic-file-install

Updates the requirements on [windows](https://github.com/microsoft/windows-rs) to permit the latest version.
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/windows-targets-0.48.1...0.51.0)

---
updated-dependencies:
- dependency-name: windows
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-17 12:46:57 +00:00
Jiahao XU
0f7828569a
Add error logging if achieve doesn't contain bin required (#1298)
* Add `error` logging if achieve doesn't contain bin required

So that users know that this is an upstream issue and will report to
upstream.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update crates/binstalk/src/ops/resolve.rs

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-16 23:13:21 +00:00
Jiahao XU
146d3f8f43
Fix binstalk-downloader feature activation (#1297)
Fix use of `native-tls` and `git`, make sure that `gix` actually uses
`native-tls` in this scenario.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-16 22:34:03 +00:00
Jiahao XU
f0f0c2bd14
binstalk-registry: Rm rate-limit for crates.io registry (#1299)
Fixed #1295

The 1 request per second rate-limit is too strict and it makes
`cargo-binstall` very slow when resolving many crates in parallel.

Relying on the rate-limit in `binstalk_downloader::remote::Client`
should be good enough.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-16 21:18:41 +00:00
Jiahao XU
2215682e76
Update CI & dependabot: Add new crates (#1296)
and also add missing `crates/binstalk-bins/LICENSE`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-16 21:16:05 +00:00
Jiahao XU
0c5a65fb35
Refactor: Extract new crate binstalk-bins (#1294)
To reduce `binstalk` codegen and enable reuse of it.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-15 21:48:42 +00:00
Jiahao XU
76c72469eb
Refactor: Extract new crate binstalk-fetchers (#1291)
To reduce `binstalk` codegen and enable better reuse.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-14 03:20:34 +00:00
Jiahao XU
623f7ff4ed
Refactor: Extract new crate binstalk-registry (#1289)
To speedup codegen of `binstalk` and enable it to be reused.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-13 07:16:53 +00:00
Jiahao XU
6c801a97ae
Fix panic in atomic-file-install (#1290)
Do not panic if path does not have a parent, instead return an error.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-13 07:14:46 +00:00
Jiahao XU
2375ba48b6
Refactor to reduce compilation time (#1284)
- Make `binstalk::bins` private.
 - Move mod `signal` into `crates/bin`
 - Make items in `crates/bin/src/lib.rs` private if possible to reduce
   its API generation time.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-12 14:25:41 +00:00
Jiahao XU
fbed317df5
feat: git::Repository cancellation support (#1288)
feat: `git::Repository` support cancellation.

To make sure users can cancel git operation via signal, e.g. when the
git operation fail or users no longer want to install.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-12 14:18:02 +00:00
Jiahao XU
ef99dd795f
Refactor: Extract mod fs as crate atomic-file-install (#1286)
Refactor: Extract mod `fs` as crate `atomic-install`

To speedup codegen of `binstalk` and also publish a new crate that could
be reused.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-12 13:24:26 +00:00
Jiahao XU
8ff13c1b36
Refactor: Extract cargo_toml_workspace as a new crate (#1287)
To reduce codegen time of `binstalk` and also enable others to reuse
this crate.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-12 12:05:10 +00:00
Jiahao XU
c57356e870
Refactor: Move mod git into binstalk-downloader (#1285)
To speedup codegen time for `binstalk`, also fixed the docs.rs build for
`binstalk-downloader`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-12 07:20:26 +00:00
github-actions[bot]
6a1d317fde
release: cargo-binstall v1.2.1 (#1282)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-11 06:44:15 +00:00
Jiahao XU
b05abd862e
dep: Upgrade transitive dependencies (#1281)
Co-authored-by: github-actions <github-actions@github.com>
2023-08-11 06:39:09 +00:00
Jiahao XU
ba87a4af70
Speedup ci.yml: Set codegen-units to 4 (#1283)
Set `CARGO_PROFILE_RELEASE_CODEGEN_UNITS` to 4
since 1024 units are too many and our CI only have 2-3 cores.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-11 03:46:27 +00:00
github-actions[bot]
9e901c6b84
release: detect-targets v0.1.10 (#1280)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-11 02:22:13 +00:00
Jiahao XU
c4bb0fd77a
Include x86_64 & x86_64h in universal apple pre-built binary (#1279)
To makre sure it can run on pre-haswell Intel CPUs.

Fixed #1277

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-11 02:04:43 +00:00
Jiahao XU
a84844938d
Fix aarch64-apple-darwin fallback to x86_64h (#1278)
Run `arch -arch x86_64h /usr/bin/true` to decides whether fallback
is feasible.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-11 01:02:03 +00:00
github-actions[bot]
ea1a34b4a1
release: cargo-binstall v1.2.0 (#1275)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-10 11:33:39 +00:00
github-actions[bot]
cf3e3c25b0
release: binstalk v0.15.0 (#1274)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-10 07:54:29 +00:00
Jiahao XU
cf2a8a5287
dep: Bump tokio to v1.30.0 & disable feat parking_lot (#1273)
In tokio v1.30.0, MSRV is bumped to rust 1.63 and all `const_new`
methods in `tokio::sync` are now always available, so there is no need
to enable feat `parking_lot`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-10 07:17:40 +00:00
github-actions[bot]
070537076d
release: binstalk-downloader v0.7.0 (#1272)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-09 21:00:48 +00:00
Marcin Nowak-Liebiediew
42dddd972d
Add GitHub Action declaration for installing cargo-binstall (#1269)
add action.yml and test it
2023-08-09 20:50:16 +00:00
Jiahao XU
8e6dcc57ff
Fix release-pr.yml: Set RUSTFLAGS=--cfg reqwest_unstable (#1270)
for `binsalk-downloader` since its feature `http3` require this.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-09 20:14:34 +00:00
github-actions[bot]
000c87bcee
release: detect-targets v0.1.9 (#1268)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-08-09 11:02:53 +00:00
Jiahao XU
3e80b12748
feat: Verify cksum of crate tarball from cargo registry (#1260)
Fixed #1183

Since the crate tarball could be downloaded from a different set of
servers than where the cargo registry is hosted, verifying the checksum
is necessary to verify its integrity.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-09 10:57:47 +00:00
Jiahao XU
1c886d8897
Fix installation script on MacOS (#1263)
Fixed #1254

and also add CI for installation script and shellcheck.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-09 09:37:26 +00:00
Jiahao XU
7f1ddd1dd7
Reduce public interface of binstalk (#1265)
To reduce amount of breaking changes.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-09 07:46:12 +00:00
Jiahao XU
9c521d162a
Enable unstable feature reqwest/http3 in CI (#1261)
For dev and release build, so that pre-built binaries of
`cargo-binstall` can utilize http3 protocol.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-09 07:44:10 +00:00
Jiahao XU
a9e2ef11f1
Fix reading env CARGO_REGISTRIES_{registry_name}_INDEX (#1258)
Try bogth original and upper-case version.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-09 07:41:20 +00:00
github-actions[bot]
939c9b43b2
dep: Upgrade transitive dependencies (#1266)
Co-authored-by: github-actions <github-actions@github.com>
2023-08-09 05:07:46 +00:00
Jiahao XU
ac012bdcb2
Remove dep futures-lite from binstalk-downloader (#1259)
I planned to replace `futures-util` with `futures-lite`, but it turns
out that `reqwest` actually depends on `futures-util`, so there is no
point removing it and introduce yet another dependency.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-08 10:48:12 +00:00
Jiahao XU
2fbcf188a7
Revert "Use rust-lld in CI" (#1257)
Revert "Use `rust-lld` in CI (#1253)"

This reverts commit 1e4e0d166d.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-08 10:45:40 +00:00
github-actions[bot]
87cfac4bdf
dep: Upgrade transitive dependencies (#1255)
Co-authored-by: github-actions <github-actions@github.com>
2023-08-08 02:33:17 +00:00
Jiahao XU
1e4e0d166d
Use rust-lld in CI (#1253)
Which guarantees:
 - faster linking on all targets when `cargo-zigbuild` is not used
 - allow cross-lang-lto to be enabled

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-08 00:53:36 +00:00
Jiahao XU
435df675b3
Fix too many 429 response (#1231)
Fixed #1229

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-08 00:53:15 +00:00
Jiahao XU
e4c776f403
feat: Support data verification in Download (#1248)
By accepting `&mut dyn DataVerifier` for users to pass any callback that
uses `digest::Digest`/`digest::Mac`, `sigstore` or whatever they want.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-06 05:56:02 +00:00
Jiahao XU
3181e16e36
Fix CI: Require ziglang < 0.11 (#1250)
ziglang 0.11 causes link failure in our CI

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-06 04:53:47 +00:00
github-actions[bot]
c8d82fea0f
dep: Upgrade transitive dependencies (#1247)
Co-authored-by: github-actions <github-actions@github.com>
2023-08-04 04:11:27 +00:00
Jiahao XU
812fb9b0af
Fix subcrate resolution for wasm-bindgen-cli (#1245)
Fixed #1244

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-03 21:14:36 +00:00
Jiahao XU
aeacebcf83
feat: Support passing workspace to --manifest-path (#1246)
Previously it will load the root `Cargo.toml` and treat it as the
manifest for the crate, now it will check its `package.name` and would
search for the workspace if the `package.name` does not match the crate
name.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-03 21:12:06 +00:00
dependabot[bot]
b4cf580e4f
build(deps): update gix requirement from 0.50.0 to 0.51.0 in /crates/binstalk (#1242)
build(deps): update gix requirement in /crates/binstalk

Updates the requirements on [gix](https://github.com/Byron/gitoxide) to permit the latest version.
- [Release notes](https://github.com/Byron/gitoxide/releases)
- [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Byron/gitoxide/compare/gix-v0.50.0...gix-v0.51.0)

---
updated-dependencies:
- dependency-name: gix
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-03 04:54:51 +00:00
NAKASHIMA, Makoto
6ed7ea8b52
install-from-binstall-release.sh: Fix unbound variable error (#1241)
fixes #1240
2023-08-02 13:40:32 +00:00
Asger Hautop Drewsen
7c2ddd9a0c
Don't show warning if $CARGO_HOME/bin is in $PATH (#1239) 2023-08-02 11:34:43 +00:00
Jiahao XU
855ca88477
ci: Build MacOS universal exe from x86_64h-apple-darwin (#1238)
instead of `x86_64-apple-darwin` for better optimization since any
machine that support universal support x86_64h.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-02 03:37:21 +00:00
Jiahao XU
8756e39537
CI: Add release build for x86_64h-apple-darwin (#1234)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-02 02:22:16 +00:00
github-actions[bot]
b70cb9be64
dep: Upgrade transitive dependencies (#1237)
Co-authored-by: github-actions <github-actions@github.com>
2023-08-02 01:14:24 +00:00
Jiahao XU
d4e1f30e8f
Disable sha1-asm or zlib-ng on x86_64 linux (#1236)
Try to fix recent `Illegal instructions` happened in CI.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-01 11:33:57 +00:00
Jiahao XU
3a831a34c6
Bump dep target-lexicon to v0.12.11 (#1235)
To support new target x86h-apple-darwin

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-08-01 02:34:41 +00:00
Jiahao XU
d5549ce99e
detect-targets: Add fallback to x86_64-apple-darwin (#1233)
Fallback to `x86_64h-apple-darwin` if supported.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-28 07:59:23 +00:00
github-actions[bot]
333c1805e1
dep: Upgrade transitive dependencies (#1232)
Co-authored-by: github-actions <github-actions@github.com>
2023-07-28 06:05:56 +00:00
dependabot[bot]
ec494261c6
build(deps): update gix requirement from 0.49.1 to 0.50.0 in /crates/binstalk (#1230)
build(deps): update gix requirement in /crates/binstalk

Updates the requirements on [gix](https://github.com/Byron/gitoxide) to permit the latest version.
- [Release notes](https://github.com/Byron/gitoxide/releases)
- [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Byron/gitoxide/compare/gix-v0.49.1...gix-v0.50.0)

---
updated-dependencies:
- dependency-name: gix
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 07:13:55 +00:00
Jiahao XU
1293314100
feature: Add fallback x86_64h-apple-darwin and fallback for it (#1228)
Now `detect_targets` would fallback to `x86_64h-apple-darwin` on
`aarch64-apple-darwin`.

It also provides fallback to `x86_64h-apple-darwin` to
`x86_64-apple-darwin` and universal targets.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-23 04:28:59 +00:00
github-actions[bot]
38d37c69b2
release: cargo-binstall v1.1.2 (#1227)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-07-21 10:14:47 +00:00
github-actions[bot]
992ac08dfc
release: binstalk v0.14.1 (#1226)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-07-21 07:57:28 +00:00
Jiahao XU
306f761973
Fix failure to send quickinstall report (#1224)
Fixed #1222 by fetching lists of supported targets from quickinstall
repository.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-21 05:41:09 +00:00
github-actions[bot]
af9a574738
dep: Upgrade transitive dependencies (#1223)
Co-authored-by: github-actions <github-actions@github.com>
2023-07-21 04:12:46 +00:00
dependabot[bot]
da1be0ab45
build(deps): update gix requirement from 0.48.0 to 0.49.1 in /crates/binstalk (#1220)
build(deps): update gix requirement in /crates/binstalk

Updates the requirements on [gix](https://github.com/Byron/gitoxide) to permit the latest version.
- [Release notes](https://github.com/Byron/gitoxide/releases)
- [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Byron/gitoxide/compare/gix-v0.48.0...gix-v0.49.1)

---
updated-dependencies:
- dependency-name: gix
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-20 02:25:47 +00:00
github-actions[bot]
3d6a93fe8e
release: cargo-binstall v1.1.1 (#1219)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-07-19 05:07:52 +00:00
github-actions[bot]
494ff844e6
release: binstalk-manifests v0.8.0 (#1218)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-07-19 03:46:01 +00:00
Jiahao XU
47f79a9660
Fix loading .cargo/config.toml (#1217)
Fixed #1216

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-19 02:15:57 +00:00
github-actions[bot]
07bc44e059
release: cargo-binstall v1.1.0 (#1215)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-07-18 14:13:32 +00:00
Jiahao XU
83fdd053bf
Fix release-pr.yml: Do not check-semver for cargo-binstall release (#1214)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-18 12:56:33 +00:00
github-actions[bot]
61fdf16d7e
release: binstalk v0.14.0 (#1213)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-07-18 11:30:43 +00:00
github-actions[bot]
65d01f3199
release: binstalk-downloader v0.6.1 (#1212)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-07-18 09:42:38 +00:00
github-actions[bot]
8fa5e51ca0
release: binstalk-manifests v0.7.0 (#1211)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-07-18 09:36:12 +00:00
github-actions[bot]
c842defd57
dep: Upgrade transitive dependencies (#1210)
Co-authored-by: github-actions <github-actions@github.com>
2023-07-18 07:08:33 +00:00
Jiahao XU
0c5b7f115d
feat: Support --verbose --version/-vV (#1182)
that provides more information:

```
cargo-binstall: 1.0.0
build-date: 2023-07-18
build-target: aarch64-apple-darwin
build-features: default,fancy_no_backtrace,git,rustls,static,trust_dns,zstd_thin
build-commit-hash: 39d8cfc07f2253080ce997e620406c2994dced25
build-commit-date: 2023-07-18
rustc-version: 1.71.0
rustc-commit-hash: 8ede3aae28fe6e4d52b38157d7bfe0d3bceef225
rustc-llvm-version: 16.0
```

Fixed #627

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-18 05:22:41 +00:00
Jiahao XU
c11261b88f
CI: Relax rate limit to 30/1 (#1209)
`100/1` slows CI down to a snail when getting rate limited by GitHub.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-17 20:19:50 +00:00
Sebastian Thiel
5acfda9379
avoid worktree checkouts (#1207)
* perform a bare git cloen to avoid worktree checkouts

This will be way faster on windows

* feat: use the git repository directly to obtain crate information

* Apply code review changes

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Impl `fmt::Display` for `helpers::git::GitUrl`

and also refactor implementation of `git::Repository::{shallow_clone,
shallow_clone_bare}`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix clippy lint warnings

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix typo

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-17 15:46:12 +00:00
github-actions[bot]
b08849b7ce
dep: Upgrade transitive dependencies (#1206)
Co-authored-by: github-actions <github-actions@github.com>
2023-07-17 09:22:25 +00:00
github-actions[bot]
ef4e6d7cbf
dep: Upgrade transitive dependencies (#1202)
Co-authored-by: github-actions <github-actions@github.com>
2023-07-17 17:02:13 +10:00
dependabot[bot]
9af17de9c3
build(deps): update file-format requirement from 0.17.0 to 0.18.0 in /crates/bin (#1205)
build(deps): update file-format requirement in /crates/bin

Updates the requirements on [file-format](https://github.com/mmalecot/file-format) to permit the latest version.
- [Release notes](https://github.com/mmalecot/file-format/releases)
- [Changelog](https://github.com/mmalecot/file-format/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mmalecot/file-format/compare/v0.17.0...v0.18.0)

---
updated-dependencies:
- dependency-name: file-format
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-17 14:51:46 +10:00
Jiahao XU
ad58573143
feat: Read --rate-limit from env BINSTALL_RATE_LIMIT as a fallback (#1201)
feat: Scrap `--rate-limit` from env `BINSTALL_RATE_LIMIT` as a fallback

and set `BINSTALL_RATE_LIMIT` to `100/1` on CI.

Fixed #1196

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-17 13:07:15 +10:00
Jiahao XU
963e9e97ad
Use reflink_copy::reflink_or_copy in fs::atomic_install* (#1197)
to speedup copy operation `atomic_install*`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-17 11:56:10 +10:00
Jiahao XU
b3b682a1af
Optimize profile.dev: Set codege-units to 32 (#1199)
Splitting too many codege-units would actually takes longer to compile
due to overhead of parallelism in backend.

Also, our CI does not have that many CPU cores to take advantages of.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-17 00:48:12 +10:00
Jiahao XU
9746ce9ca3
Set opt-level for {binstall, tokio}-tar to "z" (#1203)
Trying to fix #1196

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-17 00:47:40 +10:00
Jiahao XU
d1fe5c7155
Fix clippy warning in binstalk_downloader (#1204)
Replace use of `PhantomData::default()` in `src/download.rs` with
`PhantomData` since it is a unit struct.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-16 13:50:04 +10:00
Jiahao XU
65670224b8
Simplify args::parse using clap::Arg::conflicts_with (#1198)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-11 13:20:51 +00:00
Jiahao XU
9d4694219b
speedup git shallow cloning: Enable gix/max-performance (#1186)
for targets:
 - x86_64-apple-darwin
 - aarch64-apple-darwin
 - x86_64-unknown-linux-gnu
 - x86_64-unknown-linux-musl

which will use `zlib-ng` to speedup decompression and use assembly
version for sha1 checksum calculation on supported CPU.

Also enable feature `zlib-ng` on windows and
 - aarch64-unknown-linux-gnu
 - aarch64-unknown-linux-musl

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-10 06:18:15 +00:00
Jiahao XU
7dea40a99a
Support --registry and more options from .cargo/config.toml (#1195)
Fixed #885

Now we can take advantage of new argument `--registry` and
env overrides:
 - `CARGO_REGISTRIES_DEFAULT` if `--registry` is not specified
 - `CARGO_REGISTRIES_{registry_name}_INDEX` for the registry index url

We can also read from `.cargo/config.toml` for:
 - default registry and registries configurations
 - additional CA bundle `http.cainfo`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-10 03:37:41 +00:00
Jiahao XU
d280e122ca
Speedup prebuilt binary (#1188)
After the merge of #1184, CI now takes 11m just to shallow clone
crates.io git index, which means that our user using alternative git
index would also be quite slow.

This commit speeds it up by building all dependencies with `-O3` in dev
and release build, in release build we build everything with `-O3`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-09 12:06:04 +00:00
Jiahao XU
c4b6921314
fix binstalk_downloader::GhApiClient json deser error (#1193)
When installing `cargo-expand` v1.0.59, I got an error message:

```
Failed to parse http response body as Json: invalid type: null, expected a string at line
1 column 90
```

This is because `GraphQLPageInfo::end_cursor` can actually be `null`, so
I change its type to `Option<CompactString>`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-09 10:39:18 +00:00
Jiahao XU
0813e80438
Fix GPL-3.0 license identifier (#1192)
Fixed #1189

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-07-07 07:24:05 +00:00
github-actions[bot]
f2f0cd2de6
dep: Upgrade transitive dependencies (#1191)
Co-authored-by: github-actions <github-actions@github.com>
2023-07-07 04:16:44 +00:00
Jiahao XU
01a87ac606
feat: Impl support for alternative registries (#1184)
Fixed #1168

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-30 03:52:40 +00:00
github-actions[bot]
d4ffc68129
dep: Upgrade transitive dependencies (#1187)
Co-authored-by: github-actions <github-actions@github.com>
2023-06-30 03:52:19 +00:00
dependabot[bot]
59c0d5dea9
build(deps): update gix requirement from 0.47.0 to 0.48.0 in /crates/binstalk (#1185)
build(deps): update gix requirement in /crates/binstalk

Updates the requirements on [gix](https://github.com/Byron/gitoxide) to permit the latest version.
- [Release notes](https://github.com/Byron/gitoxide/releases)
- [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Byron/gitoxide/compare/gix-v0.47.0...gix-v0.48.0)

---
updated-dependencies:
- dependency-name: gix
  dependency-type: direct:production
...

 - Also updated other dependencies to latest compatible version.

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-29 12:52:48 +00:00
Jiahao XU
f0c3d1e724
fix release-build.yml: Fix cache key for Swatinem/rust-cache@v2 (#1180)
Set `CARGO_*` env before caching is done.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-27 06:25:57 +00:00
Jiahao XU
3d81c147be
fix release-build.yml: Explicitly set release_name to the same as tag (#1181)
Fixed #699

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-27 06:25:38 +00:00
github-actions[bot]
f231f93976
release: cargo-binstall v1.0.0 (#1179)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-06-27 03:42:37 +00:00
github-actions[bot]
d2e4fef060
release: binstalk v0.13.0 (#1178)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-06-27 01:52:53 +00:00
github-actions[bot]
583860fbc6
release: binstalk-downloader v0.6.0 (#1177)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-06-26 14:17:53 +00:00
github-actions[bot]
beb826e6ae
release: binstalk-manifests v0.6.0 (#1176)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-06-26 13:44:34 +00:00
github-actions[bot]
c816f33ac0
release: binstalk-types v0.5.0 (#1175)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-06-26 12:27:56 +00:00
github-actions[bot]
ff7867a6a6
release: detect-targets v0.1.8 (#1174)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-06-26 10:23:31 +00:00
github-actions[bot]
c917f94f28
release: normalize-path v0.2.1 (#1173)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-06-26 08:22:39 +00:00
github-actions[bot]
88c7df6ea0
release: leon v2.0.1 (#1172)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-06-26 05:10:30 +00:00
github-actions[bot]
887f7593d3
dep: Upgrade transitive dependencies (#1171)
Co-authored-by: github-actions <github-actions@github.com>
2023-06-26 03:33:28 +00:00
Jiahao XU
2f890cc344
ci: Check package publish in release-pr.yml (#1170)
before creating the release PR.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-26 01:42:35 +00:00
github-actions[bot]
cd0939dcf5
dep: Upgrade transitive dependencies (#1169)
Co-authored-by: github-actions <github-actions@github.com>
2023-06-25 14:01:09 +00:00
Jiahao XU
4ddd860c01
ci: Verify before publishing (#1167)
Run `cargo-publish` without `--no-verify` to verify the publish is valid
and does not depend on unpublished crates in job tag of workflow
`release.yml`, which could be caused by incorrect merge order.

Also enabled `check-semver` to `cargo-bins/release-pr@v2` and install
`cargo-semver-checks` using `taiki-e/install-action@v2` in
job make-release-pr of workflow `release-pr.yml`, since
`release-pr` would try to use `cargo-binstall` for installing
`cargo-semver-checks` used in `check-semver`, but we did not explicitly
require `taiki-e/install-actions@v2` to install `cargo-binstall`, so
`release-pr` could fallback to `cargo-install` which is just too slow.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-24 15:23:15 +00:00
Jiahao XU
ca00cbaccc
feat: Support install directly from git repo (#1162)
Fixed #3

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-24 01:01:31 +00:00
dependabot[bot]
dd35fba232
build(deps): update itertools requirement from 0.10.5 to 0.11.0 in /crates/binstalk (#1163)
build(deps): update itertools requirement in /crates/binstalk

Updates the requirements on [itertools](https://github.com/rust-itertools/itertools) to permit the latest version.
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-itertools/itertools/compare/v0.10.5...v0.11.0)

---
updated-dependencies:
- dependency-name: itertools
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-23 04:24:08 +00:00
github-actions[bot]
12c1160a41
dep: Upgrade transitive dependencies (#1164)
Co-authored-by: github-actions <github-actions@github.com>
2023-06-23 04:24:06 +00:00
Jiahao XU
138112cd6e
Optimize TargetTriple: Use Cow<'static, str> (#1161)
instead of `CompactString` since `target_lexicon::{OperatingSystem,
Architecture, Environment}::into_str()` will return a `&'static str`
most of the time.

Also updated `SUPPORT.md`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-21 10:05:19 +00:00
Jiahao XU
abecd9ae14
ci: Publish to crates.io in release.yml after tagging (#1152)
Fixed #1046

so that we don't have to manually run `cargo-publish` after the CI is
merged.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-21 10:04:09 +00:00
Jiahao XU
d8419ea5a2
feat: Add more variables for template (#1160)
Fixed #775

 - Add dep target-lexicon v0.12.7
 - Add `target-{family, arch, libc, vendor}` to
   `package.metadata.binstall`.

For `{universal, universal2}-apple-darwin`, the `target-arch` is set to
`universal`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-20 22:05:13 +00:00
Jiahao XU
181b5293e7
dep: Bump strum v0.24.1 => v0.25.0 (#1159)
Also bump strum_macros v0.24.3 => v0.25.0

[strum and strum_macros v0.25.0 changelog][1]

[1]: https://github.com/Peternator7/strum/blob/master/CHANGELOG.md

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-20 00:16:10 +00:00
Jiahao XU
40efe02e34
fix leon & binstalk-downloader bug relating to features (#1153)
- ci: Check feat powerset of leon & binstalk-downloader in `ci.yml`
 - fix leon feature `cli`: Enable dep `miette` in feature `cli`
 - fix binstalk-downloader when default feature is disabled and no other
   tls related feature is enabled (breaking change due to replace of
   `tls::Version` with newtype `TLSVersion`).

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-19 02:22:09 +00:00
Jiahao XU
5c4a542de5
Remove unused .cargo/config (#1151)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-17 13:58:14 +00:00
Félix Saparelli
bea66d04b5
Fix PR CI triggers (#1150)
- Remove trigger on "auto merge" enablement, which is just annoying now with the merge queue and was only ever an additional workaround for the release PRs.
- Always run the PR CIs, don't ignore markdown files. That made it impossible to merge PRs that only touched those files (without bypassing requirements).
2023-06-17 10:17:24 +00:00
Félix Saparelli
a255e74fc9
Show license and source in long help (#1149)
* Show license and source in long help

Ref https://github.com/oeb25/binswap/issues/2

* Typo
2023-06-17 10:16:25 +00:00
Jiahao XU
1369eea802
fix dependabot path to crates (#1148)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-17 09:22:09 +00:00
Jiahao XU
cd7431e195
Add rust-toolchain.toml (#1147)
to fix dependabot

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-17 05:51:56 +00:00
github-actions[bot]
a08703874d
dep: Upgrade transitive dependencies (#1146)
Co-authored-by: github-actions <github-actions@github.com>
2023-06-16 03:46:16 +00:00
Jiahao XU
d390d320e9
Set upgrade-transitive-deps.yml to run on every Fri (#1145)
To avoid unnecessary PRs.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-12 01:23:12 +00:00
github-actions[bot]
fba862a4e8
dep: Upgrade transitive dependencies (#1144)
Co-authored-by: github-actions <github-actions@github.com>
2023-06-11 04:08:37 +00:00
github-actions[bot]
879f400d2c
dep: Upgrade transitive dependencies (#1143)
Co-authored-by: github-actions <github-actions@github.com>
2023-06-10 08:08:03 +00:00
github-actions[bot]
ce06c70d4c
dep: Upgrade transitive dependencies (#1142)
Co-authored-by: github-actions <github-actions@github.com>
2023-06-09 03:41:09 +00:00
github-actions[bot]
4e3b460a46
dep: Upgrade transitive dependencies (#1140)
Co-authored-by: github-actions <github-actions@github.com>
2023-06-07 04:28:25 +00:00
Jiahao XU
6b5384608e
GhApiClient misc improvements (#1139)
- Increase `DEFAULT_RETRY_DURATION` to 5 minutes, since GitHub enforces
   rate limit on an hourly basis.
 - Refactor `check_for_status` & `fetch_release_artifacts_restful_api`
 - Optimize `percent_decode_http_url_path`: Avoid `percent_decode_str`
   if there is no `%` in the `input`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-07 01:02:29 +00:00
Jiahao XU
16be14a07d
dependabot: Only create PR for incompatible updates (#1138)
for direct dependencies since compatible updates is already
covered by `update-transitive-deps.yml`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-06 11:46:47 +00:00
github-actions[bot]
1d754ef5b5
dep: Upgrade transitive dependencies (#1137)
Co-authored-by: github-actions <github-actions@github.com>
2023-06-06 05:31:32 +00:00
Jiahao XU
e62049d59d
ci: Fix cache-cleanup.yml non-zero exit status (#1136)
ci: Fix `cache-cleanup.yml` `cut` non-zero exit status

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-06 04:09:05 +00:00
dependabot[bot]
abf5a8e842
build(deps): bump file-format from 0.16.0 to 0.17.0 (#1135)
Bumps [file-format](https://github.com/mmalecot/file-format) from 0.16.0 to 0.17.0.
- [Release notes](https://github.com/mmalecot/file-format/releases)
- [Changelog](https://github.com/mmalecot/file-format/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mmalecot/file-format/compare/v0.16.0...v0.17.0)

---
updated-dependencies:
- dependency-name: file-format
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-06 02:47:25 +00:00
Jiahao XU
76cd4d62c2
dep: Add new workflow upgrade-transitive-deps.yml (#1130)
for upgrading transitive dependencies.

While dependabot is great, it opens one PR for each of these transitive
dependencies, which makes merging harder:
 - have to approve every PR
 - have to click merge when ci is done

it also creates merge queue runs and commits to main, thus creates a lot
of unused caches and unnecessary CI runs.

This PR creates `upgrade-transitive-deps.yml` that creates one PR for
all transitive change per-day.

It also configures dependabot to only `increase-if-necessary`, same as
library crates.

Since we have several library crates in our workspace, this would mean
that we would have less unnecessary deps bump on these library crates.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-05 14:09:42 +00:00
Jiahao XU
cc87fe062d
ci: Rm merge queue cache in cache-cleanup.yml (#1129)
since they cannot be reused

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-05 12:54:01 +00:00
dependabot[bot]
3cf2528273
build(deps): bump windows-sys from 0.42.0 to 0.48.0 (#1125)
Bumps [windows-sys](https://github.com/microsoft/windows-rs) from 0.42.0 to 0.48.0.
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.42.0...0.48.0)

---
updated-dependencies:
- dependency-name: windows-sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-05 04:06:58 +00:00
dependabot[bot]
34e02d9f0f
build(deps): bump libc from 0.2.144 to 0.2.145 (#1128)
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.144 to 0.2.145.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.144...0.2.145)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-05 04:06:49 +00:00
dependabot[bot]
bf46862140
build(deps): bump once_cell from 1.17.2 to 1.18.0 (#1127)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.17.2 to 1.18.0.
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.17.2...v1.18.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-05 02:29:41 +00:00
Zanie Adkins
f0a62754ad
Use uname -s for install script compatibility with outdated macOS GNU utils (#1123) 2023-06-04 19:32:41 +00:00
Jiahao XU
22b3419fce
feat: Add GraphQL support to GhApiClient (#1124)
Fixed #868

 - Add new fn `remote::Client::post`
 - Add new fn `remote::RequestBuilder::body`
 - Re-export `reqwest::Body` in `remote`
 - Add dep percent-encoding v2.2.0 to binstalk-downloader
 - Add dep serde-tuple-vec-map v1.0.1 to binstalk-downloader
 - Add GraphQL to `GhApiClient`, fallback to Restful API if token is not
   provided or authorization failed.
 - Fixed `GhReleaseArtifact::try_extract_artifact_from_str`: decode
   percent encoded http url path and add regression tests
 - Added variant `GhApiError::Context` & `GhApiContextError`
 - Added variant `GhApiError::GraphQLErrors` & `GhGraphQLErrors`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-04 14:09:49 +00:00
Jiahao XU
e87e3534a8
detect-targets: Add fallback to windows (#650)
Fixed #642

* Add new dep windows-sys v0.42.0 for win only
* Add new dep windows-dll v0.4.1 for win only
* Add x86_64 fallback targets for windows
* Add x86 fallback targets for windows
* Add arm32 fallback targets for windows
* Add arm64 fallback targets for windows
* Add gnu/gnu-llvm fallback targets for windows

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-04 03:58:05 +00:00
Jiahao XU
2acba14b41
GhApiClient: Fallback to unauthorized mode if auth token is invalid (#1121)
Fixed #850

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-04 02:29:42 +00:00
Jiahao XU
351b9d074a
dep: Update base64 and clap (#1120)
- base64 v0.21.0 -> v0.21.2, rollback msrv to 1.57
 - clap v4.3.0 -> v4.3.1, (derive) Reduce the amount of generated code
 - clap_builder v4.3.0 -> v4.3.1
 - clap_derive v4.3.0 -> v4.3.1

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-03 10:42:00 +00:00
Jiahao XU
1432093dcc
feat: Add new cmdline option --no-track (#1111)
Same as `cargo-install`'s `--no-track`.
It is also passed to `cargo-install` if it is invoked.

Also fixed `fs::atomic_symlink_file` which on Windows could fallback to
non-atomic install if symlinking failed.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-03 09:15:18 +00:00
Aadi Desai
a849db3ef4
Add one-liner for installing cargo-binstall on Windows (#1099)
* Add one-liner for installing `cargo-binstall` on Windows

* Change command separator to semicolon

`&&` was added in Powershell 7

* Update win install script to exit on error and trace
2023-06-03 09:15:11 +00:00
Jiahao XU
b876bdc8c7
e2e-tests: Check version of installed crates (#1119)
and also test `fetch_crate_cratesio_version_matched` in
`e2e-tests/live.sh`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-03 08:28:44 +00:00
dependabot[bot]
f1bfe23672
Bump cargo_toml from 0.15.2 to 0.15.3 (#1116)
Bumps [cargo_toml](https://gitlab.com/crates.rs/cargo_toml) from 0.15.2 to 0.15.3.
- [Commits](https://gitlab.com/crates.rs/cargo_toml/compare/v0.15.2...v0.15.3)

---
updated-dependencies:
- dependency-name: cargo_toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-02 04:40:31 +00:00
dependabot[bot]
d9a2dd0177
Bump openssl from 0.10.53 to 0.10.54 (#1117)
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.53 to 0.10.54.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.53...openssl-v0.10.54)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-02 04:35:28 +00:00
Jiahao XU
b69c082160
ci: Switch to Swatinem/rust-cache@v2 (#1113)
Fixed #1038

sccache is not very effective at caching dependencies, the external
C/C++ is recompiled in every ci and it takes a lot of time.

Compilation of other Rust dependencies also takes quite some time and
sccache is not helping at all, so I decided to switch to
`Swatinem/rust-cache@v2`.

The downside of the new caching method is that a new cache conntaining
part of the `.cargo/` and `target/` will be created whenver
`Cargo.lock`/`Cargo.toml` changes, but it can still reuse the old cache
to create new caching.

This is acceptable given that `sccache` often fails to reuse
cache due to rate limiting from GHA, since it is not designed for use
like a s3 object pool, and `sccache` will create a lot of new cache
artifacts for a given branch that cannot be reused in main and would
have to cleanup via a cronjob.

Edit:

rust 1.70 uses llvm 16.0, however ubuntu-latest still uses llvm 15.0
As such, during release-build, cross-lang-lto failed due to llvm is too
old.

Temporarily disable linker-plugin-lto to fix this.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-02 04:03:29 +00:00
Jiahao XU
9ecfce4104
Fallback to pull_request num or commit sha if github.ref is not available (#1115)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-02 09:25:24 +12:00
Jiahao XU
db6f3d2bfd
ci: Disable lto for ci.yml job release-builds (#1114)
LTO takes way too long and it is mature enough that it usually does not
have any miscompilation.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-01 09:48:00 +00:00
dependabot[bot]
92fdefbc9e
Bump fs4 from 0.6.4 to 0.6.5 (#1112)
Bumps [fs4](https://github.com/al8n/fs4-rs) from 0.6.4 to 0.6.5.
- [Commits](https://github.com/al8n/fs4-rs/commits)

---
updated-dependencies:
- dependency-name: fs4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-01 04:02:01 +00:00
Jiahao XU
e79bb2ab10
Include cargo-timings report in release build (#1110)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-01 03:58:11 +00:00
dependabot[bot]
7d11a379c4
Bump mio from 0.8.7 to 0.8.8 (#1109)
Bumps [mio](https://github.com/tokio-rs/mio) from 0.8.7 to 0.8.8.
- [Release notes](https://github.com/tokio-rs/mio/releases)
- [Changelog](https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/mio/commits)

---
updated-dependencies:
- dependency-name: mio
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-31 03:48:44 +00:00
dependabot[bot]
e789064289
Bump once_cell from 1.17.1 to 1.17.2 (#1106)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.17.1 to 1.17.2.
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.17.1...v1.17.2)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-30 04:06:18 +00:00
dependabot[bot]
dbb0893f4e
Bump openssl from 0.10.52 to 0.10.53 (#1105)
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.52 to 0.10.53.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.52...openssl-v0.10.53)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-30 03:53:14 +00:00
dependabot[bot]
02ca4b6e12
Bump log from 0.4.17 to 0.4.18 (#1103)
Bumps [log](https://github.com/rust-lang/log) from 0.4.17 to 0.4.18.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.17...0.4.18)

---
updated-dependencies:
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-29 04:22:23 +00:00
dependabot[bot]
f3c665a313
Bump syn from 2.0.16 to 2.0.18 (#1104)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.16 to 2.0.18.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.16...2.0.18)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-29 04:22:16 +00:00
dependabot[bot]
12346e21e8
Bump mio from 0.8.6 to 0.8.7 (#1102)
Bumps [mio](https://github.com/tokio-rs/mio) from 0.8.6 to 0.8.7.
- [Release notes](https://github.com/tokio-rs/mio/releases)
- [Changelog](https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/mio/commits)

---
updated-dependencies:
- dependency-name: mio
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-29 03:03:09 +00:00
dependabot[bot]
b23598ed85
Bump tokio from 1.28.1 to 1.28.2 (#1100)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.28.1 to 1.28.2.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.28.1...tokio-1.28.2)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-29 03:02:20 +00:00
github-actions[bot]
39748ecadf
release: binstalk-downloader v0.5.1 (#1095)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-05-26 16:06:51 +00:00
github-actions[bot]
62ca508e89
release: cargo-binstall v0.23.1 (#1097)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-05-26 15:57:45 +00:00
github-actions[bot]
47dbc99555
release: binstalk v0.12.1 (#1096)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-05-26 15:47:43 +00:00
dependabot[bot]
201ae15311
Bump quote from 1.0.27 to 1.0.28 (#1093)
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.27 to 1.0.28.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.27...1.0.28)

---
updated-dependencies:
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-26 04:33:00 +00:00
dependabot[bot]
a61f45fb63
Bump proc-macro2 from 1.0.58 to 1.0.59 (#1092)
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.58 to 1.0.59.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.58...1.0.59)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-26 02:20:14 +00:00
dependabot[bot]
32053e65ea
Bump regex from 1.8.2 to 1.8.3 (#1091)
Bumps [regex](https://github.com/rust-lang/regex) from 1.8.2 to 1.8.3.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.8.2...1.8.3)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-26 02:20:05 +00:00
xxchan
316dc50dff
fix typo (#1090) 2023-05-26 14:25:13 +12:00
Jiahao XU
e96477a116
Optimize fetch_crate_cratesio for exact version (#1089)
If `version_req` requests a specific version instead of a range, then
there is no need to pull all versions available from
https://crates.io/api/v1/crates

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-05-25 12:56:31 +00:00
Jiahao XU
256fb36e74
Require job release-builds to pass for merging (#1088)
Fixed #1072

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-05-25 12:49:06 +00:00
dependabot[bot]
8e04ee15a3
Bump io-lifetimes from 1.0.10 to 1.0.11 (#1087)
Bumps [io-lifetimes](https://github.com/sunfishcode/io-lifetimes) from 1.0.10 to 1.0.11.
- [Commits](https://github.com/sunfishcode/io-lifetimes/compare/v1.0.10...v1.0.11)

---
updated-dependencies:
- dependency-name: io-lifetimes
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-25 03:22:17 +00:00
dependabot[bot]
420015d6ce
Bump unicode-ident from 1.0.8 to 1.0.9 (#1086)
Bumps [unicode-ident](https://github.com/dtolnay/unicode-ident) from 1.0.8 to 1.0.9.
- [Release notes](https://github.com/dtolnay/unicode-ident/releases)
- [Commits](https://github.com/dtolnay/unicode-ident/compare/1.0.8...1.0.9)

---
updated-dependencies:
- dependency-name: unicode-ident
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-25 03:21:40 +00:00
Jiahao XU
f8255b1b81
dep: Downgrade tracing from v0.1.38 => v0.1.37 due to yanking (#1085)
Fixed #1019

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-05-24 14:27:05 +00:00
Jiahao XU
c9806cce78
Add one-liner for installing cargo-binstall on Linux/MacOS (#1074)
Fixed #1073

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-05-24 08:22:41 +00:00
dependabot[bot]
306f5d7e3d
Bump toml_edit from 0.19.9 to 0.19.10 (#1084)
Bumps [toml_edit](https://github.com/toml-rs/toml) from 0.19.9 to 0.19.10.
- [Commits](https://github.com/toml-rs/toml/compare/v0.19.9...v0.19.10)

---
updated-dependencies:
- dependency-name: toml_edit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-24 02:29:53 +00:00
dependabot[bot]
1cbac85f6d
Bump regex from 1.8.1 to 1.8.2 (#1082)
Bumps [regex](https://github.com/rust-lang/regex) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.8.1...1.8.2)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-23 03:04:57 +00:00
dependabot[bot]
73a3dc9da6
Bump bumpalo from 3.12.2 to 3.13.0 (#1083)
Bumps [bumpalo](https://github.com/fitzgen/bumpalo) from 3.12.2 to 3.13.0.
- [Changelog](https://github.com/fitzgen/bumpalo/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fitzgen/bumpalo/compare/3.12.2...3.13.0)

---
updated-dependencies:
- dependency-name: bumpalo
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-23 02:26:58 +00:00
dependabot[bot]
f694a9a356
Bump data-encoding from 2.3.3 to 2.4.0 (#1078)
Bumps [data-encoding](https://github.com/ia0/data-encoding) from 2.3.3 to 2.4.0.
- [Commits](https://github.com/ia0/data-encoding/commits/v2.4.0)

---
updated-dependencies:
- dependency-name: data-encoding
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-22 03:40:02 +00:00
dependabot[bot]
811283df56
Bump toml from 0.7.3 to 0.7.4 (#1079)
Bumps [toml](https://github.com/toml-rs/toml) from 0.7.3 to 0.7.4.
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.7.3...toml-v0.7.4)

---
updated-dependencies:
- dependency-name: toml
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-22 03:38:29 +00:00
dependabot[bot]
94643a1688
Bump linux-raw-sys from 0.3.7 to 0.3.8 (#1075)
Bumps [linux-raw-sys](https://github.com/sunfishcode/linux-raw-sys) from 0.3.7 to 0.3.8.
- [Commits](https://github.com/sunfishcode/linux-raw-sys/compare/v0.3.7...v0.3.8)

---
updated-dependencies:
- dependency-name: linux-raw-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-22 02:36:38 +00:00
dependabot[bot]
d2f792ffae
Bump clap from 4.2.7 to 4.3.0 (#1076)
Bumps [clap](https://github.com/clap-rs/clap) from 4.2.7 to 4.3.0.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.2.7...clap_complete-v4.3.0)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-22 02:35:41 +00:00
dependabot[bot]
d2abdf14e0
Bump digest from 0.10.6 to 0.10.7 (#1077)
Bumps [digest](https://github.com/RustCrypto/traits) from 0.10.6 to 0.10.7.
- [Commits](https://github.com/RustCrypto/traits/compare/digest-v0.10.6...digest-v0.10.7)

---
updated-dependencies:
- dependency-name: digest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-22 02:34:23 +00:00
Jiahao XU
1c3f5ff5e2
Switch binstalk-downloader license to "Apache-2.0 OR MIT" (#542)
Switch binstalk-downloader license to Apache-2.0 OR MIT




Signed-off-by: ryan kurte ryan+gh@kurte.nz

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: Félix Saparelli <felix@passcod.name>
Signed-off-by: Ryo Yamashita <qryxip@gmail.com>
Signed-off-by: ryan kurte ryan+gh@kurte.nz
2023-05-19 03:07:58 +00:00
dependabot[bot]
6e752c8201
Bump security-framework from 2.9.0 to 2.9.1 (#1067)
Bumps [security-framework](https://github.com/kornelski/rust-security-framework) from 2.9.0 to 2.9.1.
- [Release notes](https://github.com/kornelski/rust-security-framework/releases)
- [Commits](https://github.com/kornelski/rust-security-framework/compare/v2.9.0...v2.9.1)

---
updated-dependencies:
- dependency-name: security-framework
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-19 02:45:50 +00:00
dependabot[bot]
f2ac44757a
Bump miette from 5.8.0 to 5.9.0 (#1071)
Bumps [miette](https://github.com/zkat/miette) from 5.8.0 to 5.9.0.
- [Release notes](https://github.com/zkat/miette/releases)
- [Changelog](https://github.com/zkat/miette/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zkat/miette/compare/miette-derive-v5.8.0...miette-derive-v5.9.0)

---
updated-dependencies:
- dependency-name: miette
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-19 02:45:22 +00:00
dependabot[bot]
2667ccf6d9
Bump toml_edit from 0.19.8 to 0.19.9 (#1068)
Bumps [toml_edit](https://github.com/toml-rs/toml) from 0.19.8 to 0.19.9.
- [Commits](https://github.com/toml-rs/toml/compare/v0.19.8...v0.19.9)

---
updated-dependencies:
- dependency-name: toml_edit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-19 02:44:16 +00:00
dependabot[bot]
b101d38134
Bump proc-macro2 from 1.0.57 to 1.0.58 (#1065)
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.57 to 1.0.58.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.57...1.0.58)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-18 02:19:24 +00:00
dependabot[bot]
eb4984d271
Bump web-sys from 0.3.62 to 0.3.63 (#1064)
Bumps [web-sys](https://github.com/rustwasm/wasm-bindgen) from 0.3.62 to 0.3.63.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

---
updated-dependencies:
- dependency-name: web-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-17 03:05:10 +00:00
dependabot[bot]
08814a113e
Bump wasm-bindgen-futures from 0.4.35 to 0.4.36 (#1063)
Bumps [wasm-bindgen-futures](https://github.com/rustwasm/wasm-bindgen) from 0.4.35 to 0.4.36.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

---
updated-dependencies:
- dependency-name: wasm-bindgen-futures
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-17 02:39:53 +00:00
dependabot[bot]
71d864b4cc
Bump reqwest from 0.11.17 to 0.11.18 (#1062)
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.17 to 0.11.18.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.17...v0.11.18)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-17 02:39:10 +00:00
dependabot[bot]
249e4c4634
Bump proc-macro2 from 1.0.56 to 1.0.57 (#1061)
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.56 to 1.0.57.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.56...1.0.57)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-16 03:01:54 +00:00
dependabot[bot]
ec59445a98
Bump security-framework from 2.8.2 to 2.9.0 (#1059)
Bumps [security-framework](https://github.com/kornelski/rust-security-framework) from 2.8.2 to 2.9.0.
- [Release notes](https://github.com/kornelski/rust-security-framework/releases)
- [Commits](https://github.com/kornelski/rust-security-framework/compare/v2.8.2...v2.9.0)

---
updated-dependencies:
- dependency-name: security-framework
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-16 02:24:10 +00:00
dependabot[bot]
3e0b0a9760
Bump js-sys from 0.3.62 to 0.3.63 (#1060)
Bumps [js-sys](https://github.com/rustwasm/wasm-bindgen) from 0.3.62 to 0.3.63.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

---
updated-dependencies:
- dependency-name: js-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-16 02:22:24 +00:00
dependabot[bot]
ca25f3875c
Bump wasm-bindgen from 0.2.85 to 0.2.86 (#1058)
Bumps [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) from 0.2.85 to 0.2.86.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.85...0.2.86)

---
updated-dependencies:
- dependency-name: wasm-bindgen
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-16 02:20:22 +00:00
dependabot[bot]
b16d78d67e
Bump h2 from 0.3.18 to 0.3.19 (#1053)
Bumps [h2](https://github.com/hyperium/h2) from 0.3.18 to 0.3.19.
- [Release notes](https://github.com/hyperium/h2/releases)
- [Changelog](https://github.com/hyperium/h2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hyperium/h2/compare/v0.3.18...v0.3.19)

---
updated-dependencies:
- dependency-name: h2
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 04:59:09 +00:00
dependabot[bot]
74681da01e
Bump syn from 2.0.15 to 2.0.16 (#1054)
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.15 to 2.0.16.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.15...2.0.16)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 04:08:19 +00:00
dependabot[bot]
a8abd93486
Bump security-framework-sys from 2.8.0 to 2.9.0 (#1052)
Bumps [security-framework-sys](https://github.com/kornelski/rust-security-framework) from 2.8.0 to 2.9.0.
- [Release notes](https://github.com/kornelski/rust-security-framework/releases)
- [Commits](https://github.com/kornelski/rust-security-framework/compare/v2.8.0...v2.9.0)

---
updated-dependencies:
- dependency-name: security-framework-sys
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 03:28:49 +00:00
dependabot[bot]
5115d2a19d
Bump pin-project from 1.0.12 to 1.1.0 (#1055)
Bumps [pin-project](https://github.com/taiki-e/pin-project) from 1.0.12 to 1.1.0.
- [Release notes](https://github.com/taiki-e/pin-project/releases)
- [Changelog](https://github.com/taiki-e/pin-project/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project/compare/v1.0.12...v1.1.0)

---
updated-dependencies:
- dependency-name: pin-project
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 03:27:18 +00:00
dependabot[bot]
cedcd551c2
Bump gh-token from 0.1.1 to 0.1.2 (#1056)
Bumps [gh-token](https://github.com/dtolnay/star-history) from 0.1.1 to 0.1.2.
- [Release notes](https://github.com/dtolnay/star-history/releases)
- [Commits](https://github.com/dtolnay/star-history/compare/0.1.1...0.1.2)

---
updated-dependencies:
- dependency-name: gh-token
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-15 03:26:52 +00:00
Jiahao XU
9103a661f1
Simplify profile overrides in Cargo.toml using inherits (#1051)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-05-14 10:26:48 +00:00
dependabot[bot]
9a7445a88f
Bump serde from 1.0.162 to 1.0.163 (#1048)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.162 to 1.0.163.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.162...v1.0.163)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-12 03:55:08 +00:00
dependabot[bot]
aa19ea453a
Bump tracing-core from 0.1.30 to 0.1.31 (#1049)
Bumps [tracing-core](https://github.com/tokio-rs/tracing) from 0.1.30 to 0.1.31.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-core-0.1.30...tracing-core-0.1.31)

---
updated-dependencies:
- dependency-name: tracing-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-12 03:54:37 +00:00
Félix Saparelli
9a26c18763
Enable merge queue (#1047) 2023-05-12 03:52:34 +00:00
dependabot[bot]
0f5b9f1df0
Bump web-sys from 0.3.61 to 0.3.62 (#1045) 2023-05-11 03:59:40 +00:00
dependabot[bot]
3650510b07
Bump wasm-bindgen-futures from 0.4.34 to 0.4.35 (#1044) 2023-05-11 03:46:01 +00:00
dependabot[bot]
10af9394c4
Bump async-compression from 0.3.15 to 0.4.0 (#1043)
Bumps [async-compression](https://github.com/Nullus157/async-compression) from 0.3.15 to 0.4.0.
- [Release notes](https://github.com/Nullus157/async-compression/releases)
- [Changelog](https://github.com/Nullus157/async-compression/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Nullus157/async-compression/compare/0.3.15...async-compression-v0.4.0)

---
updated-dependencies:
- dependency-name: async-compression
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-11 13:39:17 +10:00
dependabot[bot]
62c59beca6
Bump tokio from 1.28.0 to 1.28.1 (#1042)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.28.0 to 1.28.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.28.0...tokio-1.28.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-11 13:37:55 +10:00
dependabot[bot]
164f2e5bde
Bump js-sys from 0.3.61 to 0.3.62 (#1039)
Bumps [js-sys](https://github.com/rustwasm/wasm-bindgen) from 0.3.61 to 0.3.62.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

---
updated-dependencies:
- dependency-name: js-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-10 14:11:59 +10:00
dependabot[bot]
ada76f6319
Bump bumpalo from 3.12.1 to 3.12.2 (#1040)
Bumps [bumpalo](https://github.com/fitzgen/bumpalo) from 3.12.1 to 3.12.2.
- [Changelog](https://github.com/fitzgen/bumpalo/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fitzgen/bumpalo/compare/3.12.1...3.12.2)

---
updated-dependencies:
- dependency-name: bumpalo
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-10 14:11:11 +10:00
dependabot[bot]
645ede257c
Bump wasm-bindgen from 0.2.84 to 0.2.85 (#1041)
Bumps [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) from 0.2.84 to 0.2.85.
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.84...0.2.85)

---
updated-dependencies:
- dependency-name: wasm-bindgen
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-10 14:10:33 +10:00
dependabot[bot]
c4d0f3885d
Bump libc from 0.2.143 to 0.2.144 (#1036)
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.143 to 0.2.144.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.143...0.2.144)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 19:16:28 +10:00
dependabot[bot]
c2e0ae02a8
Bump quote from 1.0.26 to 1.0.27 (#1037)
Bumps [quote](https://github.com/dtolnay/quote) from 1.0.26 to 1.0.27.
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.26...1.0.27)

---
updated-dependencies:
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-09 19:15:42 +10:00
dependabot[bot]
ff1625161e
Bump rustix from 0.37.15 to 0.37.19 (#1034)
Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.37.15 to 0.37.19.
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.37.15...v0.37.19)

---
updated-dependencies:
- dependency-name: rustix
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-08 15:09:22 +10:00
dependabot[bot]
46fb0c08a8
Bump libc from 0.2.142 to 0.2.143 (#1035)
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.142 to 0.2.143.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.142...0.2.143)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-08 15:02:08 +10:00
dependabot[bot]
9867b6f7be
Bump linux-raw-sys from 0.3.4 to 0.3.7 (#1033)
Bumps [linux-raw-sys](https://github.com/sunfishcode/linux-raw-sys) from 0.3.4 to 0.3.7.
- [Commits](https://github.com/sunfishcode/linux-raw-sys/compare/v0.3.4...v0.3.7)

---
updated-dependencies:
- dependency-name: linux-raw-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-08 15:00:01 +10:00
dependabot[bot]
cb906ae0bf
Bump serde from 1.0.160 to 1.0.162 (#1032)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.160 to 1.0.162.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.160...1.0.162)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-05 15:05:53 +10:00
dependabot[bot]
e9c7405081
Bump fs4 from 0.6.3 to 0.6.4 (#1031)
Bumps [fs4](https://github.com/al8n/fs4-rs) from 0.6.3 to 0.6.4.
- [Commits](https://github.com/al8n/fs4-rs/commits)

---
updated-dependencies:
- dependency-name: fs4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-05 15:04:51 +10:00
dependabot[bot]
024db639bc
Bump pkg-config from 0.3.26 to 0.3.27 (#1030)
Bumps [pkg-config](https://github.com/rust-lang/pkg-config-rs) from 0.3.26 to 0.3.27.
- [Release notes](https://github.com/rust-lang/pkg-config-rs/releases)
- [Changelog](https://github.com/rust-lang/pkg-config-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/pkg-config-rs/compare/0.3.26...0.3.27)

---
updated-dependencies:
- dependency-name: pkg-config
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-04 13:36:33 +10:00
dependabot[bot]
47588940f9
Bump tokio-stream from 0.1.13 to 0.1.14 (#1028)
Bumps [tokio-stream](https://github.com/tokio-rs/tokio) from 0.1.13 to 0.1.14.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Changelog](https://github.com/tokio-rs/tokio/blob/tokio-0.1.14/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-stream-0.1.13...tokio-0.1.14)

---
updated-dependencies:
- dependency-name: tokio-stream
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-03 22:02:18 +10:00
dependabot[bot]
1a98cdce2e
Bump libz-ng-sys from 1.1.8 to 1.1.9 (#1029) 2023-05-03 10:51:35 +00:00
dependabot[bot]
ba2d2e17cb
Bump winnow from 0.4.1 to 0.4.6 (#1027)
Bumps [winnow](https://github.com/winnow-rs/winnow) from 0.4.1 to 0.4.6.
- [Release notes](https://github.com/winnow-rs/winnow/releases)
- [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md)
- [Commits](https://github.com/winnow-rs/winnow/compare/v0.4.1...v0.4.6)

---
updated-dependencies:
- dependency-name: winnow
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-03 20:44:13 +10:00
dependabot[bot]
d92d604919
Bump anstream from 0.3.1 to 0.3.2 (#1026) 2023-05-03 10:41:45 +00:00
Jiahao XU
492f8ee59d
dependabot: Update deps of direct deps & simplify config (#1025)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-05-03 20:05:27 +10:00
dependabot[bot]
f2703e396a
Bump clap from 4.2.5 to 4.2.7 (#1024) 2023-05-03 04:10:00 +00:00
dependabot[bot]
763ddd0427
Bump async_zip from 0.0.13 to 0.0.15 (#1022)
* Bump async_zip from 0.0.13 to 0.0.15

Bumps [async_zip](https://github.com/Majored/rs-async-zip) from 0.0.13 to 0.0.15.
- [Release notes](https://github.com/Majored/rs-async-zip/releases)
- [Commits](https://github.com/Majored/rs-async-zip/commits)

---
updated-dependencies:
- dependency-name: async_zip
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix build error

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-05-01 21:23:43 +10:00
dependabot[bot]
52e2368e6c
Bump reqwest from 0.11.16 to 0.11.17 (#1021)
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.16 to 0.11.17.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.16...v0.11.17)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-01 18:27:00 +10:00
dependabot[bot]
ac1808eef6
Bump flate2 from 1.0.25 to 1.0.26 (#1020)
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.25 to 1.0.26.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/commits)

---
updated-dependencies:
- dependency-name: flate2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-01 18:26:17 +10:00
dependabot[bot]
2bb1869bc5
Bump dirs from 5.0.0 to 5.0.1 (#1023)
Bumps [dirs](https://github.com/soc/dirs-rs) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/soc/dirs-rs/releases)
- [Commits](https://github.com/soc/dirs-rs/commits)

---
updated-dependencies:
- dependency-name: dirs
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-01 18:25:04 +10:00
dependabot[bot]
56b3360b17
Bump clap from 4.2.4 to 4.2.5 (#1017) 2023-04-28 15:27:45 +10:00
Jiahao XU
b1b4394d80
Add & Enable new feat log_max_level_debug to speedup debug build (#1016)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-26 23:06:16 +10:00
github-actions[bot]
2103fdee2c
release: cargo-binstall v0.23.0 (#1014)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-04-26 21:12:37 +10:00
github-actions[bot]
8cc1430ca6
release: binstalk v0.12.0 (#1013)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-04-26 19:57:57 +10:00
Jiahao XU
6516805f10
Speedup release-build.yml: Do not run unit-tests (#1015)
`cargo-test` cannot share its artifacts with `cargo-build` and vice
versa, plus running `e2e-tests` in release build is enough to find out
potential miscompilation.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-26 19:57:48 +10:00
github-actions[bot]
1d97b8191d
release: binstalk-manifests v0.5.0 (#1012)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-04-26 18:44:31 +10:00
github-actions[bot]
f683b4075d
release: binstalk-downloader v0.5.0 (#1011)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-04-26 18:44:23 +10:00
github-actions[bot]
1a94a36311
release: leon-macros v1.0.0 (#1009)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-04-26 18:05:14 +10:00
github-actions[bot]
5b0268c768
release: binstalk-types v0.4.0 (#1008)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-04-26 17:31:21 +10:00
github-actions[bot]
613aae2b1e
release: leon v2.0.0 (#1007)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-04-26 17:30:24 +10:00
Jiahao XU
d6ec063a5d
Update transitive dependencies (#1006)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-26 16:50:16 +10:00
dependabot[bot]
7ca0edf004
Bump tokio-util from 0.7.7 to 0.7.8 (#1002) 2023-04-26 05:43:55 +00:00
dependabot[bot]
e4d88310ed
Bump tracing from 0.1.37 to 0.1.38 (#1005) 2023-04-26 04:39:51 +00:00
dependabot[bot]
a47ca44100
Bump tokio from 1.27.0 to 1.28.0 (#1001) 2023-04-26 04:09:29 +00:00
dependabot[bot]
815231a426
Bump mimalloc from 0.1.36 to 0.1.37 (#1004)
Bumps [mimalloc](https://github.com/purpleprotocol/mimalloc_rust) from 0.1.36 to 0.1.37.
- [Release notes](https://github.com/purpleprotocol/mimalloc_rust/releases)
- [Commits](https://github.com/purpleprotocol/mimalloc_rust/compare/v0.1.36...v0.1.37)

---
updated-dependencies:
- dependency-name: mimalloc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 13:40:05 +10:00
dependabot[bot]
bb68d67df1
Bump home from 0.5.4 to 0.5.5 (#1003)
Bumps [home](https://github.com/rust-lang/cargo) from 0.5.4 to 0.5.5.
- [Release notes](https://github.com/rust-lang/cargo/releases)
- [Changelog](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cargo/compare/home-0.5.4...home-0.5.5)

---
updated-dependencies:
- dependency-name: home
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-26 13:28:27 +10:00
Jiahao XU
02fe3d4f27
Fix leon::ValuesFn: impl for Fn(&str) -> Option<Cow<'static, str>> (#998)
If we impl it for `<'f> Fn(&str) -> Option<Cow<'f, str>> + 'f`, then it would somehow imply it to `'static` when using it in `benches/values.rs` and `benches/others.rs`, thus I decided to simplify it back to only implement it for `'static` string.

Users who wants more flexibility should implement `Values` themselves.

This commit also extracts `benches` as a separate crate in an independent workspace to avoid building criterion and tinytemplate in CI, which makes it much slower as more crates need to be built and criterion actually pulls in clap, and a whole lots of other crates.

In additional to that, it:
 - Impl `leon::Values` for `Arc<T>` & `Rc<T>` where T: `Values`
 - Enable lto, abort on panic, stripping, set `codege-units` to 1 for `leon/benches`
 - Move into closure of criterion benchmark loop to reduce indirections
    which also reduce sizes of the closure since the Fns used in `ValuesFn`
    are zero-size.
    This also means that the compiler can now assumes `no-alias`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-26 13:17:41 +10:00
Jiahao XU
c65e1269a0
Test building doc in ci.yml/lint (#999) 2023-04-25 07:48:44 +10:00
Jiahao XU
0261d12d9d
Support subcrate in repo (#991)
Fixed #838

 - Add new key `subcrate` for rendering `pkg-url`
 - Add new release paths in GitHub, GitLab & SourceForge using key `subcrate` for auto-detection
 - Add subcrate detection for GitHub and GitLab
 - Add `debug!` when using gh api token in `GhApiClient::new`
 - Add subcrate testing to `e2e-tests/subcrate.sh`
 - Bump cargo-release to 0.24.9 in e2e-tests/live.sh
   to fix test failure on MacOS without libssl installed in `/usr/local/`.
 - Optimize GhCrateMeta: Detect subcrate and repo-host in `Data::get_repo_info`
    to cache the result and avoid duplicate works, this also makes the code
    more ergonomic by removing the need to some `unwrap()` plus making it
    more efficient since we don't need to clone the url just to modify it.
 - Add instrument to `Data::get_repo_info`
 - Fix `shellcheck` err in `e2e-tests/*.sh`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-24 19:41:20 +10:00
Jiahao XU
5e269193c0
Add comment to src/binstalk-downloader/Cargo.toml (#996)
Add comment to binstalk-downloader/Cargo.toml

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-24 07:49:25 +00:00
dependabot[bot]
3e443f3360
Bump tracing-subscriber from 0.3.16 to 0.3.17 (#995) 2023-04-24 03:52:17 +00:00
dependabot[bot]
6d9bf0ef21
Bump clap from 4.2.3 to 4.2.4 (#994) 2023-04-20 02:25:32 +00:00
dependabot[bot]
3903b1f6e2
Bump clap from 4.2.2 to 4.2.3 (#992) 2023-04-19 04:13:01 +00:00
dependabot[bot]
913ec83918
Bump miette from 5.7.0 to 5.8.0 (#993)
Bumps [miette](https://github.com/zkat/miette) from 5.7.0 to 5.8.0.
- [Release notes](https://github.com/zkat/miette/releases)
- [Changelog](https://github.com/zkat/miette/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zkat/miette/compare/miette-derive-v5.7.0...miette-derive-v5.8.0)

---
updated-dependencies:
- dependency-name: miette
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-19 13:46:25 +10:00
Jiahao XU
5683ca2476
Add new crate leon-macros that provide template! with identical syntax as runtime parsing (#946)
`leon_macros::template!` can parse template at compile-time.
It accepts a utf-8 string literal and uses `leon` internally to parse it, then generate code that evaluates to `Template<'static>`.

 - Exclude fuzz from crate leon when publishing
 - Impl fn-like proc-macro `leon_macros::template!`
 - Add dep `leon-macros` to binstalk
 - Use `leon_macros::template!` in `binstalk::fetchers::gh_crate_meta::hosting`
 - Add doc for `leon-macros` in `leon`
 - Improve `std::fmt::Display` impl for `leon::ParseError`
 - Fixed broken infra link in leon

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-17 14:50:58 +10:00
Jiahao XU
fa0455a417
Update transitive dependencies (#990)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-17 13:42:53 +10:00
dependabot[bot]
345c14d7ba
Bump jobslot from 0.2.10 to 0.2.11 (#989)
Bumps [jobslot](https://github.com/cargo-bins/jobslot) from 0.2.10 to 0.2.11.
- [Release notes](https://github.com/cargo-bins/jobslot/releases)
- [Commits](https://github.com/cargo-bins/jobslot/compare/v0.2.10...v0.2.11)

---
updated-dependencies:
- dependency-name: jobslot
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-17 12:43:48 +10:00
dependabot[bot]
a5bf45abe9
Bump clap from 4.2.1 to 4.2.2 (#987) 2023-04-14 02:24:24 +00:00
dependabot[bot]
da59f0b707
Bump serde_json from 1.0.95 to 1.0.96 (#986)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.95 to 1.0.96.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.95...v1.0.96)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-13 13:17:30 +10:00
dependabot[bot]
067af4ea25
Bump serde from 1.0.159 to 1.0.160 (#985)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.159 to 1.0.160.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.159...v1.0.160)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-12 13:35:00 +10:00
Milo Moisson
75f48cce3e
feat: pretty print .crates.toml manifest to match cargo behaviour (#984)
Fixed #970
2023-04-11 00:48:01 +10:00
dependabot[bot]
8ccb6c887a
Bump futures-lite from 1.12.0 to 1.13.0 (#983)
Bumps [futures-lite](https://github.com/smol-rs/futures-lite) from 1.12.0 to 1.13.0.
- [Release notes](https://github.com/smol-rs/futures-lite/releases)
- [Changelog](https://github.com/smol-rs/futures-lite/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/futures-lite/compare/v1.12.0...v1.13.0)

---
updated-dependencies:
- dependency-name: futures-lite
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-10 12:54:49 +10:00
Jiahao XU
35b32c43e0
Run release-build.yml unconditionally for consistency & inc cache hits (#982)
Since it is run on PR anyway, we should also run it on main just in case
it fails, i.e. merging of PRs without rebasing against main to test out
latest changes.

It will now also be run on draft PR so that they can test out the
changes and find out bugs before making it ready to review.

This change will also increase cache hits on PR, thus speeding up the CI.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-06 18:08:14 +10:00
Jiahao XU
f134df548d
Optimize release-build.yml: Avoid building benchmark dependencies (#981)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-06 16:19:15 +10:00
David Weis
0de3b21004
Fix download link for armv7 release in readme (#980
Fix download link for armv7 in readme
2023-04-06 12:31:28 +12:00
dependabot[bot]
6c01968ce9
Bump mimalloc from 0.1.35 to 0.1.36 (#979)
Bumps [mimalloc](https://github.com/purpleprotocol/mimalloc_rust) from 0.1.35 to 0.1.36.
- [Release notes](https://github.com/purpleprotocol/mimalloc_rust/releases)
- [Commits](https://github.com/purpleprotocol/mimalloc_rust/compare/v0.1.35...v0.1.36)

---
updated-dependencies:
- dependency-name: mimalloc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-05 13:04:01 +10:00
Jiahao XU
f384088fd1
Avoid checking dev-deps for jobs *-check and lint in workflow ci.yml (#978)
Avoid checking dev-deps for jobs `*-check` and lint in workflow `ci.yml`

We just want to make sure cargo-binstall can compile for the target, we
don't want to pull in the extra dependencies.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-04 01:51:13 +10:00
Jiahao XU
8dd7aa5688
Speedup ci.yml: Do not run tests on x86_64-unknown-linux-musl (#976)
Speedup ci.yml: Do not run tests on x86_64-unknown-linux-musl

Since we already run test on x86_64-unknown-linux-musl in
release-build.yml and x86_64-unknown-linux-musl is almost identical to
x86_64-unknown-linux-gnu except for the libc, there's no need to run the
tests in ci.yml

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-04 01:40:26 +10:00
Jiahao XU
24634b2de1
Speedup workflow lipo in release-build.yml (#975)
Speedup workflow lipo in release-build

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-04 01:40:13 +10:00
Jiahao XU
6a224da9ee
Run unit tests in release-build.yml (#977)
Since release build enables a lot of optimization, disable debug assert
and possibly change the code to be run, it's better to run the tests
again.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-04-04 01:40:01 +10:00
dependabot[bot]
363dbc650a
Bump miette from 5.6.0 to 5.7.0 (#973) 2023-04-03 03:06:19 +00:00
dependabot[bot]
d7441e4675
Bump windows from 0.47.0 to 0.48.0 (#974) 2023-04-03 02:49:53 +00:00
dependabot[bot]
b3abfab7fd
Bump mimalloc from 0.1.34 to 0.1.35 (#972) 2023-04-03 02:39:33 +00:00
dependabot[bot]
885da90e38
Bump futures-util from 0.3.27 to 0.3.28 (#968) 2023-03-31 02:24:28 +00:00
dependabot[bot]
10e350af8d
Bump windows from 0.46.0 to 0.47.0 (#964) 2023-03-30 03:29:23 +00:00
dependabot[bot]
6bdfa0ee3c
Bump clap from 4.2.0 to 4.2.1 (#966) 2023-03-30 03:21:21 +00:00
dependabot[bot]
f46b0eab18
Bump tempfile from 3.4.0 to 3.5.0 (#967) 2023-03-30 02:49:38 +00:00
dependabot[bot]
9a33ec7bd5
Bump embed-resource from 2.0.0 to 2.1.1 (#965) 2023-03-30 02:38:11 +00:00
dependabot[bot]
b645cc6286
Bump serde from 1.0.158 to 1.0.159 (#959) 2023-03-29 23:12:31 +11:00
dependabot[bot]
877606ef40
Bump file-format from 0.15.0 to 0.16.0 (#960) 2023-03-29 23:11:34 +11:00
dependabot[bot]
57cb1f94ec
Bump clap from 4.1.14 to 4.2.0 (#961) 2023-03-29 23:10:55 +11:00
Jiahao XU
3a29ecaa36
Support GitHub fine-grained personal access token (#957)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-28 20:20:11 +11:00
dependabot[bot]
0fa729d742
Bump generic-array from 0.14.6 to 0.14.7 (#954)
Bumps [generic-array](https://github.com/fizyk20/generic-array) from 0.14.6 to 0.14.7.
- [Release notes](https://github.com/fizyk20/generic-array/releases)
- [Changelog](https://github.com/fizyk20/generic-array/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fizyk20/generic-array/commits)

---
updated-dependencies:
- dependency-name: generic-array
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-28 16:59:24 +11:00
dependabot[bot]
8109289e81
Bump clap from 4.1.11 to 4.1.14 (#952) 2023-03-28 05:58:21 +00:00
dependabot[bot]
96482c9dab
Bump tokio from 1.26.0 to 1.27.0 (#953)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.26.0 to 1.27.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.26.0...tokio-1.27.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-28 16:45:36 +11:00
dependabot[bot]
24c39c1af5
Bump serde_json from 1.0.94 to 1.0.95 (#955)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.94 to 1.0.95.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.94...v1.0.95)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-28 16:44:51 +11:00
dependabot[bot]
7ee1489d9c
Bump reqwest from 0.11.15 to 0.11.16 (#956)
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.15 to 0.11.16.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.15...v0.11.16)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-28 16:44:27 +11:00
dependabot[bot]
875747f7ef
Bump async_zip from 0.0.12 to 0.0.13 (#949)
* Bump async_zip from 0.0.12 to 0.0.13

Bumps [async_zip](https://github.com/Majored/rs-async-zip) from 0.0.12 to 0.0.13.
- [Release notes](https://github.com/Majored/rs-async-zip/releases)
- [Commits](https://github.com/Majored/rs-async-zip/commits)

---
updated-dependencies:
- dependency-name: async_zip
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix compilation

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-27 14:44:03 +11:00
dependabot[bot]
4af092f848
Bump embed-resource from 1.8.0 to 2.0.0 (#948) 2023-03-27 03:12:08 +00:00
dependabot[bot]
f1d6731e7a
Bump async-trait from 0.1.67 to 0.1.68 (#950) 2023-03-27 02:44:29 +00:00
Jiahao XU
a403c99d3f
Upgrade CI to use sccache v0.4.0 for caching (#934)
Remove `mozilla-actions/sccache-action@v0.0.2` and instead use `taiki-ie/install-action` to install `sccache`, since we already use `taiki-e/install-action` for installing crates.

This PR also refactor just-setup.yml and use pass `GITHUB_TOKEN` to `taiki-e/install-action` which uses `cargo-binstall` for installing `cargo-auditable` and `sccache`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-26 17:28:35 +11:00
Jiahao XU
a27d5aebf6
Use leon for template in binstalk & detect malformed pkg-url/pkg-fmt early (#933)
Fixed #851

* Add new dep leon to crate binstalk
* Add new variant `BinstallError::Template{Parse, Render}Error`
* Use `leon::Template` in mod `bins`
* Use `leon::Template` in mod `fetchers::gh_crate_meta`
* Refactor mod `bins`: Rm unused associated fn & fields from `Context`
* Simplify unit testing in mod `fetchers::gh_crate_meta`
* Rm soft-deprecated field `fetchers::gh_crate_meta::Context::format`
  and change the `match` to resolve `archive` => `self.archive_format`.
* Make macro_rules `leon::template!` far easier to use
* Construct `leon::Template<'_>` as constant in `gh_crate_meta::hosting`
* Simplify `leon::Values` trait
   Change its method `get_value` signature to
   
   ```rust
       fn get_value(&self, key: &str) -> Option<Cow<'_, str>>;
   ```
   
   Now, `ValuesFn` also accepts non-`'static` function, but now
   `leon::Values` is only implemented for `&ValuesFn<F>` now.
   
   This makes it a little bit more cumbersome to use but I think it's a
   reasonable drawback.
* Rm `Send` bound req from `ValuesFn`
* Impl new fn `leon::Template::cast`
   for casting `Template<'s>` to `Template<'t>` where `'s: 't`
* Rename `leon::Template::has_keys` => `has_any_of_keys`
* Make checking whether format related keys are present more robust
* Optimize `GhCrateMeta::launch_baseline_find_tasks`: Skip checking all fmt ext
   if none of the format related keys ("format", "archive-format",
   "archive-suffix") are present.
* Only ret `.exe` in `PkgFmt::extensions` on windows
   by adding a new param `is_windows: bool`
* Improve debug msg in `GhCrateMeta::fetch_and_extract`
* Add warnings to `GhCrateMeta::find`
* Rm dep tinytemplate
* `impl<'s, 'rhs: 's> ops::AddAssign<&Template<'rhs>> for Template<'s>`
* `impl<'s, 'rhs: 's> ops::AddAssign<Template<'rhs>> for Template<'s>`
* `impl<'s, 'item: 's> ops::AddAssign<Item<'item>> for Template<'s>`
* `impl<'s, 'item: 's> ops::AddAssign<&Item<'item>> for Template<'s>`
* `impl<'s, 'rhs: 's> ops::Add<Template<'rhs>> for Template<'s>` (improved existing `Add` impl)
* `impl<'s, 'rhs: 's> ops::Add<&Template<'rhs>> for Template<'s>`
* `impl<'s, 'item: 's> ops::Add<Item<'item>> for Template<'s>`
* `impl<'s, 'item: 's> ops::Add<&Item<'item>> for Template<'s>`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Félix Saparelli <felix@passcod.name>
2023-03-26 16:11:10 +11:00
Jiahao XU
47d4aeaa96
Run cache-cleanup at 3am & 4:30am AEST instead of after every PR (#944)
since cache-cleanup will issue a lot of gh api requests, running the
workflow right after the PRs would cause the GH API to rate limit all
workflows (including our CI for testing and release) that they can no
longer upload artifacts and `cargo-binstall` would have to fallback to
sending GET requests instead of using GH API, which makes it a lot
slower and more likely to fail.

This PR changes it to be run at 3am and 4:30am AEST which nobody would submit
any PR at that time and then remove all caches of the top 20 closed prs.

The workflow can also now be triggered manually.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-23 18:10:30 +11:00
dependabot[bot]
2ebc39478c
Bump toml_edit from 0.19.7 to 0.19.8 (#943)
Bumps [toml_edit](https://github.com/ordian/toml_edit) from 0.19.7 to 0.19.8.
- [Release notes](https://github.com/ordian/toml_edit/releases)
- [Commits](https://github.com/ordian/toml_edit/compare/v0.19.7...v0.19.8)

---
updated-dependencies:
- dependency-name: toml_edit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-23 14:35:01 +11:00
Jiahao XU
9a59119163
Fully remove all caches for PR in cache-cleanup.yml (#942)
Previously it only removes 30 caches for the PR because gh actions-cache list defaults to only listing 30 cache entries.

In this PR, I changed the limit to the maximum allowed 100 cache entries and I also added a loop to keep getting the next 100 cache entries until there is none.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-23 02:50:13 +13:00
github-actions[bot]
17610963de
release: cargo-binstall v0.22.0 (#941)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-23 00:44:11 +11:00
github-actions[bot]
b43d0c9dfe
release: binstalk v0.11.0 (#940)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-23 00:12:42 +11:00
github-actions[bot]
e58a79846f
release: binstalk-downloader v0.4.2 (#939)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-22 23:27:01 +11:00
github-actions[bot]
9ae7f40ea9
release: binstalk-manifests v0.4.1 (#938)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-22 22:53:51 +11:00
github-actions[bot]
0291259fa5
release: detect-targets v0.1.7 (#937)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-22 22:23:15 +11:00
Jiahao XU
b69d8c25cb
Enable --no-symlinks by default and fix sccache installation (#936)
Partially resolve #731

Using symlinks not only add unnecessary bloat to users' `$CARGO_HOME/bin` directory, but it actually breaks `sccache`, which inspects its binary name and decides how to act on.

For `sccache` to function, it must be invoked directly or use a hard link.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-22 21:58:37 +11:00
Jiahao XU
8b83e150bb
Bump transitive deps using cargo update --aggressive (#935)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-22 21:22:11 +11:00
Jiahao XU
44923d25ca
Rewrite Template::parse_items: More readable & better perf (#932)
Replace the algorithm with explicit state and complex matching with a loop that encodes state in the current structure of the loop.

The new code is much more readable and might be more performant since it uses `str::find`/`str::split_once` to look for next token instead of manually iterating over `str::chars`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-21 18:22:23 +11:00
dependabot[bot]
849d9ef9ee
Bump reqwest from 0.11.14 to 0.11.15 (#930) 2023-03-21 02:10:27 +00:00
github-actions[bot]
0d730b5e95
release: leon v1.0.0 (#931)
Co-authored-by: github-actions <github-actions@github.com>
2023-03-21 01:59:36 +00:00
Félix Saparelli
2227d363f7
Leon template library (#766)
* leon: first implementation

* Update crates/leon/src/values.rs

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* Workaround orphan rules to make API more intuitive

* Fmt

* Clippy

* Use CoW

* Use cow for items too

* Test that const construction works

* leon: Initial attempt at O(n) parser

* leon: finish parser (except escapes)

* leon: Improve ergonomics of compile-time templates

* Document helpers

* leon: Docs tweaks

* leon: Use macro to minimise parser tests

* leon: add escapes to parser

* leon: test escapes preceding keys

* leon: add multibyte tests

* leon: test escapes following keys

* Format

* Debug

* leon: Don't actually need to keep track of the key

* leon: Parse to vec first

* leon: there's actually no need for string cows

* leon: reorganise and redo macro now that there's no coww

* Well that was silly

* leon: Adjust text end when pushing

* leon: catch unbalanced keys

* Add error tests

* leon: Catch unfinished escape

* Comment out debugging

* leon: fuzz

* Clippy

* leon: Box parse error

* leon: &dyn instead of impl

* Can't impl FromStr, so rename to parse

* Add Vec<> to values

* leon: Add benches for ways to supply values

* leon: Add bench comparing to std and tt

* Fix fuzz

* Fmt

* Split ParseError and RenderError

* Make miette optional

* Remove RenderError lifetime

* Simplify ParseError type schema

* Write concrete Values types instead of generics

* Add license files

* Reduce criterion deps

* Make default a cow

* Add a CLI leon tool

* Fix tests

* Clippy

* Disable cli by default

* Avoid failing the build when cli is off

* Add to ci

* Update crates/leon/src/main.rs

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update crates/leon/Cargo.toml

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>

* Bump version

* Error not transparent

* Diagnostic can do forwarding

* Simplify error type

* Expand doc examples

* Generic Values for Hash and BTree maps

* One more borrowed

* Forward implementations

* More generics

* Add has_keys

* Lock stdout in leon tool

* No more debug comments in parser

* Even more generics

* Macros to reduce bench duplication

* Further simplify error

* Fix leon main

* Stable support

* Clippy

---------

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-21 01:36:02 +00:00
Jiahao XU
daf8cdd010
Bump transtive deps (#929)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-21 12:04:00 +11:00
dependabot[bot]
6a9827e66f
Bump serde from 1.0.156 to 1.0.157 (#926) 2023-03-20 04:02:13 +00:00
dependabot[bot]
b3dc52f6d7
Bump clap from 4.1.9 to 4.1.11 (#927) 2023-03-20 03:39:08 +00:00
dependabot[bot]
dd4595e6a4
Bump thiserror from 1.0.39 to 1.0.40 (#928) 2023-03-20 03:35:45 +00:00
dependabot[bot]
bbb4eb7e58
Bump dirs from 4.0.0 to 5.0.0 (#925) 2023-03-20 02:50:04 +00:00
dependabot[bot]
30c1e6af8f
Bump async-trait from 0.1.66 to 0.1.67 (#924) 2023-03-20 02:48:52 +00:00
Jiahao XU
f28c05b0ee
Fix QuickInstall report bug for target universal2-apple-darwin (#921)
This bug was reintroduced by #919 and it was fixed by #918

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-18 22:35:48 +13:00
Jiahao XU
a6e52afaa0
Retry http request on connection error (#922) 2023-03-18 22:35:18 +13:00
Jiahao XU
06b89b2d18
Add alias universal2-apple-darwin to universal-apple-darwin (#919)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-17 22:30:55 +11:00
Jiahao XU
cc78ff3b90
Fix fetcher::QuickInstallstats report sending (#918)
Fixed https://github.com/cargo-bins/cargo-quickinstall/issues/195

 - Fix `fetchers::QuickInstall`: Stop sending stats for `universal-apple-darwin`
   since quickinstall only supports targets officially supports by rust.
 - Only send stats report to quickinstall if the `Fetcher::find` is `.await`ed on
   
   This prevents stats report to be sent for cases where the `QuickInstall` fetcher
   is actually unused, e.g. resolved to `GhCrateMeta` or other `QuickInstall` fetcher
   with different target.
   
   This also reduces amount of http requests created in background.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-17 21:05:19 +11:00
dependabot[bot]
6843f478a9
Bump clap from 4.1.8 to 4.1.9 (#917) 2023-03-17 02:25:23 +00:00
dependabot[bot]
2c19c3afd4
Bump toml_edit from 0.19.6 to 0.19.7 (#916)
Bumps [toml_edit](https://github.com/ordian/toml_edit) from 0.19.6 to 0.19.7.
- [Release notes](https://github.com/ordian/toml_edit/releases)
- [Commits](https://github.com/ordian/toml_edit/compare/v0.19.6...v0.19.7)

---
updated-dependencies:
- dependency-name: toml_edit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-16 13:56:23 +11:00
Jiahao XU
58b7044e98
Use install.root in $CARGO_HOME/config.toml (#884)
Fixed #859

* Impl `cargo_config`
* Use `install.root` in `$CARGO_HOME/.cargo/config.toml`
   before fallback to `cargo_home`.
* Improve logging in `get_cargo_roots_path`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-16 11:53:12 +11:00
dependabot[bot]
3e830c9fad
Bump serde from 1.0.155 to 1.0.156 (#912)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.155 to 1.0.156.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.155...v1.0.156)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-15 15:56:30 +11:00
dependabot[bot]
ca7b489663
Bump miette from 5.5.0 to 5.6.0 (#913)
Bumps [miette](https://github.com/zkat/miette) from 5.5.0 to 5.6.0.
- [Release notes](https://github.com/zkat/miette/releases)
- [Changelog](https://github.com/zkat/miette/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zkat/miette/compare/miette-derive-v5.5.0...miette-derive-v5.6.0)

---
updated-dependencies:
- dependency-name: miette
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-15 15:56:07 +11:00
Félix Saparelli
48b85cc38f
Cleanup caches for closed PRs (#915)
As suggested here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#managing-caches
2023-03-15 15:44:06 +11:00
Jiahao XU
42bffef98c
Use sccache for build cache and disable incremental mode in CI (#914)
Fixed #911

sccache cannot cache build artifacts if incremental mode is enabled.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-15 15:42:42 +11:00
github-actions[bot]
c04b15dbc8
release: cargo-binstall v0.21.3 (#910)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-14 19:30:56 +11:00
github-actions[bot]
63443e88b1
release: binstalk v0.10.0 (#909)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-14 18:31:20 +11:00
Jiahao XU
d118fa8fdb
Obey crates.io crawler policy: Only make one request per sec (#908)
Fixed https://github.com/taiki-e/install-action/issues/89

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-14 17:11:22 +11:00
dependabot[bot]
f37796a55f
Bump toml_edit from 0.19.5 to 0.19.6 (#906) 2023-03-14 02:38:54 +00:00
dependabot[bot]
6df38f1f11
Bump windows from 0.44.0 to 0.46.0 (#905) 2023-03-14 02:32:36 +00:00
github-actions[bot]
9e3223acf8
release: cargo-binstall v0.21.2 (#904)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-14 00:14:19 +11:00
github-actions[bot]
57182fae70
release: binstalk v0.9.1 (#903)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-13 23:01:05 +11:00
github-actions[bot]
5e4e047493
release: binstalk-downloader v0.4.1 (#902)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-13 10:41:06 +00:00
Jiahao XU
89a47cbec9
Fix extract_tar_based_stream: Normalize path before adding them to ExtractedFiles (#901)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-13 21:27:50 +11:00
Félix Saparelli
e89b8e2463
Use known-working versions for tests (#900) 2023-03-13 18:11:29 +13:00
github-actions[bot]
5f1d5ce559
release: cargo-binstall v0.21.1 (#899)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-13 15:11:10 +11:00
Félix Saparelli
b29234c93b
Clarify git credential code and fix infinite loop bug (#898)
Fixes #897
2023-03-13 14:40:36 +11:00
dependabot[bot]
fce7141bec
Bump semver from 1.0.16 to 1.0.17 (#895) 2023-03-13 03:13:07 +00:00
dependabot[bot]
f6056c8904
Bump toml_edit from 0.19.4 to 0.19.5 (#896) 2023-03-13 02:55:32 +00:00
dependabot[bot]
45952446d6
Bump serde from 1.0.154 to 1.0.155 (#894) 2023-03-13 02:40:10 +00:00
github-actions[bot]
ba9fa170c0
release: cargo-binstall v0.21.0 (#893)
Co-authored-by: github-actions <github-actions@github.com>
2023-03-13 12:29:51 +13:00
github-actions[bot]
a7d8574c4a
release: binstalk v0.9.0 (#892)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-12 22:52:43 +11:00
github-actions[bot]
bb272347da
release: binstalk-downloader v0.4.0 (#891)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-12 22:14:18 +11:00
github-actions[bot]
c188f85ec9
release: binstalk-manifests v0.4.0 (#888)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-12 20:42:10 +11:00
github-actions[bot]
5b92b43a87
release: detect-targets v0.1.6 (#889)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-12 20:15:31 +11:00
github-actions[bot]
45045041a4
release: binstalk-types v0.3.0 (#887)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-03-12 08:18:34 +00:00
Jiahao XU
235d324d3d
Add job windows-aarch64-check to workflow ci (#882)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-11 23:46:26 +11:00
Jiahao XU
00b8a417e6
Update doc for --github-token (#886) 2023-03-11 23:46:14 +11:00
Jiahao XU
3e0d7363a5
Read from env GH_TOKEN for github_token as a fallback (#883)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-11 18:10:40 +11:00
Félix Saparelli
ff5276f4f4
Squash lint warning on windows (#881)
Squash warning on windows
2023-03-11 19:17:50 +13:00
Jiahao XU
c5d0b84aa6
Perform startup/init code eagerly in entry::install_crates (#880)
The startup/init code in `entry::install_crates` performs a lot of blocking operations, from testing if dir exists to reading from files and there is no `.await` in there until after the startup.

There are also a few cases where `block_in_place` should be called (e.g. loading manifests, loading TLS certificates) but is missing.

Most of the `Args` passed to `entry::install_crates` are actually consumed before the first `.await` point, so performing startup/init code eagerly would make the generated future much smaller, reduce codegen and also makes it easier to optimize.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-11 15:06:46 +11:00
Jiahao XU
18bc81f46f
Use cargo-auditable for release build (#878)
to make the pre-built artifacts auditable by `cargo-audit` and other
tools.

* Add new env `JUST_USE_AUDITABLE` to enable use of `cargo-auditable`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-11 15:57:14 +13:00
Félix Saparelli
ac414df5be
Use stable sparse registry option (#879) 2023-03-11 01:58:58 +00:00
EdJoPaTo
620d0e5f9e
docs(readme): fix link to metadata (#877)
Co-authored-by: Félix Saparelli <felix@passcod.name>
2023-03-11 13:56:57 +13:00
Jiahao XU
a22cb3a332
Fix x86_64 fallback for aarch64 MacOS (#875) 2023-03-10 22:09:16 +11:00
Jiahao XU
9c617c2f8a
Enable only feature cross-lang-fat-lto on MacOS (#876) 2023-03-10 22:08:54 +11:00
dependabot[bot]
cfbdf1181f
Bump serde from 1.0.153 to 1.0.154 (#874) 2023-03-09 02:35:50 +00:00
dependabot[bot]
f5c30c2f8c
Bump serde from 1.0.152 to 1.0.153 (#873) 2023-03-08 02:37:38 +00:00
Jiahao XU
ecd599bfa8
Verify syntax of the github token provided in GhApiClient::new (#870)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-07 18:48:01 +11:00
dependabot[bot]
174b6c8144
Bump file-format from 0.14.0 to 0.15.0 (#872) 2023-03-07 02:44:31 +00:00
Jiahao XU
72789874f0
Use Quickinstall new release schema (#867)
- Refactor: Extract new fn `binstalk::helpers::remote::does_url_exist`
 - Use new quickinstall release schema in `binstalk::fetchers::QuickInstall`
 - Optimize `fetchers::QuickInstall`: Generate url once in `Fetcher::new`
    Avoid repeated string allocation plus `Url` parsing.
    This also makes changing package_url and stats_url easier.
 - Optimize `QuickInstall::report`: Use HEAD instead of GET

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-06 08:13:08 +00:00
Jiahao XU
01c8ecb778
Fix zip extraction and bins::infer_bin_dir_template (#869)
- Fix zip extraction code: Ensure dir is rwx and file is readable for curr user
 - Add more integration test for `ExtractedFiles`
 - Fix `bins::infer_bin_dir_template` introduced in #856

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-06 17:54:31 +11:00
dependabot[bot]
460522f5bd
Bump thiserror from 1.0.38 to 1.0.39 (#865) 2023-03-06 03:45:37 +00:00
dependabot[bot]
eff8a50d13
Bump command-group from 2.0.1 to 2.1.0 (#864) 2023-03-06 03:36:02 +00:00
dependabot[bot]
a6a42f30af
Bump async-trait from 0.1.64 to 0.1.66 (#866) 2023-03-06 03:16:31 +00:00
dependabot[bot]
7f00d803f7
Bump gh-token from 0.1.0 to 0.1.1 (#863) 2023-03-06 03:14:41 +00:00
dependabot[bot]
1f18deb142
Bump serde_json from 1.0.93 to 1.0.94 (#862)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.93 to 1.0.94.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.93...v1.0.94)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-06 14:01:17 +11:00
Félix Saparelli
ee909e4045
Rename --roots to --root (with alias for back compat) (#861)
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-06 01:05:32 +00:00
Jiahao XU
44e81c7e1a
Fix: Pass value of --roots to cargo-install as --root (#860)
Pass value of `--roots` to `cargo-install` as `--root`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-06 11:52:28 +11:00
Jiahao XU
9c7da6a179
Return a list of files written to disk in binstalk_downloader::download::Download::and_extract (#856)
to avoid collecting extracted files from disk again in resolution stage.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-03 23:31:27 +11:00
Jiahao XU
44ac63ce0d
Extract GitHub token from file if --github-token or env variable GITHUB_TOKEN is not present (#849)
- Add option `--no-discover-github-token` for disabling this behavior
 - Add new dep gh-token v0.1.0 to crates/bin
 - Extract github-token from git-credentials or gh config if `--github-token` or
    environment variable `GITHUB_TOKEN` is not present.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-03 17:32:50 +13:00
Jiahao XU
75289cc2b4
Only use GET in remote::Client::remote_gettable (#847)
Fixed #835

Using `HEAD` for this would often cause false negative that requires the `Client` to fallback to `GET`, which creates a lot of requests even if the url doesn't exist and then get cargo-binstall rate limited by GitHub/GitLab/etc.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-03 13:29:58 +11:00
Jiahao XU
8eee318ccd
Replace dep crates_io_api with in-house solution (#846)
It also uses `max_stable_version` in the json downloaded from https://crates.io/api/v1/crates/$name if possible, which is equivalent to the version shown on https://crates.io/crates/$name .

 - Add new feat `json` to `binstalk-downloader`
 - Impl new async fn `Response::json`
 - use `Response::json` in `GhApiClient` impl
 - Mark all err types in binstalk-downloader as `non_exhaustive`
 - Ret `remote::Error` in `remote::Certificate::{from_pem, from_der}` instead of `ReqwestError`.
 - Refactor `BinstallError`: Merge variant `Unzip`, `Reqwest` & `Http`
    into one variant `Download`.
 - Manually download and parse json from httos://crates.io/api/v1
 - Remove unused deps `crates_io_api`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-02 18:25:34 +11:00
dependabot[bot]
c00d648dac
Bump jobslot from 0.2.9 to 0.2.10 (#844) 2023-03-02 05:19:38 +00:00
Jiahao XU
44eaff97dc
Fix use of hashFiles in key of bulid-cache (#845)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-02 15:40:39 +11:00
dependabot[bot]
fcbdfcf04f
Bump tokio from 1.25.0 to 1.26.0 (#843) 2023-03-02 03:02:43 +00:00
Jiahao XU
c8b92b1985
Speedup CI (#842)
- Remove `tools: cross` input to `actions/just-setup`
    since we use `cargo-zigbuild` for cross compiling instead of `cross-rs`
    now.
 - Only install `cargo-zigbuild` in `just ci-install-deps` if `JUST_USE_CARGO_ZIGBUILD` is enabled
 - Include hash of `rustc -vV` in `build-cache`
    Switching between different versions of `rustc` will cause all crates to be
    rebuilt using new `rustc`.
 - Replace input `cache` with `index-cache` and `build-cache` in `actions/just-setup`
    for better control of caching behavior
 -  Reuse workflow `test`'s `build-cache` in workflow `lint`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-02 13:09:25 +11:00
Jiahao XU
599bcaf333
Impl GhApiClient and use it in cargo-binstall to speedup resolution process (#832)
Fixed #776

 - Add new feature gh-api-client to binstalk-downloader
 - Impl new type `binstalk_downloader::remote::{RequestBuilder, Response}`
 - Impl `binstalk_downloader::gh_api_client::GhApiClient`, exposed if `cfg(feature = "gh-api-client")` and add e2e and unit tests for it
 - Use `binstalk_downloader::gh_api_client::GhApiClient` to speedup `cargo-binstall`
 - Add new option `--github-token` to supply the token for GitHub restful API, or read from env variable `GITHUB_TOKEN` if not present.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-02 12:04:22 +11:00
dependabot[bot]
263c836757
Bump clap from 4.1.7 to 4.1.8 (#840) 2023-03-01 02:35:26 +00:00
Jiahao XU
af6dc61f3d
Disable --icf=safe on MacOS (#839)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-03-01 03:32:40 +13:00
Jiahao XU
2bf70b6a01
Run e2e test for release build and fix it by switching back to stable (#818)
* Run e2e-tests for release build
* Print `RUSTFLAGS` for justfile target build & check
* Fix CI: Disable miropt level 4
* Fix CI: Disable -Zbuild-std
* Disable `-Zgcc-ld=lld` and `-Zshare-generics` so that we can switch back to stable

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-28 11:53:57 +00:00
dependabot[bot]
5b70e41966
Bump clap from 4.1.6 to 4.1.7 (#837) 2023-02-28 04:35:43 +00:00
Jiahao XU
fc4b02e7bc
Disable GitLab e2e-test due to them deleting my account & repo (#836)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-28 16:02:34 +13:00
dependabot[bot]
e13354e8fa
Bump tempfile from 3.3.0 to 3.4.0 (#834) 2023-02-27 03:35:21 +00:00
dependabot[bot]
fd0166e31b
Bump jobslot from 0.2.8 to 0.2.9 (#833) 2023-02-27 03:29:16 +00:00
dependabot[bot]
809c8e9cad
Bump toml_edit from 0.19.3 to 0.19.4 (#831) 2023-02-23 13:29:33 +11:00
Jiahao XU
96ebcfd08f
Add new option --locked that is passed through to cargo-install (#830)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-22 22:27:17 +11:00
dependabot[bot]
0e055dbb7c
Bump async_zip from 0.0.9 to 0.0.12 (#824) 2023-02-22 08:47:47 +00:00
dependabot[bot]
8f50bab0d8
Bump compact_str from 0.6.1 to 0.7.0 (#825)
Bumps [compact_str](https://github.com/ParkMyCar/compact_str) from 0.6.1 to 0.7.0.
- [Release notes](https://github.com/ParkMyCar/compact_str/releases)
- [Changelog](https://github.com/ParkMyCar/compact_str/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ParkMyCar/compact_str/commits)

---
updated-dependencies:
- dependency-name: compact_str
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-22 17:55:18 +11:00
Jiahao XU
a89c3735fd
Update transitive deps (#821)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-20 23:16:40 +11:00
Jiahao XU
7bc4d4a5c6
Add opt --root-ceritificates & env BINSTALL_HTTPS_ROOT_CERTS (#820)
for specifying root ceritificates used for https connnections.

And remove old environment variable `CARGO_HTTP_CAINFO`, `SSL_CERT_FILE`
and `SSL_CERT_PATH` to avoid accidentally setting them, especially in CI
env.

Also:
 - Rm fn `binstalk_downloader::Certificate::from_env`
 - Enable feature `env` of dep `clap` in `crates/bin`
 - Add new dep `file-format` v0.14.0 to `crates/bin`
 - Use `file-format` to determine pem/der file format when loading root certs
 - Rm fn `binstalk_downloader::Certificate::open` and enum `binstalk_downloader::OpenCertificateError`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-20 20:48:33 +11:00
dependabot[bot]
467ba0d854
Bump cargo_toml from 0.15.1 to 0.15.2 (#819)
Bumps [cargo_toml](https://gitlab.com/crates.rs/cargo_toml) from 0.15.1 to 0.15.2.
- [Release notes](https://gitlab.com/crates.rs/cargo_toml/tags)
- [Commits](https://gitlab.com/crates.rs/cargo_toml/compare/v0.15.1...v0.15.2)

---
updated-dependencies:
- dependency-name: cargo_toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-20 14:33:12 +11:00
Jiahao XU
3f0107696b
Enable cross-lang-fat-lto on Linux (#817)
Fixed #806

 - Add new feature flag `cross-lang-fat-lto` and enable it on release for linux
 - Enable `-C linker-plugin-lto` for linux
 - Only use `-Z gcc-ld=lld` on non-windows targets when `cargo-zigbuild` is not enabled

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-19 15:19:35 +11:00
Jiahao XU
e76a4dff62
Improve CI: All in cargo-zigbuild for linux targets (#816) 2023-02-18 13:41:17 +11:00
Jiahao XU
9923788f07
Fix CI: Only turn on feature pkg-config on linux and fix cross compilation (#815)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-18 00:07:24 +13:00
Jiahao XU
61c992612c
Switch to cargo-zigbuild for aarch64-unknown-linux-gnu and x86_64-unknown-linux-musl (#814)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-17 09:36:45 +13:00
dependabot[bot]
69a1c26951
Bump clap from 4.1.4 to 4.1.6 (#813) 2023-02-16 02:29:06 +00:00
Jiahao XU
2e118b3044
Optimize GhCrateMeta::find: Cache url resolution result (#810)
So that we don't have to create multiple HEAD/GET http request to get
the final, redirected url.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-16 14:51:47 +13:00
Jiahao XU
a8b9ae6fda
Enable -Z share-generics to reduce compilation time (#807)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-16 14:47:37 +13:00
Jiahao XU
7b086bfcbc
Update SUPPORT.md on bin-dir default (#811)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-16 11:59:15 +13:00
Jiahao XU
93f15ea1c4
Ignore README.md and SUPPORT.md in workflow "ci" (#812)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-16 11:58:16 +13:00
Jiahao XU
45ce841342
Adjust feature flags enabled on CI (#809)
Enable feature `pkg-config` and `log_release_max_level_debug` for debug
build and enable feature `static`, `trust-dns` and
`log_release_max_level_debug` for release build.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-16 11:57:58 +13:00
Jiahao XU
9c6ab5991e
Enable icf=safe & use rust-lld for targets other than win (#805)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-15 20:24:17 +13:00
Jiahao XU
89b920a876
Inc default interval in --rate-limit to 10ms (#804)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-15 19:07:25 +13:00
Jiahao XU
9874dca454
Fix bin names in .crates.toml on win (#802)
`bins::BinFile::new` does not include `binary_ext` in the
`BinFile::base_name`.

Also add regression e2e-test.

Fixed #801

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-15 17:24:50 +13:00
dependabot[bot]
30f7722131
Bump once_cell from 1.17.0 to 1.17.1 (#803) 2023-02-15 02:39:44 +00:00
Jiahao XU
1e49460ac7
Fix use of StreamReadable: Ensure no empty Bytes (#799)
which would cause the `StreamReadable` to return eof even if the
underlying stream is still open and has not sent EOF yet.

Fixed #777

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-15 12:01:14 +11:00
Jiahao XU
9635e05d6c
Support adding root cert via env CARGO_HTTP_CAINFO, SSL_CERT_{FILE, PATH} (#774)
* Support for custom root cert in `binstalk_downloader::remote::Client`
* Support adding root cert via env `CARGO_HTTP_CAINFO`, `SSL_CERT_{FILE, PATH}`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-15 11:33:59 +13:00
Jiahao XU
647f02bb59
Use cargo-zigbuild for cross compilation (#767)
* Disable link arg `-lgcc` for musl builds when `cargo-zigbuild` is used

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-15 11:19:59 +13:00
Jiahao XU
3fffe39635
Document environment variable BINSTALL_LOG_LEVEL (#798)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-13 06:26:16 +00:00
dependabot[bot]
28415f7927
Bump tokio-util from 0.7.6 to 0.7.7 (#797)
Bumps [tokio-util](https://github.com/tokio-rs/tokio) from 0.7.6 to 0.7.7.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-util-0.7.6...tokio-util-0.7.7)

---
updated-dependencies:
- dependency-name: tokio-util
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-13 17:14:15 +11:00
Jiahao XU
7c15dd2052
Revert "Read log_level from env CARGO_BINSTALL_LOG_LEVEL if arg not present" (#796)
This reverts commit e84228ba01.
2023-02-13 15:31:15 +11:00
Jiahao XU
04113e9dd9
Rm NOVERSION_FILENAMES "{ name }{ archive-suffix }" (#795)
which does not contain `target`, hence it might report the binary being
available for any target we specified.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-13 13:44:24 +11:00
Jiahao XU
87686cb2f7
Feature: Better retry policy in binstalk-downloader (#794)
Fixed #779 #791 

 - Retry request on timeout
 - Retry for `StatusCode::{REQUEST_TIMEOUT, GATEWAY_TIMEOUT}`
 - Add `DEFAULT_RETRY_DURATION_FOR_RATE_LIMIT` for 503/429
   if 503/429 does not give us a header or give us an invalid header on
   when to retry, we would default to
   `DEFAULT_RETRY_DURATION_FOR_RATE_LIMIT`.
 - Fix `Client::get_redirected_final_url`: Retry using `GET` on status code 400..405 + 410
 - Rename remote_exists => remote_gettable & support fallback to GET
   if HEAD fails due to status code 400..405 + 410.
 - Improve `Client::get_stream`: Include url & method in the err of the stream returned

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-13 13:43:48 +11:00
github-actions[bot]
1b2fb08bcb
release: cargo-binstall v0.20.1 (#793)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-02-12 15:46:27 +11:00
Jiahao XU
015bd2e47a
Update transitive deps (#768)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-12 15:33:28 +11:00
Jiahao XU
f46de3714a
Add step to relase-build to make sure it's runnable (#792)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-12 14:48:28 +11:00
Jiahao XU
e84228ba01
Read log_level from env CARGO_BINSTALL_LOG_LEVEL if arg not present (#790)
* Enable feature "env" on dep clap in bin
* Read log_level from env `CARGO_BINSTALL_LOG_LEVEL` if arg not present

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-11 14:59:38 +11:00
github-actions[bot]
b408a1a9dd
release: cargo-binstall v0.20.0 (#788)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-02-11 00:56:03 +11:00
github-actions[bot]
166bd05906
release: binstalk v0.8.0 (#787)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-11 00:54:27 +11:00
github-actions[bot]
e03f9e0445
release: binstalk-downloader v0.3.3 (#786)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-11 00:53:59 +11:00
github-actions[bot]
b8d9a4d649
release: binstalk-manifests v0.3.0 (#785)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-02-10 23:55:41 +11:00
github-actions[bot]
1a4f98085c
release: binstalk-types v0.2.1 (#784)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-02-10 23:06:23 +11:00
dependabot[bot]
c92f9ab115
Bump tokio-util from 0.7.4 to 0.7.5 (#783)
Bumps [tokio-util](https://github.com/tokio-rs/tokio) from 0.7.4 to 0.7.5.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-util-0.7.4...tokio-util-0.7.5)

---
updated-dependencies:
- dependency-name: tokio-util
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-10 14:02:19 +11:00
figsoda
ff753f06f2
Make disabling static and rustls features possible (#782)
Default features were turned on for binstalk and the `static` and `pkg-config` features of cargo-binstall didn't do anything
2023-02-10 14:01:51 +11:00
Jiahao XU
d9dd611b9e
Improve fmt::Display impl for all Error types (#781)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-10 14:01:22 +11:00
dependabot[bot]
9d9b72c768
Bump toml_edit from 0.19.2 to 0.19.3 (#773)
Bumps [toml_edit](https://github.com/ordian/toml_edit) from 0.19.2 to 0.19.3.
- [Release notes](https://github.com/ordian/toml_edit/releases)
- [Commits](https://github.com/ordian/toml_edit/compare/v0.19.2...v0.19.3)

---
updated-dependencies:
- dependency-name: toml_edit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-09 13:46:01 +11:00
dependabot[bot]
c76014018b
Bump serde_json from 1.0.92 to 1.0.93 (#778)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.92 to 1.0.93.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.92...v1.0.93)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-09 12:53:00 +11:00
dependabot[bot]
98c9f86192
Bump toml_edit from 0.19.1 to 0.19.2 (#772) 2023-02-07 02:19:42 +00:00
dependabot[bot]
1c863d829f
Bump serde_json from 1.0.91 to 1.0.92 (#771) 2023-02-06 02:49:33 +00:00
dependabot[bot]
cb56770fac
Bump cargo_toml from 0.14.0 to 0.15.1 (#770) 2023-02-06 02:40:03 +00:00
Jiahao XU
a13c01b769
Replace dep futures-util with helpers::FuturesResolver (#765)
futures-util has too many dependencies and it contains a lot of code of
which we only use `futures_util::stream::{FuturesUnordered, StreamExt}`.

We don't even need most of the functionalities in `FuturesUnordered` as
we just need the output of first future that either returns `Err(_)` or
`Ok(Some(_))`.

So we replace it with ou own homebrew solution (~80 loc) and it's easier
to use.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-05 16:26:25 +11:00
Jiahao XU
833684b095
Replace dep futures-util with futures-lite in binstalk-downloader (#764)
`futures-util` has too many dependencies and it contains a lot of code
of which we only use a tiny bit of them.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-04 16:05:03 +11:00
Félix Saparelli
6bc1fb4983
Fix #728: fallback to copy when symlinking on windows (#763)
* Fix #728: fallback to copy when symlinking on windows

* Signature hmm?

* Squash warnings on windows

* Just don’t use generics here
2023-02-04 14:14:08 +13:00
Jiahao XU
f2fc37eea5
Fix "Too many "Too Many Requests" log" (#761)
Fixed #747

 - Add dep compact_str v0.6.1 to binstalk-downloader
 - Impl new type `DelayRequest`
 - Handle 503/429 with wait duration > `MAX_RETRY_DURATION` by simply taking the min
 - Fix `Client::send_request_inner`: Ensure 503/429 get propagated to other requests
   
   even if the current requests reach its maximum retry and decides to
   simply return an error.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-04 11:14:53 +11:00
Jiahao XU
e510511487
Improve GhCrateMeta: Detect cases where pkg-fmt is not specified (#757)
* Fix fmt of mod `<GhCrateMeta as Fetcher>::find`
* Add new variant `BinstallError::InvalidPkgFmt`
* Impl new fn `PkgFmt::guess_pkg_format`
* Improve `GhCrateMeta`: Detect cases where `pkg-fmt` is not specified
  
  but `pkg-url` also does not contain format, archive-format or
  archive-suffix which is required for automatically deducing the pkg-fmt.
  
  In these cases, we would call `PkgFmt::guess_pkg_format` to try out best
  to figure out the pkg-fmt, otherwise we just return an error.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-04 10:47:57 +13:00
Jiahao XU
5c02581569
Disable backtrace support from miette in release/CI build (#744)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-03 20:38:10 +13:00
dependabot[bot]
b05548440d
Bump zstd from 0.12.2+zstd.1.5.2 to 0.12.3+zstd.1.5.2 (#756) 2023-02-01 02:13:58 +00:00
dependabot[bot]
7dc07ad23c
Bump bytes from 1.3.0 to 1.4.0 (#754) 2023-02-01 01:43:33 +00:00
dependabot[bot]
68f3eb81d4
Bump fs4 from 0.6.2 to 0.6.3 (#755) 2023-02-01 01:40:45 +00:00
dependabot[bot]
28449c21f4
Bump toml_edit from 0.19.0 to 0.19.1 (#753) 2023-01-31 01:41:22 +00:00
dependabot[bot]
84621d54a5
Bump async-trait from 0.1.63 to 0.1.64 (#752) 2023-01-31 01:39:31 +00:00
dependabot[bot]
aa89f0073d
Bump futures-util from 0.3.25 to 0.3.26 (#751)
Bumps [futures-util](https://github.com/rust-lang/futures-rs) from 0.3.25 to 0.3.26.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.25...0.3.26)

---
updated-dependencies:
- dependency-name: futures-util
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-31 12:36:22 +11:00
dependabot[bot]
1ad5d4657f
Bump toml_edit from 0.18.0 to 0.19.0 (#748) 2023-01-30 02:37:41 +00:00
dependabot[bot]
d34ad5ad1f
Bump tokio from 1.24.2 to 1.25.0 (#749) 2023-01-30 02:20:04 +00:00
dependabot[bot]
d36acbb4e6
Bump either from 1.8.0 to 1.8.1 (#743)
Bumps [either](https://github.com/bluss/either) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/bluss/either/releases)
- [Commits](https://github.com/bluss/either/compare/1.8.0...1.8.1)

---
updated-dependencies:
- dependency-name: either
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-27 01:23:22 +00:00
Jiahao XU
270bf08a24
Optimize use of tinytemplate (#647)
* Optimize `GhCrateMeta::find`: Cache compiled template `pkg_url`
* Optimize `collect_bin_files`: Cache compiled template `bin_dir`
* Refactor: Improve readability of `gh_crate_meta`
* Optimize `GhCrateMeta::launch_baseline_find_tasks`: Dedup urls before checking
* Optimize `BinFile::new`: Avoid one heap alloc when creating `dest`
* Improve `warn!` msg in `GhCrateMeta::launch_baseline_find_tasks`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-26 17:33:49 +13:00
dependabot[bot]
719b20aadd
Bump clap from 4.1.3 to 4.1.4 (#742) 2023-01-25 16:57:09 +11:00
Jiahao XU
eb95c5b799
Minor optimization for bin and binstalk (#646)
* Refactor `logging`: Extract `report_err`
* Optimize `get_default_pkg_url_template`: Return iter instead of `Vec`
   to avoid heap allocation.
* Refactor `GhCrateMeta::find`: Rm `launch_baseline_find_tasks`
* Optimize `GhCrateMeta::find`: Avoid cloning `Cow<'_, str>`
* Improve `report_err` output: Print newline after msg

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-25 01:58:07 +13:00
Jiahao XU
283163bbda
Enable feature zstd-thin by default (#741)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-24 23:48:12 +11:00
Jiahao XU
9047d99c1a
Fix unused import in binstalk-manifests (#740)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-24 23:47:50 +11:00
Jiahao XU
152ea8376b
Switch from toml back to toml_edit (#738)
Since now toml simply uses toml_edit, there is no reason to continue
using it as it merely increase compilation time and bloat.

Instead, we switch to toml_edit v0.18.0 with feature serde enabled.

This also remove the `CratesTomlParseError::TomlParseNonUtf8` variant
intorduced in #736.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-24 16:27:34 +13:00
dependabot[bot]
425c6c2509
Bump toml from 0.5.11 to 0.6.0 (#736)
* Bump toml from 0.5.11 to 0.6.0

Bumps [toml](https://github.com/toml-rs/toml) from 0.5.11 to 0.6.0.
- [Release notes](https://github.com/toml-rs/toml/releases)
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.5.11...toml-v0.6.0)

---
updated-dependencies:
- dependency-name: toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix use of `toml` v0.6
* Optimize `CratesTomlParseError`: Box variant `TomlParse`
   Since now `toml:🇩🇪:Error` is a wrapper of `toml_edit::TomlError`,
   which is at least 3 * `size_of::<Vec<_>>()`.

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-24 02:51:29 +00:00
dependabot[bot]
9a2b4c9ab1
Bump clap from 4.1.1 to 4.1.3 (#735)
Bumps [clap](https://github.com/clap-rs/clap) from 4.1.1 to 4.1.3.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.1.1...v4.1.3)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-24 12:56:44 +11:00
dependabot[bot]
e22d319825
Bump toml from 0.5.10 to 0.5.11 (#734)
Bumps [toml](https://github.com/toml-rs/toml) from 0.5.10 to 0.5.11.
- [Release notes](https://github.com/toml-rs/toml/releases)
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.5.10...toml-v0.5.11)

---
updated-dependencies:
- dependency-name: toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-23 04:50:58 +00:00
dependabot[bot]
5bd6a50d70
Bump async-trait from 0.1.61 to 0.1.63 (#733)
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.61 to 0.1.63.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.61...0.1.63)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-23 15:37:35 +11:00
dependabot[bot]
7857856f78
Bump reqwest from 0.11.13 to 0.11.14 (#732)
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.13 to 0.11.14.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.13...v0.11.14)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-20 01:28:21 +00:00
dependabot[bot]
493d2778fe
Bump tokio from 1.24.1 to 1.24.2 (#727)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.24.1 to 1.24.2.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/commits)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-18 01:23:26 +00:00
Félix Saparelli
939f17dcd0
Fix "Tests pass" step (#726) 2023-01-18 03:13:49 +13:00
github-actions[bot]
46a035699e
release: cargo-binstall v0.19.3 (#721)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-01-17 22:47:38 +11:00
Félix Saparelli
ba91777faf
Fix name of release (#723) 2023-01-18 00:22:49 +13:00
Jiahao XU
18cc651713
Enable mir-opt-level=4 for release (#718)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-17 21:57:18 +11:00
Jiahao XU
a70589a47c
Update transitive dependencies (#717)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-17 21:42:37 +11:00
github-actions[bot]
42b858927b
release: binstalk v0.7.1 (#720)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-01-17 19:36:35 +11:00
Jiahao XU
ab4da7f059
Fix self-update on windows (#712)
Fixed #702


* Add new dep windows v0.44.0 for windows only
* Add regression test for #702
* Impl `win::replace_file`
* Use `ReplaceFileW` on windows if `fs::rename` in `fs::atomic_install` fails
* Improve logging and err messages
* Add more regression tests
* Make `BinFile::install_link` atomic: Do not remove file if dst exists
* Fallback to `ReplaceFileW` in `fs::atomic_symlink_file`
* Refactor: Extract new fn `fs::persist`
* Use `fs::persist` instead of `TempFile::persist` in `fs::atomic_install`, which fallbacks to `ReplaceFileW` on windows

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Félix Saparelli <felix@passcod.name>
2023-01-17 18:05:07 +11:00
github-actions[bot]
a60ae7ef6c
release: binstalk-downloader v0.3.2 (#715)
Co-authored-by: github-actions <github-actions@github.com>
2023-01-17 14:42:26 +13:00
Félix Saparelli
c1332c0d2d
Revert "Bump async_zip from 0.0.9 to 0.0.10" (#714) 2023-01-17 13:08:25 +13:00
github-actions[bot]
c2b1c243ea
release: cargo-binstall v0.19.2 (#707)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-01-16 15:39:07 +11:00
github-actions[bot]
97a1ce82eb
release: binstalk-downloader v0.3.1 (#711)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-01-16 15:00:21 +11:00
dependabot[bot]
7cd782271e
Bump async_zip from 0.0.9 to 0.0.10 (#709)
* Bump async_zip from 0.0.9 to 0.0.10

Bumps [async_zip](https://github.com/Majored/rs-async-zip) from 0.0.9 to 0.0.10.
- [Release notes](https://github.com/Majored/rs-async-zip/releases)
- [Commits](https://github.com/Majored/rs-async-zip/compare/v0.0.9...v0.0.10)

---
updated-dependencies:
- dependency-name: async_zip
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

* Fix usage of `async_zip::read::stream` APIs


Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-16 14:26:08 +11:00
dependabot[bot]
bc6ac734b4
Bump clap from 4.0.32 to 4.1.1 (#710)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.32 to 4.1.1.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.32...v4.1.1)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-16 13:54:52 +11:00
github-actions[bot]
8119acfeb0
release: detect-targets v0.1.5 (#706)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-01-16 11:23:54 +11:00
Jiahao XU
d72abde8e9
Fixed #704: Fix get_target_from_rustc for alpine (#705)
On Alpine, rustc returns host triple `x86_64-alpine-linux-musl`, so we
have to adopt code from
[`convert_custom_linux_target`](5519aeb5c2/build-common.rs (L1-L13)) to fix this.

* Optimize `get_target_from_rustc`: Avoid frequent String allocation

caused by `Cursor::new(stdout).lines()` which calls `BufRead::lines` and
returns `Lines` iterator, which returns `Item = io::Result<String>`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-16 10:57:53 +11:00
Jiahao XU
abb6874da3
Update README: Include aarch64 windows and full build info (#700)
* Update README: Include aarch64 windows and full build info

Co-authored-by: Félix Saparelli <felix@passcod.name>
2023-01-13 23:46:18 +11:00
dependabot[bot]
13845a7ca2
Bump zstd from 0.12.1+zstd.1.5.2 to 0.12.2+zstd.1.5.2 (#695) 2023-01-12 07:36:21 +00:00
github-actions[bot]
850ad63df9
release: cargo-binstall v0.19.1 (#698)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-01-12 17:16:40 +11:00
Jiahao XU
1be25f81b5
Fix FileLock for .crates.toml not dropped (#697)
* Fix `FileLock` for `.crates.toml` not dropped

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rm unneccessary ret type annotation for the closure

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add regression test

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-12 18:45:36 +13:00
Félix Saparelli
87854d8cc4
Recurse when packaging for mac (#696) 2023-01-12 16:11:43 +13:00
Félix Saparelli
aed3d9d71c
Use release action with explicit support for being called multiple times (#693) 2023-01-12 00:48:03 +00:00
github-actions[bot]
ea28e5e1e4
release: cargo-binstall v0.19.0 (#688)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-01-12 10:22:31 +11:00
Félix Saparelli
64c359a86f
Run CI on auto-merge enable (#692) 2023-01-12 02:45:04 +13:00
Félix Saparelli
ede976d650
Fix typo (#691) 2023-01-11 01:21:16 +00:00
github-actions[bot]
1b0e9292ae
release: binstalk v0.7.0 (#690)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-01-11 00:49:45 +00:00
github-actions[bot]
236829b7f2
release: binstalk-downloader v0.3.0 (#689)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-01-11 00:31:10 +00:00
github-actions[bot]
24c15e57e9
release: binstalk-manifests v0.2.0 (#684)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-01-10 23:48:36 +00:00
github-actions[bot]
3d79401d81
release: binstalk-types v0.2.0 (#685)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-01-11 10:29:31 +11:00
github-actions[bot]
9cdaf777c0
release: detect-targets v0.1.4 (#683)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2023-01-10 23:12:37 +00:00
Félix Saparelli
6033e30db5
Remove old jq script (#676) 2023-01-10 22:36:35 +00:00
Félix Saparelli
9821caa6d0
Use release-meta action instead of parsing commits (#675) 2023-01-11 09:22:53 +11:00
Jiahao XU
02484327c1
Update transitive deps (#674)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-11 03:02:24 +13:00
Félix Saparelli
ce411910a9
Linux split debuginfo is already here actually (#672) 2023-01-09 21:30:35 +11:00
dependabot[bot]
4ebf7cb421
Bump tokio from 1.23.0 to 1.24.1 (#658)
* Bump tokio from 1.23.0 to 1.24.1

Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.23.0 to 1.24.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.23.0...tokio-1.24.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Don't reuse build cache

* fix index cache

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Félix Saparelli <felix@passcod.name>
2023-01-09 20:39:39 +11:00
dependabot[bot]
e5d4c13d1b
Bump mimalloc from 0.1.32 to 0.1.34 (#670)
Bumps [mimalloc](https://github.com/purpleprotocol/mimalloc_rust) from 0.1.32 to 0.1.34.
- [Release notes](https://github.com/purpleprotocol/mimalloc_rust/releases)
- [Commits](https://github.com/purpleprotocol/mimalloc_rust/compare/v0.1.32...v0.1.34)

---
updated-dependencies:
- dependency-name: mimalloc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 03:19:08 +00:00
dependabot[bot]
94cabeb5d7
Bump async-trait from 0.1.60 to 0.1.61 (#669)
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.60 to 0.1.61.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.60...0.1.61)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 14:01:41 +11:00
Félix Saparelli
211cb3ceb0
Add release metadata in PR (from release-pr v2) (#668) 2023-01-09 11:53:55 +11:00
Félix Saparelli
4b2deb19b9
Try build-std with arm64 gnu (#667) 2023-01-09 12:35:00 +13:00
Félix Saparelli
aea9df602c
Migrate CI and builds to Just, add "full" builds (#660) 2023-01-08 16:27:36 +11:00
Jiahao XU
305bf8123d
Optimize Client: Reduce size from 16 to 8 (#655)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-06 03:02:14 +00:00
dependabot[bot]
ecb572d02d
Bump bzip2 from 0.4.3 to 0.4.4 (#657)
Bumps [bzip2](https://github.com/alexcrichton/bzip2-rs) from 0.4.3 to 0.4.4.
- [Release notes](https://github.com/alexcrichton/bzip2-rs/releases)
- [Commits](https://github.com/alexcrichton/bzip2-rs/commits/0.4.4)

---
updated-dependencies:
- dependency-name: bzip2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-06 01:28:15 +00:00
Jiahao XU
7b34178bcc
Optimize resolve_inner: Avoid VersionReq::clone (#656)
* Add new dep maybe-owned v0.3.4 to binstalk
* Optimize `resolve_inner`: Avoid `VersionReq::clone`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-06 13:47:45 +13:00
Jiahao XU
7656b887d9
Fix Client::new: Make sure we use at least tls 1.2 (#652)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-05 13:21:00 +00:00
Jiahao XU
daec880008
Rm unused variant binstalk_downloader::download::DownloadError::UserAbort (#653)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-06 02:08:57 +13:00
Jiahao XU
42672ccf40
Fix detect_targets_linux: Detect arch/libc at runtime using guess_host_triple (#649)
- Enable `guess_host_triple` on all targets
 - Fix `detect_targets_linux`: Detect runtime arch/libc using
   `guess_host_triple` instead of using the one specified in `TARGET`.
 - Add support for android in `detect_targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-04 14:32:13 +13:00
Jiahao XU
49f60d37fe
Fix #588 race cond updating .crates.toml (#645)
Fixed #588

* Add new dep fs-lock v0.1.0 to crates/bin
* Refactor: Impl new type `Manifests` in crates/bin
   for managing manifests.
* Fix #588 race cond updating `.crates.toml`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-04 01:01:02 +00:00
Jiahao XU
d4da4680f6
Minor Optimization and fix for bintalk-manifests (#643)
* Optimize `CratesToml::load_from_reader`: Avoid dup monomorphization
* Optimize `CratesToml::write_to_writer`: Avoid dup monomophization
* Optimize `create_if_not_exist`: Take `&path` to avoid dup monomorphization
* Fix `CratesToml::write_to_path`: Use exclusive file lock
   to prevent race conditions.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-04 00:37:01 +00:00
Jiahao XU
959b465d81
Optimize Download::and_visit_tar: Use trait object to avoid monomorphization (#644)
by removing method `TarEntriesVisitor::finish` and associated type
`TarEntriesVisitor::Target`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-01-04 13:11:10 +13:00
dependabot[bot]
1ab979cde8
Bump once_cell from 1.16.0 to 1.17.0 (#640)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.16.0...v1.17.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-30 01:31:30 +00:00
Jiahao XU
59d79d1573
Refactor detect-targets (#636)
* Enable dep guess_host_triple for any non-linux OS
* Refactor: Rm `{windows, macos}::detect_target_*`
* Refactor `detect_targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-29 01:24:28 +00:00
Jiahao XU
0ecb30dc9d
Update quickinstall url (#638)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-29 00:59:13 +00:00
Jiahao XU
31c9d4de1d
Verify target triple retrieved from rustc is valid (#637)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-29 13:42:54 +13:00
dependabot[bot]
287ae03a51
Bump cargo_toml from 0.13.0 to 0.14.0 (#632)
* Bump cargo_toml from 0.13.0 to 0.14.0

Bumps [cargo_toml](https://gitlab.com/crates.rs/cargo_toml) from 0.13.0 to 0.14.0.
- [Release notes](https://gitlab.com/crates.rs/cargo_toml/tags)
- [Commits](https://gitlab.com/crates.rs/cargo_toml/commits/main)

---
updated-dependencies:
- dependency-name: cargo_toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix use of `Manifest::complete_from_abstract_filesystem`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-28 04:16:24 +00:00
dependabot[bot]
c022cd9b0c
Bump serde from 1.0.151 to 1.0.152 (#633)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.151 to 1.0.152.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.151...v1.0.152)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-28 02:30:38 +00:00
dependabot[bot]
6120a6d17f
Bump command-group from 2.0.0 to 2.0.1 (#634)
Bumps [command-group](https://github.com/watchexec/command-group) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/watchexec/command-group/releases)
- [Changelog](https://github.com/watchexec/command-group/blob/main/CHANGELOG.md)
- [Commits](https://github.com/watchexec/command-group/compare/v2.0.0...v2.0.1)

---
updated-dependencies:
- dependency-name: command-group
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-28 01:29:03 +00:00
Jiahao XU
6a83e22460
Update transitive dependencies (#623)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-28 01:00:04 +00:00
Jiahao XU
31c6524833
Impl new fn CratesToml::append_to_file (#629)
Prepare for fix for #588

* Impl new fn `CratesToml::append_to_file`
* Optimize `CratesToml::append_to_file`: Avoid dup monomorphization

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-28 11:33:35 +11:00
Jiahao XU
c87d42d2d8
Fix CratesToml::load_from_reader: Ret default for empty reader (#622)
Fixed #621

Also add a new unit test for this bug.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-28 00:31:47 +00:00
Jiahao XU
6bdb26930e
Refactor, improvements and bugfix for resolution and installation process (#619)
* Refactor: Extract new mod `ops::resolve::resolution`
* Refactor: Extract new type `ResolutionFetch`
* Refactor: Extract new type `ResolutionSource`
* Improve `Resolution::print`: Provides more details on which crate
   is the resolution for.
* Make `Resolution::print` a pub fn
* Refactor: Extract new fn `ResolutionFetch::install`
* Refactor: Extract new async fn `ResolutionSource::install`
* Optimize `ResolutionSource::install` avoiding `OsStr::to_string_lossy`.
* Add new dep command-group v2.0.0 to binstalk with feat with-tokio
* Fix `ResolutionSource::install`: Use `AsyncCommandGroup::group_spawn`
   instead of `tokio::process::Command::spawn` to ensure all the processes
   spanwed by the `cargo` process can be terminated with one signal sent to
   the `cargo` process.
* Fix printing resolution: Make sure they are printed without interleaving
* Refactor `entry::install_crates`
* Improve dry-run output for `ResolutionSource::install`
* Refactor: Extract new fn `ResolutionFetch::print`
* Refactor: Extract new fn `ResolutionSource::print`
* Optimize `Resolution`: Box unit variant `Fetch`
* Improve formatting of `tokio::process::Command`
   Prints out sth like `cargo install ...` instead of the `Debug::fmt`.
* Improve dry-run output

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-28 00:18:07 +00:00
dependabot[bot]
611485de52
Bump taiki-e/install-action from 1 to 2 (#630) 2022-12-27 11:43:56 +00:00
Jiahao XU
cdff92aa3c
Fix reinstalling crates after removed by cargo-uninstall (#628)
Honor `.crates.toml` only since `cargo-uninstall` can only update
`.crates.toml`, not binstall's own manifest.

Fixed #625

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-24 05:04:51 +00:00
dependabot[bot]
76e89f7b30
Bump clap from 4.0.30 to 4.0.32 (#624)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.30 to 4.0.32.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.30...v4.0.32)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-23 01:20:07 +00:00
dependabot[bot]
b5ca794ce9
Bump clap from 4.0.29 to 4.0.30 (#620) 2022-12-22 12:41:08 +11:00
Jiahao XU
fef8bb6774
Optimize binstalk-{manifest, types} (#610)
* Add new dep maybe-owned v0.3.4 to binstalk-types with features serde
* Re-export maybe_owned in binstalk-types
* Optimize `CrateSource::url`: Use `MaybeOwned<'static, Url>`
   to avoid cloning in `CrateSource::cratesio_registry`
* Optimize `Source`: Use `MaybeOwned<'static, Url>`
   to avoid cloning in `Source::cratesio_registry` and
   `impl From<&CrateSource> for Source`.
* Optimize `Source`: Add lifetime `<'a>` to avoid cloning
   in `impl<'a> From<&'a CrateSource> for Source<'a>`
* Optimize `CratesToml::append_to_path`: Avoid cloning
   caused by `CrateVersionSource::from` by manually `format!` name, version
   and source into string.
* Add new dep beef v0.5.2 to binstalk-manifests with features impl_serde
* Optimize `CratesToml::append_to_path`: Eliminate `metadata.bins.clone()` by using `Cow`
* Replace dep toml_edit with toml v0.5.10 in binstalk-manifests
   to speed up compilation and reduce bloat.
   
   Previously we switch to toml_edit because it is unmaintained, but now
   with it moved into toml-rs/toml as a workspace, it is now under active
   maintenance again, thus we switch back to it.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-21 06:07:04 +00:00
dependabot[bot]
e519409ad8
Bump thiserror from 1.0.37 to 1.0.38 (#618)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.37 to 1.0.38.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.37...1.0.38)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-20 14:38:07 +11:00
dependabot[bot]
7714d42b60
Bump semver from 1.0.14 to 1.0.16 (#614) 2022-12-19 05:51:35 +00:00
dependabot[bot]
daf52a475a
Bump serde from 1.0.150 to 1.0.151 (#616) 2022-12-19 05:12:15 +00:00
dependabot[bot]
b209d10ed5
Bump serde_json from 1.0.89 to 1.0.91 (#615) 2022-12-19 04:39:48 +00:00
dependabot[bot]
9aaa5c48dd
Bump async-trait from 0.1.59 to 0.1.60 (#612) 2022-12-19 03:42:22 +00:00
dependabot[bot]
b102d5a5f0
Update supports-color requirement from 1.3.1 to 2.0.0 in /crates/bin (#611) 2022-12-19 14:21:58 +11:00
github-actions[bot]
628fd336e7
release: cargo-binstall v0.18.1 (#608)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2022-12-14 11:37:48 +11:00
Noa
597e092774
CI: Build -gnu targets on ubuntu-20.04 (#607)
This commit pins it to 20.04, so the glibc version required by the release binaries can be run on docker image `rust:1.65` which uses glibc 2.31.
2022-12-14 11:14:20 +11:00
github-actions[bot]
09bc8e7bb8
release: cargo-binstall v0.18.0 (#606)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2022-12-13 00:58:06 +11:00
github-actions[bot]
b35e7bd43c
release: binstalk v0.6.0 (#605)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2022-12-12 08:57:40 +00:00
Jiahao XU
73a794dc13
Optimization: Box fut Remote::get_redirected_final_url in GhCrateMeta::find (#600)
* Box fut `Remote::get_redirected_final_url` in `GhCrateMeta::find`
   Since the other await point in `GhCrateMeta::find` only needs
   `Arc<Self>` and `handles` to be saved, which is much smaller than the
   future returned by `Remote::get_redirected_final_url`
* Refactor: Simplify `wait_on_cancellation_signal`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-12 08:42:11 +00:00
github-actions[bot]
647e340d38
release: binstalk-downloader v0.2.0 (#604)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2022-12-12 07:55:38 +00:00
github-actions[bot]
2595bbabfb
release: binstalk-manifests v0.1.1 (#603)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2022-12-12 07:42:36 +00:00
Jiahao XU
e6e912540e
Fix binstalk-downloader: Re-export TarBasedFmt (#599)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-12 19:32:40 +13:00
Jiahao XU
db45f2fb7f
Refactor binstalk-downloader APIs: Remove cancellation_future plus optimizations (#591)
- Refactor: Mv fn `utils::asyncify` into mod `utils`
 - Improve err msg for task failure in `utils::asyncify`
 - Make sure `asyncify` always returns the same annoymous type
   that implements `Future` if the `T` is same.
 - Rewrite `extract_bin` to avoid `block_in_place`
   support cancellation by dropping
 - Rm unused dep scopeguard from binstalk-downloader
 - Rewrite `extract_tar_based_stream` so that it is cancellable by dropping
 - Unbox `extract_future` in `async_extracter::extract_zip`
 - Refactor `Download` API: Remove `CancellationFuture` as param

   since all futures returned by `Download::and_*` does not call
   `block_in_place`, so they can be cancelled by drop instead of using this
   cumbersome hack.
 - Fix exports from mod `async_tar_visitor`
 - Make `signal::{ignore_signals, wait_on_cancellation_signal}` private
 - Rm the global variable `CANCELLED` in `wait_on_cancellation_signal`
   and rm fn `wait_on_cancellation_signal_inner`
 - Optimize `wait_on_cancellation_signal`: Avoid `tokio::select!` on `not(unix)`
 - Rm unnecessary `tokio::select!` in `wait_on_cancellation_signal` on unix
   Since `unix::wait_on_cancellation_signal_unix` already waits for ctrl + c signal.
 - Optimize `extract_bin`: Send `Bytes` to blocking thread for zero-copy
 - Optimize `extract_with_blocking_decoder`: Avoid dup monomorphization
 - Box fut of `fetch_crate_cratesio` in `PackageInfo::resolve`
 - Optimize `extract_zip_entry`: Spawn only one blocking task per fn call

   by using a mspc queue for the data to be written to the `outfile`.

   This would improve efficiency as using `tokio::fs::File` is expensive:
   It spawns a new blocking task, which needs one heap allocation and then
   pushed to a mpmc queue, and then wait for it to be done on every loop.

   This also fix a race condition where the unix permission is set before
   the whole file is written, which might be used by attackers.
 - Optimize `extract_zip`: Use one `BytesMut` for entire extraction process
   To avoid frequent allocation and deallocation.
 - Optimize `extract_zip_entry`: Inc prob of reusing alloc in `BytesMut`

   Performs the reserve before sending the buf over mpsc queue to
   increase the possibility of reusing the previous allocation.

   NOTE: `BytesMut` only reuses the previous allocation if it is the
   only one holds the reference to it, which is either on the first
   allocation or all the `Bytes` in the mpsc queue has been consumed,
   written to the file and dropped.

   Since reading from entry would have to wait for external file I/O,
   this would give the blocking thread some time to flush `Bytes`
   out.
 - Disable unused feature fs of dep tokio

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-12 03:15:30 +00:00
dependabot[bot]
058208bae9
Bump serde from 1.0.149 to 1.0.150 (#597)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.149 to 1.0.150.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.149...v1.0.150)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-12 02:40:53 +00:00
dependabot[bot]
23cfb61ec8
Bump embed-resource from 1.7.4 to 1.8.0 (#598)
Bumps [embed-resource](https://github.com/nabijaczleweli/rust-embed-resource) from 1.7.4 to 1.8.0.
- [Release notes](https://github.com/nabijaczleweli/rust-embed-resource/releases)
- [Commits](https://github.com/nabijaczleweli/rust-embed-resource/compare/v1.7.4...v1.8.0)

---
updated-dependencies:
- dependency-name: embed-resource
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-12 02:05:29 +00:00
dependabot[bot]
fa78517712
Bump tokio from 1.22.0 to 1.23.0 (#593)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.22.0 to 1.23.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.22.0...tokio-1.23.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-12 01:33:53 +00:00
dependabot[bot]
97c5857e58
Bump serde from 1.0.148 to 1.0.149 (#592)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.148 to 1.0.149.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.148...v1.0.149)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-12 00:59:27 +00:00
Jiahao XU
3b1a7f2c78
Optimize extract_zip: Use async_zip::read::stream::ZipFileReader to avoid temporary file (#590)
* Add new dep async_zip v0.0.9 to binstalk-downloader
   with features "gzip", "zstd", "xz", "bzip2", "tokio".
* Refactor: Simplify `async_extracter::extract_*` API
* Refactor: Create newtype wrapper of `ZipError`
   so that the zip can be upgraded without affecting API of this crate.
* Enable feature fs of dep tokio in binstalk-downloader
* Rewrite `extract_zip` to use `async_zip::read::stream::ZipFileReader`
   which avoids writing the zip file to a temporary file and then read it
   back into memory.
* Refactor: Impl new fn `await_on_option` and use it
* Optimize `tokio::select!`: Make them biased and check for cancellation first
  to make cancellation takes effect ASAP.
* Rm unused dep zip from binstalk-downloader

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-12 00:44:34 +00:00
dependabot[bot]
e6f969245a
Bump zstd from 0.12.0+zstd.1.5.2 to 0.12.1+zstd.1.5.2 (#595)
Bumps [zstd](https://github.com/gyscos/zstd-rs) from 0.12.0+zstd.1.5.2 to 0.12.1+zstd.1.5.2.
- [Release notes](https://github.com/gyscos/zstd-rs/releases)
- [Commits](https://github.com/gyscos/zstd-rs/compare/v0.12.0...v0.12.1)

---
updated-dependencies:
- dependency-name: zstd
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-11 14:47:23 +00:00
Jiahao XU
75d2fc4d42
Optimize pre-built artifact size: Set compression level for zip to 9 (max) (#596)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-09 15:14:37 +13:00
Jiahao XU
ec026c1711
Optimize CratesToml::collect_into_crates_versions (#589)
Avoid calling `CrateVersionSource::from_str` which parses the source and
allocates `Url`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-04 01:46:30 +00:00
Jiahao XU
23a5937aff
Optimization: Rewrite Download::and_visit_tar to use tokio-tar (#587)
* Add new dep tokio-tar v0.3.0 to binstalk-downloader
* Add new dep tokio-util v0.7.4 with feat io to binstalk-downloader
* Add dep async-trait v0.1.59 to binstalk-downloader
* Add new dep async-compression v0.3.15 to binstalk-downloader
   with features "gzip", "zstd", "xz", "bzip2", "tokio".
* Rewrite `Download::and_visit_tar` to use `tokio-tar`
   to avoid the cumbersome `block_in_place`.
* Apply temporary workaround: Rm use of let-else in mod visitor

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-04 14:31:34 +13:00
Jiahao XU
39f175be04
Feature: Check for installed crates in cargo_install_v1_manifest (#582)
* Add & Impl new fn `CratesToml::collect_into_crates_versions`
   to iterate over crates listed in cargo_crates_v1, accessing their names
   and versions.
* Re-export `CompactString`, `Version` & `Url` in binstalk-manifests
   for convenience
* Fix `CratesToml::load_from_path`: Wrap `File` in `FileLock::new_shared`
   to avoid concurrent write while reading the file.
* Filter out installed crates in cargo_install_v1_metadata
* Make match in `filter_out_installed_crates` more explicit
* Add new test `cargo_crates_v1::test::test_loading`
* Optimize `CratesToml`: Use `Vec` instead of `BTreeMap`
  since we cannot simply call `BTreeMap::get` to find an entry for a crate
  anyway.
  This also accidentally fixed the CI.
* Impl new API `CratesToml::remove`
* Fix`CratesToml::append_to_path` by removing previous records of
   the crates that are just updated.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-03 15:25:41 +00:00
Jiahao XU
887ebb6f6f
Fix BinstallError::CrateContext: Forward diagnostics of field CrateContextError::err (#586)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-03 12:12:04 +00:00
Jiahao XU
a69db83aa6
Fix error reporting in main and move all arg validation into fn args::parse (#585)
* Fix reporting parsing error from `args::parse`
   Report it in `args::parse` by using `Args::command().error(...).exit()`
   instead of returning `BinstallError`.
* Rm unused variant `BinstallError::OverrideOptionUsedWithMultiInstall`
* Refactor: Move `strategies` validation into `args::parse`
* Rm unused variant `BinstallError::InvalidStrategies`
* Add new unit test `args::test::verify_cli`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-03 11:57:50 +00:00
Jiahao XU
b564b8ac4e
Fix logging: Print error and continue on failure to flush logs (#584)
instead of exiting the entire process.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-04 00:15:15 +13:00
dependabot[bot]
f45c18ff81
Bump softprops/action-gh-release from 0.1.14 to 0.1.15 (#583) 2022-12-02 14:46:59 +13:00
Jiahao XU
8a5577297e
Optimize BinstallError: Reduce size from 40B to 32B (#581)
* Optimize `BinstallError::CratesIoApi`: Extract new type `errors::CratesIoApiError` and box it
   Also improve `<CratesIoApiError as Display>::fmt` impl.
* Optimize `BinstallError::SubProcess`: Use `Box<str>` instead of `String`
* Optimize `BinstallError::CargoManifest`: Box `CargoTomlError`
* Optimize `BinstallError::VersionParse`: Extract `VersionParseError` and box it
   Also improve `<VersionParseError as Display>::fmt` impl.
* Optimize `BinstallError::CrateContext`: Extract `CrateContextError` and box it in
* Optimize `install_from_source`: Only format `cmd` on err

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-12-01 20:05:00 +13:00
Jiahao XU
ab3e47c42b
Optimize Fetcher::find and fix quickinstall reporting (#579)
* Optimize `Fetcher::find`: Make it non-async to avoid boxing
   and return `AutoAbortJoinHandle<...>` instead.
   
   Since spawning a new task in tokio box the future anyway, boxing the
   returned future again in `Fetcher::find` merely adds unnecessary
   overheads.
* Optimize `QuickInstall::report`: Make it async fn instead of ret `JoinHandle`
   
   This provides several benefits:
    - On debug build, no task will be spawned
    - The calls to `self.stats_url()` can be evaluated in parallel.
    - The task now returns `()` so that the task spawned is smaller.
* Fix `QuickInstall::find`: `warn!` if quickinstall report fails

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-30 16:15:22 +13:00
Jiahao XU
ff737730f4
Optimize use of tokio::select!: Use biased selection (#580)
as there is no need to randomize the first one to be polled.

For `cancel_on_user_sig_term` and `StreamReadable::fill_buf`, the
cancellation future should always to be polled first so that user would
feel responsive.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-30 16:05:52 +13:00
dependabot[bot]
af82f1021c
Bump async-trait from 0.1.58 to 0.1.59 (#578)
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.58 to 0.1.59.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.58...0.1.59)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-30 01:50:00 +00:00
dependabot[bot]
99548b1e50
Bump clap from 4.0.27 to 4.0.29 (#577)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.27 to 4.0.29.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.27...v4.0.29)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-30 01:35:11 +00:00
Jiahao XU
d63e001d6f
Fix panic in ui::confirm on I/O error (#576)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-29 05:53:45 +00:00
Jiahao XU
d64710d3a6
Fix crates/bin/build.rs: Rerun build.rs if manifest.rc and windows.manifest changed (#575)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-29 18:31:59 +13:00
Jiahao XU
6785d3ef82
Fix msrv: Bump to v1.65.0 (#574)
- bin and binstalk uses new let-else lang feature
 - dep zstd of binstalk-downloader just bumped its msrv to v1.64.0

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-29 17:18:28 +13:00
Jiahao XU
b5002de9c4
Return Future + 'static in GhCrateMeta::launch_baseline_find_tasks (#573)
So that the borrow checker know that `FuturesUnordered<F>` holds no
reference to any data and thus it can further optimize future returned
by `GhCrateMeta::find`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-29 16:26:54 +13:00
dependabot[bot]
30cc94b5bc
Bump serde from 1.0.147 to 1.0.148 (#572)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.147 to 1.0.148.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.147...v1.0.148)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-29 13:39:33 +11:00
dependabot[bot]
4b018cf90a
Bump clap from 4.0.26 to 4.0.27 (#571)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.26 to 4.0.27.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.26...v4.0.27)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-25 01:39:18 +00:00
dependabot[bot]
6c9d932b81
Bump flate2 from 1.0.24 to 1.0.25 (#570)
Bumps [flate2](https://github.com/rust-lang/flate2-rs) from 1.0.24 to 1.0.25.
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/commits/1.0.25)

---
updated-dependencies:
- dependency-name: flate2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-25 01:24:37 +00:00
dependabot[bot]
81bd1483a9
Bump zstd from 0.11.2+zstd.1.5.2 to 0.12.0+zstd.1.5.2 (#563)
* Bump zstd from 0.11.2+zstd.1.5.2 to 0.12.0+zstd.1.5.2

Bumps [zstd](https://github.com/gyscos/zstd-rs) from 0.11.2+zstd.1.5.2 to 0.12.0+zstd.1.5.2.
- [Release notes](https://github.com/gyscos/zstd-rs/releases)
- [Commits](https://github.com/gyscos/zstd-rs/commits)

---
updated-dependencies:
- dependency-name: zstd
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update comment in `binstalk-downloader/Cargo.toml`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-24 13:22:27 +00:00
dependabot[bot]
0f21db4c49
Bump jobslot from 0.2.6 to 0.2.8 (#564)
Bumps [jobslot](https://github.com/cargo-bins/jobslot) from 0.2.6 to 0.2.8.
- [Release notes](https://github.com/cargo-bins/jobslot/releases)
- [Commits](https://github.com/cargo-bins/jobslot/compare/v0.2.6...v0.2.8)

---
updated-dependencies:
- dependency-name: jobslot
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-24 13:03:41 +00:00
dependabot[bot]
f71c3606f8
Bump miette from 5.4.1 to 5.5.0 (#565)
Bumps [miette](https://github.com/zkat/miette) from 5.4.1 to 5.5.0.
- [Release notes](https://github.com/zkat/miette/releases)
- [Changelog](https://github.com/zkat/miette/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zkat/miette/compare/miette-derive-v5.4.1...miette-derive-v5.5.0)

---
updated-dependencies:
- dependency-name: miette
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-24 12:46:34 +00:00
github-actions[bot]
7544fde813
release: cargo-binstall v0.17.0 (#562)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2022-11-23 01:18:44 +11:00
github-actions[bot]
5172bd46a0
release: binstalk v0.5.0 (#561)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-22 11:24:54 +00:00
github-actions[bot]
d1b490468b
release: binstalk-downloader v0.1.0 (#559)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-22 10:53:50 +00:00
github-actions[bot]
0084254c8c
release: binstalk-manifests v0.1.0 (#558)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2022-11-22 10:36:10 +00:00
Jiahao XU
44316e1f02
Fix workflow release-pr: Install nightly toolchain (#560)
Default rust/cargo in ubuntu-latest is too old.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-22 09:59:24 +00:00
github-actions[bot]
6fd3044c12
release: binstalk-types v0.1.0 (#557)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2022-11-22 09:21:27 +00:00
Jiahao XU
73751c4437
Set version of newly created crates to v0.0.0 (#556)
so that release-pr can operate on them and increase minor version for a
new release.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-22 08:52:27 +00:00
github-actions[bot]
e5cd7d7ca1
release: detect-targets v0.1.3 (#555)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2022-11-22 08:31:43 +00:00
Jiahao XU
822e7094e5
Upgrade dependencies (#554)
- bytes v1.2.1 => v1.3.0
 - serde_json v1.0.88 => v1.0.89
 - compact_str v0.6.0 => v0.6.1

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-22 07:39:58 +00:00
Jiahao XU
bd3f1d598c
Enable feature thin of dep zstd for any target built natively (#480)
* Add new feature `binstalk-downloader/zstd-thin`
* Add new feature `binstalk/zstd-thin`
* Add new feature `binstalk/zstd-thin`
* Enable feature zstd-thin for targets built natively

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-22 06:52:41 +00:00
Jiahao XU
66abf1b8c1
More mionr optimizations (#553)
* Optimize `BinFile::preview_bin`: Use `Path::display` instead of `to_string_lossy` to avoid allocation.
* Refactor: Rm useless `AsRef::as_ref` call
* Optimize `GhCrateMeta::find`: Reduce fut size by converting `Url` to `String`
   `Url` is much larger than `String`.
* Refactor `PackageInfo::resolve`: Destruct `Meta::binstall`
* Optimize `resolve::load_manifest_path`: Avoid allocation

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-22 19:35:16 +13:00
Jiahao XU
707b173de1
Create universal binary for MacOS in workflow release (#551)
* Create universal binary for MacOS in workflow build
* Update README

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-22 16:52:36 +11:00
Jiahao XU
62e350eba9
detect-targets: Add support of MacOS universal binary (#552)
* Add support for MacOS universal bin
* Refactor: Extract new fn `macos::detect_alternative_targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-21 22:16:28 +13:00
Jiahao XU
26b28dc63f
Update transitive dependencies (#549)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-21 17:55:51 +13:00
dependabot[bot]
7706aa14cf
Bump serde_json from 1.0.87 to 1.0.88 (#547)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.87 to 1.0.88.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.87...v1.0.88)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 02:37:50 +00:00
dependabot[bot]
1821469342
Bump tokio from 1.21.2 to 1.22.0 (#548)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.21.2 to 1.22.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.21.2...tokio-1.22.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 02:19:14 +00:00
Jiahao XU
83b2de3ea2
Enforce strict strategies parsing rule: Reject duplicate strategy in --strategies (#545)
`cargo-binstall` should reject duplicate strategy in `--strategies` as it is illegal input and it cannot be interpreted reasonably.

* Reject duplicate strategy in `--strategies`
* Optimize `compute_resolvers`: Use `Vec::retain`
   instead of `Iterator::filter` plus collecting into `Vec`.
* Optimize `compute_resolvers`: Reject `strategies.len() > Strategy::COUNT`
* Improve err msg for cases where user disabled all strategies
* Simplify `BinstallError::InvalidStrategies`: Takes `&'static str`
   instead of `&'static &'static str` since other variants are larger than 8B.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-21 12:02:58 +11:00
Jiahao XU
bdb4b2070d
Minor optimization (#544)
* Optimization: Rm `debug!` in `find_version`
   printing all version iterated obviously doesn't help much in debugging
   in the problem but rather just confusing.
   
   Also this makes it hard for the compiler to optimize the iterators.
* Use let-else in `ManifestVisitor`
* Optimize `BinFile::preview_{bin, link}` for zero-copy
   Return `impl Display` that lazily format instead of allocating a `String`
* Optimize `infer_bin_dir_template`: Generate dir lazily
* Optimize `find_version`: Lazily clone `version_req` only on err
* Refactor `find_version`: Use `bool::then_some`
* Add dep either v1.8.0 to binstalk
* Optimize `GhCrateMeta::find`: Avoid cloning and `Vec` creation
   by using `Either`
* Optimize `ops::install::install_from_package`: Make it a regular fn
   instead of async fn since it does not `.await` on any async fn.
* Optimize `QuickInstall`: Rm field `target`
   since `Arc<Data>` already contains that field.
* Optimize `Fetcher`s: Extract new struct `TargetData`
   so that `Data` can be shared by all fetchers, regardless of the target.
* Optimize `QuickInstall`: Rm unused field `data`
* Optimize `Resolution::print`: Replace branching with conditional move

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-21 10:32:46 +13:00
dependabot[bot]
696d8c2a82
Bump reqwest from 0.11.12 to 0.11.13 (#538)
* Bump reqwest from 0.11.12 to 0.11.13

Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.12 to 0.11.13.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.12...v0.11.13)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump trust-dns-resolver to v0.22.0
* Enable feature dns-over-quic if rustls & trust-dns-resolver are enabled

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-20 00:21:50 +11:00
Jiahao XU
50b6e62164
Minor refactor and optimization (#543)
* Avoid potential panicking in `args::parse` by using `Vec::get` instead of indexing
* Refactor: Simplify `opts::{resolve, install}` API
   Many parameters can be shared and put into `opts::Options` intead and
   that would also avoid a few `Arc<Path>`.
* Optimize `get_install_path`: Avoid cloning `install_path`
* Optimize `LazyJobserverClient`: Un`Arc` & remove `Clone` impl
   to avoid additional boxing
* Optimize `find_version`: Avoid cloning `semver::Version`
* Optimize `GhCrateMeta::launch_baseline_find_tasks`
   return `impl Iterator<Item = impl Future<Output = ...>>`
   instead of `impl Iterator<Item = AutoAbortJoinHandle<...>>`
   to avoid unnecessary spawning.
   
   Each task spawned has to be boxed and then polled by tokio runtime.
   They might also be moved.
   
   While they increase parallelism, spawning these futures does not justify
   the costs because:
    - Each `Future` only calls `remote_exists`
    - Each `remote_exists` call send requests to the same domain, which is
      likely to share the same http2 connection.
      Since the conn is shared anyway, spawning does not speedup anything
      but merely add communication overhead.
    - Plus the tokio runtime spawning cost
* Optimize `install_crates`: Destruct `Args` before any `.await` point
   to reduce size of the future
* Refactor `logging`: Replace param `arg` with `log_level` & `json_output`
   to avoid dep on `Args`
* Add dep strum & strum_macros to crates/bin
* Derive `strum_macros::EnumCount` for `Strategy`
* Optimize strategies parsing in `install_crates`
* Fix panic in `install_crates` when `Compile` is not the last strategy specified
* Optimize: Take `Vec<Self>` instead of slice in `CrateName::dedup`
* Refactor: Extract new fn `compute_resolvers`
* Refactor: Extract new fn `compute_paths_and_load_manifests`
* Refactor: Extract new fn `filter_out_installed_crates`
* Reorder `install_crates`: Only run target detection if args are valid
   and there are some crates to be installed.
* Optimize `filter_out_installed_crates`: Avoid allocation
   by returning an `Iterator`
* Fix user_agent of `remote::Client`: Let user specify it
* Refactor: Replace `UIThread` with `ui::confirm`
   which is much simpler.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-19 20:00:27 +13:00
Jiahao XU
325cb5cc19
Optimizations plus bug fix (#541)
* Optimize `Download::and_extract`: Avoid dup monomorphization
* Increase buffer size for binstall_crates_v1 to `4096 * 5`
* Optimize `opts::resolve`: Avoid unnecessary `clone`s
* Fix reserve in `opts::resolve`: Do not over-reserve
* Rename field `opts::Options::resolver` => `resolvers`
* Refactor: Extract new type `resolve::PackageInfo`
    - which makes `opts::resolve_inner` easier to understand
    - reduce number of parameters required for `download_extract_and_verify` and
      `collect_bin_files`
    - reducing size of future returned by `opts::resolve_inner` by dropping
      `cargo_toml::{Manifest, Package}` as early as possible since
      `Manifest` is 3000 Bytes large while `Package` is 600 Bytes large.
* Optimize `fetchers::Data`: Use `CompactString` for field name & version
   since they are usually small enough to fit in inlined version of
   `CompactString`.
* Optimize `gh_crate_meta`: Avoid unnecessary allocation
   in `RepositoryHost::get_default_pkg_url_template`.
* Refacator: Use `Itertools::cartesian_product` in `apply_filenames_to_paths`
* Optimize `ops::resolve`: Avoid unnecessary `clone` & reduce future size
   by calling `fetcher.target_meta()` to obtain final metadata after
   downloaded and extracted the binaries.
* Optimize `ops::resolve`: Avoid unnecessary allocation
   in `download_extract_and_verify`: Replace `Itertools::join` with
   `Itertools::format` to avoid allocating the string.
* Fix disabling cargo-install fallback
* Simplify `BinFile::from_product`: Takes `&str` instead of `&Product`
   since we only need `product.name`
* Rename `BinFile::from_product` => `BinFile::new`
* Refactor: Create newtype `ops::resolve::Bin`
   so that we don't need to `unwrap()` on `Product::name`
   and reduce memory usage.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-17 23:59:35 +00:00
Alessandro Candido
bb1f51a739
Short option for no-confirm flag (#540)
Add short name for no-confirm flag

Closes #536

The -y short name is a convention, often used by package managers (apt, yum, ...) and it is associated with a request of no interaction (thus often used in scripts, to automate workflows)
2022-11-17 18:54:10 +11:00
dependabot[bot]
69ed65dbba
Bump digest from 0.10.5 to 0.10.6 (#539)
Bumps [digest](https://github.com/RustCrypto/traits) from 0.10.5 to 0.10.6.
- [Release notes](https://github.com/RustCrypto/traits/releases)
- [Commits](https://github.com/RustCrypto/traits/compare/digest-v0.10.5...digest-v0.10.6)

---
updated-dependencies:
- dependency-name: digest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-17 01:30:32 +00:00
dependabot[bot]
451c69b37e
Bump clap from 4.0.25 to 4.0.26 (#537)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.25 to 4.0.26.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.25...v4.0.26)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-17 12:07:49 +11:00
Jiahao XU
d9cc3ce219
Refactor: Extract new crate binstalk-types plus other misc refactor and optimization (#535)
* Refactor: Extract new crate binstalk-types
* Optimize: Rm field `CrateInfo::other`
   which also removes dep serde-tuple-vec-map and serde-json from
   binstalk-types.
   
   This also makes `CrateInfo` easier to use, more generic and can be used
   over any `Serializer`, not just `serde_json::Value`.
* Mark all errors in `binstalk-manifests` as non_exhaustive
* Reduce size of `CvsParseError` by using `Box<str>`
   instead of `String` for variant `UnknownSourceType`.
* Reduce size of `CratesTomlParseError` to 16 bytes on 64bit platform
   by boxing variants `TomlWrite` and `CvsParse` as these two fields are
   significantly larger than other variants.
* Unify import style in mod `binstall_crates_v1`
* Replace dep binstalk-manifests with binstalk-types in binstalk-downloader
   to reduce its transitive dependencies and enables binstalk-downloader to
   be built in parallel to binstak-manifests.
* Replace dep binstalk-manifests with binstalk-types in binstalk
   to reduce transitive dependencies and enables binstalk to be built in
   parallel to binstalk-manifests.
   
   This is benefitial because binstalk-manifests pulls in toml_edit, which
   could takes up to 15s to be built on M1 (7-9s for codegen).
* Add dep binstalk-manifests to crates/bin
* Update dependabot and GHA release-pr

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-17 13:46:27 +13:00
dependabot[bot]
58326a6085
Bump mimalloc from 0.1.31 to 0.1.32 (#533)
Bumps [mimalloc](https://github.com/purpleprotocol/mimalloc_rust) from 0.1.31 to 0.1.32.
- [Release notes](https://github.com/purpleprotocol/mimalloc_rust/releases)
- [Commits](https://github.com/purpleprotocol/mimalloc_rust/compare/v0.1.31...v0.1.32)

---
updated-dependencies:
- dependency-name: mimalloc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-16 02:18:59 +00:00
dependabot[bot]
66eb4d2d54
Bump clap from 4.0.24 to 4.0.25 (#534)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.24 to 4.0.25.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.24...v4.0.25)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-16 01:27:53 +00:00
Jiahao XU
b6f223d925
Switch binstalk-manifests LICENSE to "Apache-2.0 OR MIT" (#513)
Signed-off-by: Félix Saparelli <felix@passcod.name>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Signed-off-by: pinage404
Signed-off-by: Ryo Yamashita <qryxip@gmail.com>
Signed-off-by: azzamsa

and https://github.com/cargo-bins/cargo-binstall/pull/513#issuecomment-1315898664 for Ryan Kurte
2022-11-15 22:51:11 +00:00
dependabot[bot]
7f4d023914
Bump clap from 4.0.23 to 4.0.24 (#532)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.23 to 4.0.24.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.23...v4.0.24)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-15 01:53:55 +00:00
dependabot[bot]
4ee0c9160f
Bump cargo-bins/release-pr from 1 to 2 (#531)
Bumps [cargo-bins/release-pr](https://github.com/cargo-bins/release-pr) from 1 to 2.
- [Release notes](https://github.com/cargo-bins/release-pr/releases)
- [Commits](https://github.com/cargo-bins/release-pr/compare/v1...v2)

---
updated-dependencies:
- dependency-name: cargo-bins/release-pr
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-15 12:45:31 +11:00
Jiahao XU
c34a2850b3
Optimization: Box variants in Error to reduce size and remove unused variants in BinstallError (#530)
* Box `HttpError` in `binsalk_downloader::remote::Error::Http`
   as `HttpError` contains `Url` which are too big.
* Box `HttpError` in `BinstallError::Http` same as the previous commit.
* Box `TinyTemplateError` in `BinstallError::Template`
  since `TinyTemplateError` is 56 bytes large where most of the other variants are below 40 bytes large.
* Rm unsed variant `BinstallError::VersionUnavailable`
* Box `CratesIoApiError` in `BinstallError::CratesIoApi`
   It is 32 bytes large while other variants are below 40 bytes large.
* Improve err msg for `BinstallError::CrateContext`
* Rm unused variant `BinstallError::VersionReq`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-15 02:46:32 +13:00
dependabot[bot]
933c6425ef
Bump clap from 4.0.22 to 4.0.23 (#529)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.22 to 4.0.23.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.22...v4.0.23)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-14 01:30:17 +00:00
Jiahao XU
90495b35d8
Enable coloring in console log (#528)
* Enable feat ansi of dep tracing-subscriber
* Rm use of `tracing_appender::non_blocking`
  since `cargo-binstall` is so simple that it doesn't need it.
* Use `tracing::{error, info}` in `MainExit::report`
* Use `tracing::{error, warn}` in `BinstallError::report`
* Add dep supports-color v1.3.1 to crates/bin
* Enable ansi of `tracing_subscriber::fmt` if stdout supports it

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-13 22:45:19 +13:00
Jiahao XU
4e875874b6
Replace use of log with tracing (#527)
Resolved #522

* Add dep tracing v0.1.37 to binstalk
* Use `tracing` instead of `log` for logging in binstalk
* Rm dev dep `env_logger` since `log` is no longer used
* Rm unused dep `log` from binstalk

* Replace use of `log` with `tracing` in crates/bin
* Enable feat std of dep log in crates/bin

* Add dep tracing v0.1.37 to binstalk-downloader
* Replace use of `log` with `tracing` in binstalk-downloader
* Rm unused dep `log` from binstalk-downlaoder


* Wrap `ops::{install, resolve}` in `tracing::instrument`
* Wrap `Download::and_{extract, visit_tar}` in `instrument`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-13 21:45:37 +13:00
Jiahao XU
9e80cf0700
Feature: Impl opt-out options (#510)
Fixed #136

* Impl opt-out optioins in binstalk
* Replace field `Options::{gh_crate, quickinstall}_fetcher` with `resolver`
  which can determine order of resolver used.
* Add new field `Args::{disable_}strategies`
* Add new variant `BinstallError::InvalidStrategies`
* Add variant `BinstallError::NoFallbackToCargoInstall`
* Add code for supporting strategies in mod entry
* Test `--disable-strategies` in `tests.sh`
* Test for `--strategies` in `tests.sh`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-11 05:24:46 +00:00
Jiahao XU
89fa5b1769
Refactor: Extract new crate binstalk-{signal, downloader} (#518)
* Refactor: Extract new crate binstalk-downloader
* Re-export `PkgFmt` from `binstalk_manifests`
* Update release-pr.yml
* Update dependabot

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-11 04:02:54 +00:00
Jiahao XU
3841762a5b
Replace simplelog with tracing_subscriber::fmt (#525)
* Disable feat log-always of dep tracing
* Add dep tracing-log 0.1.3 with no feat
* Add new dep tracing-appender v0.2.2
* Add dep tracing-subscriber 0.3.16 with feat fmt and json
* Fix `MainExit::report`: Do not use `log::{error, warn}`
  since `MainExit::report` might be called with no `log`ger, it can only
  use `println!` and `eprintln!`.
* Use `tracing_subscriber::fmt` instead of `simple_log`
* Rm unused dep simplelog from crates/bin
* Fix `BinstallError::report`: Avoid `log::{warn, error}`
   since they might be called after `tracing_appender::WorkerGuard` is
   dropped.
* Make tracing output more readable to end users
* Add new dep tracing-core v0.1.30
* Add new dep once_cell v1.16.0
* Refactor: Extract new mod `logging`
* Add new option `Args::json_output`
* Fix `MainExit::report`: Ignore io error
* Fix `BinstallError::report`: Ignore IO error

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-11 12:05:09 +13:00
Steven Hé (Sīchàng)
e378be73df
Mention upgrade, fix #514 (#524)
Fix #514
2022-11-10 03:58:52 +00:00
Jiahao XU
e62abb442e
Enable dependabot for binstalk-manifests (#523)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-10 08:37:18 +13:00
Jiahao XU
b27990ecbc
Add new dep tracing v0.1.37 with feat log-always in crates/bin (#520)
to convert all tracing spans and events to log.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-09 17:12:02 +13:00
dependabot[bot]
23a4c5db27
Bump mimalloc from 0.1.30 to 0.1.31 (#519)
Bumps [mimalloc](https://github.com/purpleprotocol/mimalloc_rust) from 0.1.30 to 0.1.31.
- [Release notes](https://github.com/purpleprotocol/mimalloc_rust/releases)
- [Commits](https://github.com/purpleprotocol/mimalloc_rust/compare/v0.1.30...v0.1.31)

---
updated-dependencies:
- dependency-name: mimalloc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-09 12:45:52 +11:00
dependabot[bot]
18d525139f
Bump env_logger from 0.9.1 to 0.9.3 (#515)
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.9.1 to 0.9.3.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.9.1...v0.9.3)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-08 02:34:26 +00:00
dependabot[bot]
91e227e2a3
Bump embed-resource from 1.7.3 to 1.7.4 (#517)
Bumps [embed-resource](https://github.com/nabijaczleweli/rust-embed-resource) from 1.7.3 to 1.7.4.
- [Release notes](https://github.com/nabijaczleweli/rust-embed-resource/releases)
- [Commits](https://github.com/nabijaczleweli/rust-embed-resource/compare/v1.7.3...v1.7.4)

---
updated-dependencies:
- dependency-name: embed-resource
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-08 02:23:18 +00:00
dependabot[bot]
8a534d095b
Bump clap from 4.0.18 to 4.0.22 (#516)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.18 to 4.0.22.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.18...v4.0.22)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-08 01:32:50 +00:00
Jiahao XU
fc6d9ab956
Refactor: Extract new crate binstalk-manifests (#511)
* Refactor: Extract new crate binstalk-manifests
* Fix clippy warning in mod `binstall_crates_v1`
* Rm unused deps in binstalk
* Update release-pr

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-08 00:50:02 +00:00
Jiahao XU
565be9ae4c
Switch back from binstall-zip to zip (#512)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-08 13:32:39 +13:00
github-actions[bot]
35a8bfdc6b
release: normalize-path v0.2.0 (#509)
chore: Release

Co-authored-by: github-actions <github-actions@github.com>
2022-11-04 17:30:21 +11:00
Jiahao XU
c48bc2a264
Fix crate normalize-path (#508)
* Impl new function `NormalizePath::is_normalized`
* Always normalize and ret `PathBuf` in `NormalizePath::normalize`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-11-03 23:11:43 +13:00
dependabot[bot]
25a4ceb050
Bump mathieudutour/github-tag-action from 6.0 to 6.1 (#502)
Bumps [mathieudutour/github-tag-action](https://github.com/mathieudutour/github-tag-action) from 6.0 to 6.1.
- [Release notes](https://github.com/mathieudutour/github-tag-action/releases)
- [Commits](https://github.com/mathieudutour/github-tag-action/compare/v6.0...v6.1)

---
updated-dependencies:
- dependency-name: mathieudutour/github-tag-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-31 02:30:40 +00:00
dependabot[bot]
955751c82f
Bump once_cell from 1.15.0 to 1.16.0 (#505)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.15.0...v1.16.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-31 02:16:53 +00:00
dependabot[bot]
0f120b6948
Bump miette from 5.3.0 to 5.4.1 (#506)
Bumps [miette](https://github.com/zkat/miette) from 5.3.0 to 5.4.1.
- [Release notes](https://github.com/zkat/miette/releases)
- [Changelog](https://github.com/zkat/miette/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zkat/miette/compare/miette-derive-v5.3.0...miette-derive-v5.4.1)

---
updated-dependencies:
- dependency-name: miette
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-31 13:05:20 +11:00
Jiahao XU
0ac27bbb1d
Re enable CARGO_UNSTABLE_SPARSE_REGISTRY (#504)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-10-28 01:02:28 +00:00
Jiahao XU
9ed04cf89b
Fix clippy error on unit test CI (#503)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-10-28 13:48:16 +13:00
dependabot[bot]
3530f94243
Bump toml_edit from 0.14.4 to 0.15.0 (#500) 2022-10-24 14:22:30 +11:00
dependabot[bot]
78b9e820c3
Bump serde from 1.0.145 to 1.0.147 (#501)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.145 to 1.0.147.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.145...v1.0.147)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-24 13:45:34 +11:00
dependabot[bot]
351d1b747e
Bump futures-util from 0.3.24 to 0.3.25 (#497)
Bumps [futures-util](https://github.com/rust-lang/futures-rs) from 0.3.24 to 0.3.25.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.24...0.3.25)

---
updated-dependencies:
- dependency-name: futures-util
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-21 02:59:37 +00:00
dependabot[bot]
cd549654cb
Bump clap from 4.0.17 to 4.0.18 (#498)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.17 to 4.0.18.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.17...v4.0.18)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-21 13:43:30 +11:00
dependabot[bot]
5ff68472d4
Bump serde_json from 1.0.86 to 1.0.87 (#496)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.86 to 1.0.87.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.86...v1.0.87)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-20 02:11:26 +00:00
Diogo Sousa
d90547c818
Support default filename with underscores. (#495)
This is the default format used by github action rust-build/rust-build.
2022-10-20 12:44:35 +11:00
dependabot[bot]
087d69da6e
Bump async-trait from 0.1.57 to 0.1.58 (#494)
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.57 to 0.1.58.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.57...0.1.58)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-19 02:24:09 +00:00
dependabot[bot]
7581e878ac
Bump clap from 4.0.16 to 4.0.17 (#493)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.16 to 4.0.17.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.16...v4.0.17)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-19 02:05:05 +00:00
github-actions[bot]
b9f486d9f5
release: cargo-binstall v0.16.0 (#491)
Co-authored-by: github-actions <github-actions@github.com>
2022-10-18 17:42:21 +11:00
github-actions[bot]
e5f64f705f
release: binstalk v0.4.1 (#492)
(cargo-release) version 0.4.1

Co-authored-by: github-actions <github-actions@github.com>
2022-10-18 17:00:49 +11:00
Jiahao XU
f4f6e36984
Fix -V behavior (#488)
Fixed #485

* Make `Duration` in MainExit::Success` optional
* Fix arg parsing: Print version on `-V`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-10-18 17:10:44 +13:00
dependabot[bot]
9ebcd1d426
Bump clap from 4.0.15 to 4.0.16 (#489)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.15 to 4.0.16.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.15...v4.0.16)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 03:13:47 +00:00
dependabot[bot]
24aa099320
Bump cargo_toml from 0.12.4 to 0.13.0 (#486)
Bumps [cargo_toml](https://gitlab.com/crates.rs/cargo_toml) from 0.12.4 to 0.13.0.
- [Release notes](https://gitlab.com/crates.rs/cargo_toml/tags)
- [Commits](https://gitlab.com/crates.rs/cargo_toml/commits/master)

---
updated-dependencies:
- dependency-name: cargo_toml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 02:55:54 +00:00
dependabot[bot]
ac7de213f9
Bump clap from 4.0.14 to 4.0.15 (#483)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.14 to 4.0.15.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.14...v4.0.15)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-14 02:15:16 +00:00
dependabot[bot]
71ef2f6ed3
Bump mimalloc from 0.1.29 to 0.1.30 (#484)
Bumps [mimalloc](https://github.com/purpleprotocol/mimalloc_rust) from 0.1.29 to 0.1.30.
- [Release notes](https://github.com/purpleprotocol/mimalloc_rust/releases)
- [Commits](https://github.com/purpleprotocol/mimalloc_rust/compare/v0.1.29...v0.1.30)

---
updated-dependencies:
- dependency-name: mimalloc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-14 13:03:10 +11:00
dependabot[bot]
394425565a
Bump clap from 4.0.13 to 4.0.14 (#482)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.13 to 4.0.14.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.13...v4.0.14)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-13 13:13:55 +11:00
Jiahao XU
aa6012baae
Make extraction cancellable for bin and tar based formats (#481)
Extraction wasn't cancellable by `cancel_on_user_sig_term` used in `entry` since it calls `block_in_place`.

This PR adds cancellation support to it by adding a `static` variable `OnceCell` to `wait_on_cancellation_signal` so that once it returns `Ok(())`, all other calls to it after that point also returns `Ok(())` immediately.

`StreamReadable`, which is used in cancellation process, then stores a boxed future of `wait_on_cancellation_signal` and polled it in `BufReader::fill_buf`.

Note that for zip, the extraction process takes `File` instead of `StreamReadable` due to `io::Seek` requirement, so it cancelling during extraction for zip is still not possible.

This PR also optimized `extract_bin` and `extract_zip` by using `StreamReadable::copy` introduced to this PR instead of `io::copy`, which allocates an internal buffer on stack, which imposes extra copy.

It also fixed `StreamReadable::fill_buf` by ensuring that empty buffer is only returned on eof.

* Make `wait_on_cancellation_signal` pub
* Enable feature `parking_lot` of dep tokio
* Mod `wait_on_cancellation_signal`: Use `OnceCell` internally
   to archive the effect that once call to it return `Ok(())`, all calls to
   it after that also returns `Ok(())`.
* Impl `From<BinstallError>` for `io::Error`
* Impl cancellation on user signal in `StreamReadable`
* Fix err msg when cancelling during extraction in `ops::resolve`
* Optimize: Impl & use `StreamReadable::copy`
   which is same as `io::copy` but does not allocate any internal buffer
   since `StreamReadable` is buffered.
* Fix `next_stream`: Return non-empty bytes on `Ok(Some(bytes))`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-10-13 13:31:13 +13:00
Jiahao XU
fdc617d870
Fix install_from_source: Set cmd to be kill_on_drop (#479)
If user interrupts `cargo-binstall` by signal while it is running `cargo-install`, then the `cargo-install` would continue to run at background even after `cargo-binstall` terminates.

Setting `cmd` to be kill_on_drop fixed this.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-10-12 17:56:26 +13:00
dependabot[bot]
035e600a56
Bump clap from 4.0.12 to 4.0.13 (#477) 2022-10-12 02:59:44 +00:00
dependabot[bot]
f4c840fa29
Bump home from 0.5.3 to 0.5.4 (#478) 2022-10-12 13:46:54 +11:00
dependabot[bot]
2c578e216e
Bump clap from 4.0.11 to 4.0.12 (#476) 2022-10-11 13:02:30 +11:00
Jiahao XU
e605a99113
Impl retry for 503 and 429 status code in response (#473)
* Add new dep httpdate v1.0.2
* Enable feature time of dep tokio in binstalk
* Impl retry for `helpers::remote::Client`

Fixed #472 

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-10-10 17:54:29 +13:00
dependabot[bot]
4e1ac6ee0d
Bump clap from 4.0.10 to 4.0.11 (#474)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.10 to 4.0.11.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.10...v4.0.11)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-10 02:27:06 +00:00
dependabot[bot]
1fdcc5a982
Bump serde_json from 1.0.85 to 1.0.86 (#475)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.85 to 1.0.86.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.85...v1.0.86)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-10 13:17:07 +11:00
azzamsa
3a71c5a5c4
docs: update unsupported crates guide (#468)
Fixes #467
2022-10-08 08:21:50 +00:00
github-actions[bot]
5e04a22c04
release: cargo-binstall v0.15.1 (#470)
Co-authored-by: github-actions <github-actions@github.com>
2022-10-08 18:56:59 +11:00
Jiahao XU
98b62251ad
Fix unit test & integration CI and the release CI (#469)
* Fix integration test: Make sure `cargo build cargo-binstall` would not fail due to binary already present
* Disable feature `zlib-ng` for release build
* Disable build-std for release build on aarch64-unknown-linux-gnu
* Fix clippy warning in unit test CI
* Fix compile-settings.jq
* Fix caching: Rm `restores-keys`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-10-08 20:26:46 +13:00
github-actions[bot]
5d51541dcf
release: cargo-binstall v0.15.0 (#466)
Co-authored-by: github-actions <github-actions@github.com>
2022-10-08 01:10:34 +11:00
github-actions[bot]
65c721f9a1
release: binstalk v0.4.0 (#465)
(cargo-release) version 0.4.0

Co-authored-by: github-actions <github-actions@github.com>
2022-10-08 01:01:03 +11:00
Jiahao XU
9ee78f3736
Update README (#464)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-10-08 02:42:30 +13:00
Jiahao XU
76bc030f90
Disable tcp_nodelay for reqwest::Client and add rate limiting for https requests (#458) 2022-10-07 15:51:34 +11:00
dependabot[bot]
8398ec2d4b
Bump clap from 4.0.9 to 4.0.10 (#461)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-06 15:25:12 +13:00
Jiahao XU
3421403e75
Refactor and Optimizations (#459)
* Refactor: Avoid parsing `package.version()` twice in `ops::resolve` and `ops::install`
* Optimize Resolution: Replace `Package<Meta>` with two `CompactStrings`: `name` and `version`
* Use `CompactString` for `BinstallError::CratesIoApi::crate_name`
* Use `CompactString` for `BinstallError::VersionParse::v`
* Use `CompactString` for `BinstallError::VersionReq::req`
* Use `CompactString` for `BinstallError::VersionUnavailable::crate_name`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-10-06 04:19:12 +13:00
dependabot[bot]
70b0f8ec97
Bump clap from 4.0.8 to 4.0.9 (#460)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.8 to 4.0.9.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.8...v4.0.9)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-05 16:04:05 +11:00
dependabot[bot]
405e41eda4
Bump cargo_toml from 0.12.2 to 0.12.4 (#455)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-10-04 02:18:54 +13:00
dependabot[bot]
51fe4d59e3
Bump clap from 4.0.4 to 4.0.8 (#456)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.4 to 4.0.8.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.0.4...v4.0.8)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-03 10:07:28 +00:00
Jiahao XU
dcbe701caa
Allow batch installation with cli_overrides (#454)
which allows pkg-fmt, bin-dir and pkg-url to be specified while providing multiple crates to install.

Fixed #444

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-10-03 12:07:16 +13:00
Jiahao XU
ec2bdb551e
Use CARGO env variable if present (#453)
* Run `$CARGO -vV` in `detect-targets` if env `CARGO` present
* Improve crate doc for `detect-targets`
* Use env var `CARGO` in `install_from_source` if present
* Test use of `CARGO` env in `tests.sh`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-10-02 04:52:25 +13:00
dependabot[bot]
448542f0c8
Bump clap from 4.0.2 to 4.0.4 (#451)
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.2 to 4.0.4.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.0.2...v4.0.4)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-30 02:14:10 +00:00
Jiahao XU
aa864fad59
Bump clap to v4.0.2 (#450)
* Rm unused dep clap from crate `binstalk`
* Bump clap to v4.0.2

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-29 03:14:00 +00:00
dependabot[bot]
111bfde2cb
Update clap requirement from 3.2.22 to 4.0.2 in /crates/binstalk (#448)
Updates the requirements on [clap](https://github.com/clap-rs/clap) to permit the latest version.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.0.0-rc.1...v4.0.2)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-29 12:00:53 +10:00
Jiahao XU
abd50a72ec
Fix skipping optional dep: Skip fetcher if they provide 0 bin (#446)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-29 03:51:11 +13:00
github-actions[bot]
af3316a8f3
release: cargo-binstall v0.14.0 (#443)
* release: cargo-binstall v0.14.0

* Fix README

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-28 06:41:16 +00:00
github-actions[bot]
a79b880e1e
release: binstalk v0.3.0 (#442)
(cargo-release) version 0.3.0

Co-authored-by: github-actions <github-actions@github.com>
2022-09-28 16:22:14 +10:00
Jiahao XU
34df6176fe
Add more to possible_dirs (#441)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-28 04:03:36 +00:00
Jiahao XU
f482e362ba
Make binaries with required-features optional (#438)
* Make binaries with `required-features` optional so that crates like `sccache` would work as expected.
* Fix `infer_bin_dir_template`: concat with `data.bin_path` introduced in #417 
* Always `chmod +x $bin` on unix in case the archive (e.g. `sccache`) did not set the executable bit of fmt == Bin.
* CI: Install `sccache` but do not run it since it requires cargo env to be ready

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-28 13:46:55 +10:00
Jiahao XU
4ba1e221ea
Improve auto discover (#433)
* Add new field `gh_crate_meta::Context::archive_suffix`
* Support `archive_suffix = ""` for unix
* Use `archive-suffix` in `FULL_FILENAMES` & `NOVERSION_FILENAMES` to support `PkgFmt::Bin`
* Simplify `PkgFmt::extensions`
* Fix `default_bin_dir_template` in `infer_bin_dir_template`: Fix typo `archive_suffix`
* Test `default_bin_dir_template` in CI
* Fix installation of `PkgFmt::Bin`: `chmod +x $bin` on unix if fmt == Bin
* Add miniserve to `.github/scripts/tests.sh`
* Update `SUPPORT.md`
* Add github-test-Cargo2.toml to test Github pkg-url with bin-dir provided
* Avoid allocation on processing `path_normalized` in `BinFile::from_product`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-28 02:52:14 +00:00
Jiahao XU
c15903684f
Feature/fix no symlink (#432)
* Refactor `BinFile::from_product`: Simplify logic flow.
* Fix `--no-symlink` behavior

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-28 02:32:22 +00:00
dependabot[bot]
e3cf3e9e3a
Bump thiserror from 1.0.36 to 1.0.37 (#437)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.36 to 1.0.37.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.36...1.0.37)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-28 02:20:23 +00:00
dependabot[bot]
5bb6344987
Bump tokio from 1.21.1 to 1.21.2 (#436)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.21.1 to 1.21.2.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.21.1...tokio-1.21.2)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-28 01:54:15 +00:00
Jiahao XU
f824adeb06
Enable feat gzip, brotli & deflate of dep reqwest (#434)
So that downloading uncompressed binary can be faster for slow connection.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-28 11:17:57 +13:00
dependabot[bot]
ac5efc88fc
Bump digest from 0.10.3 to 0.10.5 (#431)
Bumps [digest](https://github.com/RustCrypto/traits) from 0.10.3 to 0.10.5.
- [Release notes](https://github.com/RustCrypto/traits/releases)
- [Commits](https://github.com/RustCrypto/traits/compare/digest-v0.10.3...digest-v0.10.5)

---
updated-dependencies:
- dependency-name: digest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-27 12:14:17 +10:00
Jiahao XU
b8d2184ee9
Optimize applying PkgOverrides into PkgMeta (#429)
* Refactor: Rm `PkgMeta::clone_without_overrides`
* Impl new fn `PkgMeta::merge_overrides` to avoid unnecessary clone

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-26 19:05:14 +13:00
dependabot[bot]
417143e44d
Bump env_logger from 0.9.0 to 0.9.1 (#428)
Bumps [env_logger](https://github.com/env-logger-rs/env_logger) from 0.9.0 to 0.9.1.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/env-logger-rs/env_logger/compare/v0.9.0...v0.9.1)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-26 03:33:10 +00:00
dependabot[bot]
9ebbf08c63
Bump semver from 1.0.13 to 1.0.14 (#427)
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.13 to 1.0.14.
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.13...1.0.14)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-26 03:17:12 +00:00
dependabot[bot]
4135cc412a
Bump cargo_toml from 0.12.1 to 0.12.2 (#425)
Bumps [cargo_toml](https://gitlab.com/crates.rs/cargo_toml) from 0.12.1 to 0.12.2.
- [Release notes](https://gitlab.com/crates.rs/cargo_toml/tags)
- [Commits](https://gitlab.com/crates.rs/cargo_toml/commits/master)

---
updated-dependencies:
- dependency-name: cargo_toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-26 02:59:57 +00:00
dependabot[bot]
f2e610c55f
Bump thiserror from 1.0.35 to 1.0.36 (#426)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.35 to 1.0.36.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.35...1.0.36)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-26 02:42:15 +00:00
dependabot[bot]
8414a45ade
Bump url from 2.3.0 to 2.3.1 (#424)
Bumps [url](https://github.com/servo/rust-url) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v2.3.0...v2.3.1)

---
updated-dependencies:
- dependency-name: url
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-26 02:19:10 +00:00
Jiahao XU
2cc12f9b69
Optimize bins::BinFile (#422)
* Extract `infer_bin_dir_template` and call it once in `collect_bin_files`
* Ensure `product.name.is_some()` is true
* Avoid cloning `str` in `BinFile::from_product`
* Optimize: Take reference in `bins::Data`
* Optimize: Construct `CompactString` only when needed

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-26 09:39:41 +13:00
Jiahao XU
3da5cb9d9c
Check source_file_path to ensure it is valid (#421)
* Add new variant `BinstallError::DuplicateSourceFilePath`
* Check `bin.source` in `collect_bin_files`
* Add new variant `BinstallError::InvalidSourceFilePath`
* Make sure generated source_file_path cannot access outside curdir
* Add new variant `BinstallError::EmptySourceFilePath`
* Ensure source_file_path is not empty

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-25 13:32:34 +00:00
Jiahao XU
e034d69e12
Impl try multiple default bin dirs (#417)
From @passcod :

* Make bin-dir an Option
* Use cargo-release as a test case
* WIP: Try multiple default bin dirs
* Update bins.rs
* Update cargo_toml_binstall.rs

From @NobodyXu :
* Optimize & Prepare for support multi `bin-path`s
* Ensure quickinstall bin_dir work as usual.
* Rm dup entries in `FULL_FILENAMES`
* Add second version of `NOVERSION_FILENAMES`
* Impl multiple default `bin-dir`s
* Improve doc for `BinFile::from_product`
* Fix tests.sh

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Co-authored-by: Félix Saparelli <felix@passcod.name>
2022-09-26 01:15:20 +13:00
github-actions[bot]
c27c3b80b5
release: cargo-binstall v0.13.3 (#420)
Co-authored-by: github-actions <github-actions@github.com>
2022-09-25 03:23:05 +00:00
github-actions[bot]
20ef4635c4
release: binstalk v0.2.2 (#419)
(cargo-release) version 0.2.2

Co-authored-by: github-actions <github-actions@github.com>
2022-09-25 03:14:13 +00:00
Jiahao XU
ae9f536400
Fix/dep cargo_toml: Bump to v0.12.1 (#418)
* Fix `cargo_toml`: Bump dep to v0.12.1
* Test `cargo-watch` in CI
* Fix `*-test-Cargo.toml` used in integration tests

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-25 16:01:57 +13:00
github-actions[bot]
c86cba3cc4
release: cargo-binstall v0.13.2 (#415)
Co-authored-by: github-actions <github-actions@github.com>
2022-09-24 14:21:58 +12:00
github-actions[bot]
480ca8ec19
release: binstalk v0.2.1 (#414)
(cargo-release) version 0.2.1

Co-authored-by: github-actions <github-actions@github.com>
2022-09-24 01:34:52 +00:00
Jiahao XU
cd3afdd9a3
Bump dep cargo_toml to v0.12.0 (#413)
* Bump dep cargo_toml to v0.12.0
* FIx compilation error
* Fix test parse-meta

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-24 13:18:47 +12:00
dependabot[bot]
34e493927f
Bump serde from 1.0.144 to 1.0.145 (#408)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.144 to 1.0.145.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.144...v1.0.145)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-23 04:15:12 +00:00
dependabot[bot]
6928dd63dc
Bump clap from 3.2.21 to 3.2.22 (#409)
Bumps [clap](https://github.com/clap-rs/clap) from 3.2.21 to 3.2.22.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/v3.2.22/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.2.21...v3.2.22)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-23 04:00:28 +00:00
dependabot[bot]
9c649ff316
Bump once_cell from 1.14.0 to 1.15.0 (#407)
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.14.0 to 1.15.0.
- [Release notes](https://github.com/matklad/once_cell/releases)
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.14.0...v1.15.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-23 03:39:59 +00:00
dependabot[bot]
47a663a03e
Bump thiserror from 1.0.34 to 1.0.35 (#410)
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.34 to 1.0.35.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.34...1.0.35)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-23 03:24:20 +00:00
dependabot[bot]
f41eacf9f3
Bump jobslot from 0.2.1 to 0.2.6 (#411)
Bumps [jobslot](https://github.com/cargo-bins/jobslot) from 0.2.1 to 0.2.6.
- [Release notes](https://github.com/cargo-bins/jobslot/releases)
- [Commits](https://github.com/cargo-bins/jobslot/compare/v0.2.1...v0.2.6)

---
updated-dependencies:
- dependency-name: jobslot
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-23 13:04:31 +10:00
dependabot[bot]
569cc3816e
Bump clap from 3.2.20 to 3.2.21 (#404)
Bumps [clap](https://github.com/clap-rs/clap) from 3.2.20 to 3.2.21.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/v3.2.21/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.2.20...v3.2.21)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-22 06:01:33 +00:00
dependabot[bot]
54122e1eae
Bump itertools from 0.10.3 to 0.10.5 (#403)
Bumps [itertools](https://github.com/rust-itertools/itertools) from 0.10.3 to 0.10.5.
- [Release notes](https://github.com/rust-itertools/itertools/releases)
- [Changelog](https://github.com/rust-itertools/itertools/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-itertools/itertools/commits)

---
updated-dependencies:
- dependency-name: itertools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-22 05:39:11 +00:00
dependabot[bot]
e186dfd98d
Bump reqwest from 0.11.11 to 0.11.12 (#405)
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.11 to 0.11.12.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.11...v0.11.12)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-22 05:19:33 +00:00
dependabot[bot]
e4a6925e59
Bump url from 2.2.2 to 2.3.0 (#402)
Bumps [url](https://github.com/servo/rust-url) from 2.2.2 to 2.3.0.
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v2.2.2...v2.3.0)

---
updated-dependencies:
- dependency-name: url
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-22 05:00:08 +00:00
dependabot[bot]
ab87f19094
Bump tokio from 1.21.0 to 1.21.1 (#401)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.21.0 to 1.21.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.21.0...tokio-1.21.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-22 14:31:15 +10:00
Jiahao XU
1a1310f98b
Enable dependabot for Cargo.lock (#399)
* Enable dependabot for `Cargo.lock`
* Fix dependabot for fs-lock & detect-targets

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-22 15:59:25 +12:00
Félix Saparelli
7816b2162b
Pull cargo-binstall crate readme from root of repo (#398) 2022-09-18 03:57:18 +00:00
Jiahao XU
aa12109f3e
Fixed link to BinstallError in README.md (#397) 2022-09-18 15:41:42 +12:00
Félix Saparelli
6bd1fc68b5
Use github source for latest version readme (#395)
The crate _doesn't_ have the readme snapshot anymore, likely due to
the new split crate layout; we should probably fix that but in the
meantime this does the trick.
2022-09-17 22:27:52 +10:00
github-actions[bot]
e8dfbe3afb
release: cargo-binstall v0.13.1 (#370)
Co-authored-by: github-actions <github-actions@github.com>
2022-09-17 23:35:18 +12:00
github-actions[bot]
d141f4ca81
release: binstalk v0.2.0 (#394)
(cargo-release) version 0.2.0

Co-authored-by: github-actions <github-actions@github.com>
2022-09-17 21:00:43 +10:00
Jiahao XU
946dd2d0b9
Avoid misleading confusion of README.md (#392)
Fixed #391
2022-09-17 22:34:38 +12:00
Jiahao XU
fa79e7f105
Verify that bin_files exist in resolve stage (#382)
* Refactor: Extract new fn `BinFile::check_source_exists`
* Impl new async fn `AutoAbortJoinHandle::flattened_join`
* Impl new fn `Fetcher::fetcher_name`
* Verify that `bin_files` exist in `resolve` stage
   To ensure that the installation stage won't fail because of missing
   binaries.
* Rm unused `MultiFecther`
* Simplify `Future` impl for `AutoAbortJoinHandle`
* Add new variant `BinstallError::CargoTomlMissingPackage`
* Replace `unwrap` in `resolve_inner` with proper error handling
* Make `Fetcher::new` as a regular function
   instead of an `async` function.
* Ret `Arc<dyn Fetcher>` in trait fn `Fetcher::new`
* Refactor `resolve_inner`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-17 09:28:22 +00:00
Jiahao XU
7ac55c46f1
Add new feature log_release_max_level_debug and enable it on CI release build (#390)
* Add new feature `log_release_max_level_debug`
* Fix calculation of `log_level` in `logging`
* Enable feature log_release_max_level_debug on CI release build

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-17 09:22:19 +00:00
Jiahao XU
ee340d80b6
Use fork binstall-zip here for new features & updated deps (#375)
* Use fork binstall-zip here for new features & updated deps

Also update zstd to v0.11.2

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update `Cargo.lock`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-17 09:00:16 +00:00
Jiahao XU
934ccc257b
Support new cmdline option --roots (#389)
* Add new field `Args::roots`
* Use `env::var_os` to fetch `CARGO_INSTALL_ROOTS`
   Previously, it uses `env::var`, which might reject valid path just
   because it is not utf-8 string.
* Update manifest if `CARGO_INSTALL_ROOT` is specified
* Add new fn `install_path::get_cargo_roots_path`
* Fix updating manifest: Use `cargo_roots` instead of default path
* Rm `helpers::statics::cargo_home`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-17 20:34:36 +12:00
azzamsa
a611b824fd
docs: fix grammatical error (#386) 2022-09-16 02:55:19 +00:00
azzamsa
a5ffba1ffb
docs: add unsupported crate example (#385) 2022-09-15 21:22:28 +10:00
azzamsa
559c3b8658
docs: add possible values to pgk-fmt argument (#383)
Fixes #378
2022-09-15 07:18:55 +00:00
azzamsa
0e68c0fda3
fix: pkg-fmt parsing should be case insensitive (#384)
Fixes: #377
2022-09-15 02:25:21 +00:00
Félix Saparelli
757ecfaef8
Fix logging that was broken due to lib rename (#371) 2022-09-10 12:54:31 +00:00
Félix Saparelli
62dc435e3a
Fix bin metadata (#369) 2022-09-10 12:07:19 +00:00
Félix Saparelli
9372ea4e53
Fix release script (#368) 2022-09-10 23:59:41 +12:00
Félix Saparelli
b89a4a56b8
Fix (remove) escaping for release blurb in release-pr template (#367) 2022-09-10 23:46:15 +12:00
github-actions[bot]
037e62184f
release: cargo-binstall v0.13.0 (#366)
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Félix Saparelli <felix@passcod.name>
2022-09-10 11:07:41 +00:00
github-actions[bot]
22ac1cf5d3
release: binstalk v0.1.0 (#365)
Co-authored-by: github-actions <github-actions@github.com>
2022-09-10 07:11:06 +00:00
Félix Saparelli
be8e83b8bd
Update release-pr config (#364) 2022-09-10 06:56:33 +00:00
Félix Saparelli
e25aa50ec9
Rename lib to binstalk (#361) 2022-09-10 16:44:18 +10:00
Jiahao XU
a94d83f0d5
Fix tar by temporarily using a fork (#358)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-10 06:06:22 +00:00
Félix Saparelli
0c6687455f
Trim trailing slash from repo (#360) 2022-09-10 17:32:55 +12:00
Jiahao XU
32c3154abb
Replace dep jobserver with jobslot (#355)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-09 20:46:43 +12:00
Félix Saparelli
56bafc8c9b
Add install recommendation to readme (#351) 2022-09-09 08:27:54 +00:00
Félix Saparelli
e24b2ce1e3
Disable zlib-ng for the default cargo-install build (#354)
but explicitly enable it in our own builds.

This is because using zlib-ng sometimes does not compile easily on Windows,
and using the pure miniz_oxide offers a better install story from source.

For our binary builds, we can provide the optimal performance, and still
do that for most users as they will update with cargo-binstall, getting our
build as a second pass.
2022-09-09 18:06:05 +12:00
Jiahao XU
23daef610b
Fix .github/scripts/tests.sh: Fix testing for ugprading (#352)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-07 18:46:25 +10:00
Félix Saparelli
bcec382a64
Improve release-pr usage (#350) 2022-09-07 17:40:46 +10:00
Jiahao XU
f7ad78288b
Reuse reqwest client in crates_io_api::AsyncClient (#349) 2022-09-06 16:52:05 +12:00
github-actions[bot]
e7d2eb1aef
release: detect-targets v0.1.2 (#347)
(cargo-release) version 0.1.2

Co-authored-by: github-actions <github-actions@github.com>
2022-09-05 05:14:07 +00:00
Jiahao XU
02df445926
Fix documentation field in detect-targets/Cargo.toml (#346)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-05 17:00:36 +12:00
Félix Saparelli
4885cfbb88
Add important usage note for triggering builds to release template (#345) 2022-09-05 04:47:20 +00:00
github-actions[bot]
9b405fc03f
release: detect-targets v0.1.1 (#344)
Co-authored-by: github-actions <github-actions@github.com>
2022-09-05 04:37:14 +00:00
Félix Saparelli
db82c6935f
Deprecate --secure, enforce HTTPS (#343)
Resolves #124
2022-09-05 14:18:14 +10:00
Félix Saparelli
73f7719e53
Recommend taiki-e/install-action (#342)
See #309
2022-09-05 15:12:56 +12:00
github-actions[bot]
eb93eafb9d
release: fs-lock v0.1.0 (#339)
Co-authored-by: github-actions <github-actions@github.com>
2022-09-04 16:04:52 +00:00
Félix Saparelli
a628cbf876
Rename flock to fs-lock (#338) 2022-09-04 15:28:22 +00:00
Félix Saparelli
3387a63895
Fix release PR template (#336) 2022-09-04 15:19:17 +00:00
Jiahao XU
89869db239
Fix doc of desired_targets (#337) 2022-09-04 15:11:28 +00:00
github-actions[bot]
79d4e9b015
release: normalize-path v0.1.0 (#335)
Co-authored-by: Félix Saparelli <felix@passcod.name>
2022-09-04 14:59:51 +00:00
github-actions[bot]
f439767b6f
release: detect-targets v0.1.0 (#333)
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Félix Saparelli <felix@passcod.name>
2022-09-04 14:34:51 +00:00
github-actions[bot]
c3773a4a48
release: detect-wasi v1.0.0 (#332)
Co-authored-by: github-actions <github-actions@github.com>
2022-09-04 13:45:28 +00:00
Félix Saparelli
e21617cc9e
Adapt release workflow for workspace (#331)
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-09-04 11:12:10 +00:00
Félix Saparelli
f5a682ccce
Stop using borrows of reqwest::Client (#316) 2022-09-04 11:00:33 +00:00
Félix Saparelli
1cf6076d62
Add phantom digest support to download (#315) 2022-09-04 22:47:18 +12:00
Félix Saparelli
280bc974eb
Use release PR action (#330) 2022-09-04 09:38:08 +00:00
Félix Saparelli
0cb4c993b3
Explode out even more variants of default download URLs (#329) 2022-09-02 16:00:46 +12:00
Jiahao XU
b330a18d40
Change typeof Args::targets to Option<Vec<String>> (#327)
* Change typeof `Args::targets` to `Option<Vec<String>>`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-31 16:48:15 +12:00
Félix Saparelli
480ea19462
Move internal details of download to be internal to download (#314) 2022-08-31 12:10:03 +12:00
Jiahao XU
f38c1e73c3
Ignore trust_dns log output (#323)
* Ignore all log except `binstall` & `cargo_binstall` unless `level` is set to `Trace`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-27 11:39:12 +00:00
Jiahao XU
305cda3336
Optimize compilation time (#320)
* Print `rerun-if-changed=build.rs` in `build.rs`
* Optimize compile-time: Extract `bin/src/lib.rs`
   
   so that `cargo-binstall (lib)` can be compiled in parallel to other
   deps.
* Refactor: Extract new mod `bin/src/bin_utils.rs`
* Extract new fn `MainExit::new`
* Refactor: Extract new fn `run_tokio_main`
* Handle `Runtime::new` err gracefully in `run_tokio_main`
   instead of `panic!`ing, return the error as `BinstallError`
* Avoid mixing `eprintln` and `error` in `MainExit::report`
* Set profile for `build-override`
   to speedup building of `build.rs` and proc macros.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-27 23:27:39 +12:00
Jiahao XU
e39a02aa92
Test default pkg-url for GitLab and BitBucket (#322)
* Test default `pkt-url` for GitLab and BitBucket
* Fail if `cargo-build` is called when testing GitLab/BitBucket
* Fix use of `remote_exists` in `GhCrateMeta::launch_baseline_find_tasks`
   
   If `Method::HEAD` fails, try `Method::GET` since some servers reject
   `Method::HEAD`, e.g. bbuseruploads.s3.amazonaws.com

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-27 10:45:55 +00:00
Jiahao XU
f973d32ff6
Use BTreeMap in field PkgMeta::overrides (#324) instead of HashMap.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-27 10:35:11 +00:00
Jiahao XU
7f9ad613a8
Optimize drivers::crates_io::Vfs: Use BTreeMap (#325) instead of HashMap.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-27 10:18:25 +00:00
Jiahao XU
16b16c482c
Optimize GhCrateMeta::find: use FuturesUnordered (#321)
* Optimize `GhCrateMeta::find` using `FuturesUnordered`
* Optimize `MultiFetcher`: Impl `with_capacity` use it in `resolve_inner` to avoid over-reservation
* Enable feature "std" of dep futures-util

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-27 21:56:43 +12:00
Jiahao XU
4def4d08fd
Add new feature trust-dns to lib & bin (#318)
* Add new feature `trust-dns` to lib & bin
* Enable `trust-dns` feature by default
   Because the `getaddrinfo` is a poorly designed API.
* USe default feature set on windows CI
   because wintls on the CI does not support TLS 1.3 and trust-dns only
   support dns over https if rustls is used.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-25 12:01:22 +12:00
Jiahao XU
846e7ead91
Support other git hosting services (#312)
* Impl new mod `hosting` for detecting git hosting services
* Refactor: Make `guess_git_hosting_services` associated fn of `GitHostingService`
* Set default value of `PkgMeta::pkg_url` to `None`
* Impl new method `get_redirected_final_url`
* Use `get_redirected_final_url` in `GhCrateMeta::find` to make `guess_git_hosting_services` more accurate.
* Use redirected `repo` in `GhCrateMeta::launch_baseline_find_tasks`
* Refactor `<GhCrateMeta as Fetcher>::find`
* Mod `get_default_pkg_url_template` to ret `&[&str]`
* Add more default `pkg-url` templates
* Rm `pkg-url` in `bin/Cargo.toml`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-24 07:16:26 +00:00
Jiahao XU
6b5e8f6875
Auto detect pkg_fmt (#310)
* Refactor: Extract `GhCrateMeta::find_baseline`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Update `Cargo.lock`: Update dep `compact_str`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix use of `fetchers`: Set `meta.pkg_fmt` using `fetcher.pkg_fmt()`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Derive `strum_macors::{Display, EnumIter}` for `PkgFmt`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Set typeof field `PkgMeta::pkg_fmt` to be `Option<PkgFmt>`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Optimize `Fetcher::new` to take `&Arc<Data>` instead of `&Data`

To avoid unnecessary `Data::clone` call in `GhCrateMeta`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Optimize `GhCrateMeta::find_baseline`: Avoid unnecessary spawning

for `let Err(_) = url`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Optimize spawning in `GhCrateMeta::find_baseline`

Ret `Option<Url>` instead of `(Url, bool)`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add new method `target_meta` to trait `Fetcher`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Simplify `resolve_inner` using `Fetcher::target_meta`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Optimize loop in `resolve_inner`: Avoid cloning `PkgOverride`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Impl `PkgMeta::clone_without_overrides`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Optimize `resolve_inner` loop: Use `PkgMeta::clone_without_overrides`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Simplify `Context::from_data` impl

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Extract `launch_baseline_find_tasks`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Simplify `<GhCrateMeta as Fetcher>::find`

Instead of launching tasks in an opaque manner in `Self::find_baseline`,
the new design returns an iterator which launches the tasks and thus
have a unified `.await` point for all these tasks.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add `warn!`ing to report failure of `Context::render_url`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-22 12:28:36 +00:00
dependabot[bot]
b5ea9a2293
Update compact_str requirement from 0.5.2 to 0.6.0 in /crates/lib (#308)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-22 15:15:01 +12:00
Jiahao XU
62f9450d2d
Refactor: Extract new crate detect-targets and improve code quality (#307)
* Refactor: Extract new crate `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Extract new mod `detect` for `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Extract `desired_targets` in crate `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Extract `detect::linux` in crate `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Extract `detect::macos` in crate `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Extract `detect::windows` in crate `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add new dep cfg-if v1.0.0 for `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Simplify mod declaration in `detect` using `cfg_if!`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Refactor: Simplify `detect_targets` using `cfg_if!`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add crate doc for `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Enable feature "macros" of tokio in `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Enable feature "io-util" of dep tokio

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Rm unused feature "io-util" & "macros" of dep tokio

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Set stdin & stderr to null in `get_target_from_rustc`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Improve doc of `get_desired_targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Improve `detect_targets_linux`: Run `ldd` with stdin set to null

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix potential panic in `windows::detect_alternative_targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* FIx fmt of `detect_targets_linux`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Do not re-export dep `detect-targets` in `crates/lib`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix typo in crate doc for `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Enable feature "macros" of tokio in dev mode

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Add example to crate doc of `detect-targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Improve API `get_desired_targets`: Take `Option<&str>`

instead of `&Option<String>`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-21 22:21:33 +10:00
Jiahao XU
1102284684
Fix clippy warnings and add new workflow clippy (#306)
* Derive `Eq` for `PkgFmt`, `PkgFmtDecomposed` & `TarBasedFmt`
* Derive `Eq` for `PkgMeta`, `PkgOverride` & `BinMeta`
* Rm unnecessary reborrow in `install_from_source`
* Rm unnecessary `into()` in `args::parse`
* Fix `clippy` warning in `CratesToml::append_to_path`
* Fix clippy warning in `cratesio_url`
* Fix clippy warning in `detect_targets_linux`
* Add `clippy` and `rustfmt` to workflow `unit-test`

Because `clippy` would not check inactive code disabled by `cfg`, so we
have to also run `clippy` on multiple targets.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-21 02:40:50 +12:00
dependabot[bot]
4812456357
Bump futures-util from 0.3.21 to 0.3.23 (#298)
Bumps [futures-util](https://github.com/rust-lang/futures-rs) from 0.3.21 to 0.3.23.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.21...0.3.23)

---
updated-dependencies:
- dependency-name: futures-util
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-20 12:39:37 +00:00
dependabot[bot]
3e2d272bfd
Bump serde from 1.0.142 to 1.0.143 (#297)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.142 to 1.0.143.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.142...v1.0.143)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-20 12:26:50 +00:00
dependabot[bot]
d9c7bdab55
Bump miette from 5.2.0 to 5.3.0 (#300)
Bumps [miette](https://github.com/zkat/miette) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/zkat/miette/releases)
- [Changelog](https://github.com/zkat/miette/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zkat/miette/compare/miette-derive-v5.2.0...miette-derive-v5.3.0)

---
updated-dependencies:
- dependency-name: miette
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-20 12:16:48 +00:00
dependabot[bot]
af59a59085
Bump clap from 3.2.16 to 3.2.17 (#299)
Bumps [clap](https://github.com/clap-rs/clap) from 3.2.16 to 3.2.17.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/v3.2.17/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.2.16...v3.2.17)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-20 12:04:12 +00:00
dependabot[bot]
88ddcf3599
Bump softprops/action-gh-release (#302)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-20 11:56:29 +00:00
dependabot[bot]
df3a8e21c7
Bump actions/checkout from 2 to 3 (#303)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-20 11:44:52 +00:00
Félix Saparelli
4b00f5f143
Split crates and clean up structure of codebase (#294)
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-20 11:24:12 +00:00
Jiahao XU
bf700f9012
Improve err msg when source is missing in BinFile::install_bin (#301)
* Improve err msg in `helpers::atomic_install`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Check for missing `source` in `install_bin`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix `install_bin`: Use `try_exists` instead of `exists`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Do not test `cargo-deb` in `ci-scripts/tests.sh`

Due to the fact that it uses gnu sparse extension which is not supported
by crate `tar`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-20 00:25:51 +10:00
Félix Saparelli
763d4610e5
Don't prompt if there's nothing to do (#293)
Fixes #291
2022-08-09 09:09:21 +00:00
github-actions[bot]
4500e4af63
release: v0.12.0 (#253)
Co-authored-by: github-actions <github-actions@github.com>
2022-08-08 23:28:49 +12:00
Jiahao XU
9034f78df4
Merge pull request #282 from cargo-bins/skip-if-already-installed
Skip if already installed and add new cmdline option `--force`
2022-08-08 19:52:52 +10:00
Jiahao XU
a271e695a5
Ignore if package already up-to-date
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 19:18:30 +10:00
Jiahao XU
b69d7e7c06
Test When 0.11.0 is installed but can be upgraded in tests.sh
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:06:36 +10:00
Jiahao XU
36926518cf
Use VersionReqExt::is_latest_compatible in entry:367
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:06:36 +10:00
Jiahao XU
b94dc979ac
Add new trait VersionReqExt and impl it for VersionReq
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:06:34 +10:00
Jiahao XU
d932f1c262
Fix testing skip if installed in ci-scripts/tests.sh
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
4a17460252
Test skip when installed in ci-scripts/tests.sh
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
7f4edfd9f2
log::info! if a crate is skipped due to already installed
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
2c2b3c070f
Skip only if version_req is satisfied
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
431992dab0
Test --version and $crate_name@$version in tests.sh
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
065f62a625
Use VersionReq for Options::version_req and update usage of
`CrateName` in `binstall::install`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
686cae6ae8
Use &VersionReq for param version_req of fetch_crate_cratesio
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:59 +10:00
Jiahao XU
497ef80b27
Take &VersionReq for 1st param of find_version
instead of `&str`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
dd8e6a400d
Rename CrateName::version to version_req and change its type to
`Option<VersionReq>`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
51d6b3039b
Impl new fn helpers::parse_version
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
20c7b61e7a
FIx ci-scripts/tests.sh: Use --force to force installation.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
34f714c64f
Pass --force to cargo-install
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
4b79abeedc
Refactor: Run TempDir creation in block_in_place
Since it could also issues blocking operations.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
b8c44839c1
Detect install_path & load metadata in block_in_place
since they involves blocking fs io.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
b4c6db7cda
Refactor & Optimize: Launch target detection as soon as possible
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:58 +10:00
Jiahao XU
4dae214af3
Use block_in_place for loading metadata
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:57 +10:00
Jiahao XU
6716d75607
Minor Refactor: Gather code related to crate_names
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:57 +10:00
Jiahao XU
ac085533cc
Skip crates that are already installed.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:57 +10:00
Jiahao XU
04fee49c22
Add new option Options::force
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-08 18:05:57 +10:00
Ryan
0bbeecce86
Merge pull request #284 from cargo-bins/split-docs
split docs, first step towards simplifying support instructions
2022-08-08 14:50:21 +12:00
Jiahao XU
1bb2602c86
Merge pull request #287 from cargo-bins/dependabot/cargo/semver-1.0.13
Bump semver from 1.0.12 to 1.0.13
2022-08-08 12:01:47 +10:00
Jiahao XU
cf7c3aec27
Merge pull request #286 from cargo-bins/dependabot/cargo/strum_macros-0.24.3
Bump strum_macros from 0.24.2 to 0.24.3
2022-08-08 12:01:18 +10:00
dependabot[bot]
5b35beb68b
Bump semver from 1.0.12 to 1.0.13
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.12 to 1.0.13.
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.12...1.0.13)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 01:44:57 +00:00
dependabot[bot]
03291c895a
Bump strum_macros from 0.24.2 to 0.24.3
Bumps [strum_macros](https://github.com/Peternator7/strum) from 0.24.2 to 0.24.3.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

---
updated-dependencies:
- dependency-name: strum_macros
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 01:44:44 +00:00
ryan kurte
5c703f30ca add note about quickinstall / cargo install fallback 2022-08-08 11:42:06 +12:00
Jiahao XU
132c5dfaa9
Merge pull request #280 from cargo-bins/signal-handling
Add Signal handling
2022-08-06 20:13:03 +10:00
Félix Saparelli
68d3ab56f7
Enable sparse registry in CI (#285) 2022-08-06 22:07:24 +12:00
ryan kurte
b3f6eb64ea split docs, first step towards simplifying support instructions 2022-08-06 09:44:17 +12:00
Jiahao XU
5748fd6cf3
Merge pull request #283 from cargo-bins/fix/passing-quiet
Fix passing `--quiet` to `cargo-install`
2022-08-05 16:05:11 +10:00
Jiahao XU
9cb8df1d48
Fix passing --quiet to cargo-install
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-05 15:45:46 +10:00
Jiahao XU
b46e54b53a
Merge pull request #281 from cargo-bins/fix-quiet
Improve doc of cmdline option `log_level`, add `--quiet` and pass it to `cargo-install`
2022-08-05 15:35:56 +10:00
Jiahao XU
c352eb00d1
Add missing doc for trace for Options::log_level
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-05 15:24:39 +10:00
Jiahao XU
7a90d4d6c6
Improve help page for Options::log_level
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-05 15:09:40 +10:00
Jiahao XU
8d5f555373
Add new option -q for compatibility with cargo-install
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-05 15:02:38 +10:00
Jiahao XU
b6a539735d
Pass -q to cargo-install if log_level is set to off
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 23:21:29 +10:00
Jiahao XU
3d28549fd6
Apply clippy suggestions in binstall::install
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 23:18:00 +10:00
Jiahao XU
6685d5a610
Add new option Options::quiet
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 23:16:45 +10:00
Jiahao XU
62bce2f52f
Improve doc for Options::log_level
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 23:15:05 +10:00
Jiahao XU
ede134d851
Fix locking of stdou in UIThreadInner
which blocks the printing in main thread and prevents it from exiting.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 23:04:04 +10:00
Jiahao XU
cea67b2e54
Use std:🧵:spawn in UIThreadInner
instead of `tokio::task::spawn_blocking` so that dropping rt would not
block the main thread until the ui thread is exit (which might never
exit).

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 23:01:26 +10:00
Jiahao XU
f4dd75ef9b
Update doc on BinstallError::UserAbort
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 19:44:12 +10:00
Jiahao XU
b921e9dfc8
Use cancel_on_user_sig_term in main
to cancel the execution if users requested termination via signal.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 19:42:47 +10:00
Jiahao XU
47ab8f55c7
Impl new fn helpers::cancel_on_user_term
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 19:37:13 +10:00
Jiahao XU
74051eb478
Enable feature "macros" of dep "tokio"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 18:46:41 +10:00
Jiahao XU
ca3efdf2eb
Enable feature "signal" of dep "tokio"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 18:45:32 +10:00
Jiahao XU
e8301839a9
Use AutoAbortJoinHandle in main::entry
so that the tasks will be cancelled if future returned by
`entry()` is cancelled.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 18:39:17 +10:00
Jiahao XU
a13180f79a
Ret BinstallError in <AutoAbortJoinHandle as Future>::poll
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 18:37:52 +10:00
Jiahao XU
36066fd4df
Use AutoAbortJoinHandle::spawn in GhCrateMeta::find
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 18:33:35 +10:00
Jiahao XU
5d315ae801
Use AutoAbortJoinHandle::spawn in MultiFetcher::add
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 18:31:23 +10:00
Jiahao XU
2103dea3ac
Impl new convenient fn AutoAbortJoinHandle::spawn
As a shortcut to `AutoAbortJoinHandle::new(tokio::spawn(...))`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 18:30:48 +10:00
Jiahao XU
64e948f941
Merge pull request #278 from cargo-bins/optimize
Optimize `target::linux::detect_target_linux`
2022-08-04 18:23:04 +10:00
Jiahao XU
3ef5125c3a
Merge pull request #277 from cargo-bins/improve-integration-test
Rm `$HOME/.cargo` to test `cargo-binstall`
2022-08-04 18:22:25 +10:00
Jiahao XU
d472e8054b
Fix typo in target::linux::create_targets_str
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 17:46:26 +10:00
Jiahao XU
140d3df8bd
Fix integration test: Set CARGO_HOME instead of rm -rf $HOME/.cargo
The later would also delete the cmd `cargo`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 17:40:58 +10:00
Jiahao XU
a686aca08c
Refactor: Extract target::linux::create_targets_str
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 17:38:27 +10:00
Jiahao XU
7997c73cb2
Optimize: Avoid spawning ldd if built with Glibc
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 17:35:24 +10:00
Jiahao XU
cc92c2c4b6
Rm $HOME/.cargo to test cargo-binstall
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 17:29:19 +10:00
Jiahao XU
888627ce87
Merge pull request #273 from cargo-bins/dependabot/cargo/async-trait-0.1.57
Bump async-trait from 0.1.56 to 0.1.57
2022-08-04 16:40:30 +10:00
Jiahao XU
fb52308d39
Merge pull request #274 from cargo-bins/dependabot/cargo/thiserror-1.0.32
Bump thiserror from 1.0.31 to 1.0.32
2022-08-04 16:39:56 +10:00
dependabot[bot]
3cc3338ff5
Bump async-trait from 0.1.56 to 0.1.57
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.56 to 0.1.57.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.56...0.1.57)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-04 06:28:22 +00:00
dependabot[bot]
1aa04a25c6
Bump thiserror from 1.0.31 to 1.0.32
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.31 to 1.0.32.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.31...1.0.32)

---
updated-dependencies:
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-04 06:27:58 +00:00
Jiahao XU
ba57e2905b
Merge pull request #272 from cargo-bins/dependabot/cargo/serde-1.0.142
Bump serde from 1.0.140 to 1.0.142
2022-08-04 16:26:59 +10:00
dependabot[bot]
ec2c11843b
Bump serde from 1.0.140 to 1.0.142
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.140 to 1.0.142.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.140...v1.0.142)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-04 06:20:52 +00:00
Jiahao XU
b1490ffba3
Merge pull request #275 from cargo-bins/dependabot/cargo/serde_json-1.0.83
Bump serde_json from 1.0.82 to 1.0.83
2022-08-04 16:19:56 +10:00
dependabot[bot]
2383f81760
Bump serde_json from 1.0.82 to 1.0.83
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.82 to 1.0.83.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.82...v1.0.83)

---
updated-dependencies:
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-04 06:11:34 +00:00
Jiahao XU
608f90f51a
Merge pull request #271 from cargo-bins/dependabot/cargo/miette-5.2.0
Bump miette from 5.1.1 to 5.2.0
2022-08-04 16:10:11 +10:00
dependabot[bot]
9627b73d6b
Bump miette from 5.1.1 to 5.2.0
Bumps [miette](https://github.com/zkat/miette) from 5.1.1 to 5.2.0.
- [Release notes](https://github.com/zkat/miette/releases)
- [Changelog](https://github.com/zkat/miette/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zkat/miette/compare/miette-derive-v5.1.1...miette-derive-v5.2.0)

---
updated-dependencies:
- dependency-name: miette
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-04 04:52:56 +00:00
Jiahao XU
d2ab613652
Merge pull request #276 from NobodyXu/fix
Fix #267
2022-08-04 14:51:44 +10:00
Jiahao XU
71566383db
Fix creating .cargo/.crates.toml in metadata::v1
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 14:08:06 +10:00
Jiahao XU
28aeae938e
fs::create_dir_all(&install_path) in main.rs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 14:00:44 +10:00
Jiahao XU
346bb8ee67
Fix binstall::resolve (#266) 2022-08-04 11:12:06 +12:00
Jiahao XU
f7625fcefc
Merge pull request #264 from NobodyXu/fix-repeated-crates-on-batch-installation
Fix repeated crates on batch installation: Dedup them and only keep the last one
2022-08-03 21:32:09 +10:00
Jiahao XU
8d410a5710
Merge pull request #265 from NobodyXu/minor-fix-and-optimize
Minor fix (use `PathBuf` instead of `String` to relax utf-8 req) and micro optimization
2022-08-03 13:21:45 +10:00
Jiahao XU
60d17c7e56
Ret CompactString in Fetcher::source_name
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:42:05 +10:00
Jiahao XU
f72eafb049
Use PathBuf for field Options::install_path
Since it does not require a utf-8 string.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:28:44 +10:00
Jiahao XU
a52ac3fc7a
Use CompactString for Options::version_req
which is unlikely to be larger than 24 bytes.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:26:44 +10:00
Jiahao XU
b7cfa0aa64
Use CompactString for field Resolution::Fetch::version
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:21:45 +10:00
Jiahao XU
d430c077d4
Use CompactString for fields of CrateName
Since most of the time, they are shorter than 24 bytes.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:17:11 +10:00
Jiahao XU
caeb49ce33
Rm duplicate crate_names specified on cmdline
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:15:09 +10:00
Jiahao XU
09c1afe616
Impl new fn CrateName::dedup
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:14:05 +10:00
Jiahao XU
58c50cbe91
Add new dep itertools v0.10.3
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 20:18:44 +10:00
Jiahao XU
9391d22fa2
Apply clippy suggestion
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 19:54:01 +10:00
Jiahao XU
a2e6709ed6
Merge pull request #262 from ryankurte/dependabot/cargo/bytes-1.2.1
Bump bytes from 1.2.0 to 1.2.1
2022-08-01 18:23:50 +10:00
dependabot[bot]
da19855500
Bump bytes from 1.2.0 to 1.2.1
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/commits)

---
updated-dependencies:
- dependency-name: bytes
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-01 03:41:34 +00:00
Jiahao XU
ea8ae5ce26
Merge pull request #261 from ryankurte/dependabot/cargo/tokio-1.20.1
Bump tokio from 1.20.0 to 1.20.1
2022-08-01 13:40:35 +10:00
Jiahao XU
fba5394e77
Merge pull request #263 from ryankurte/dependabot/cargo/clap-3.2.16
Bump clap from 3.2.14 to 3.2.16
2022-08-01 13:40:07 +10:00
dependabot[bot]
c5961ee07f
Bump clap from 3.2.14 to 3.2.16
Bumps [clap](https://github.com/clap-rs/clap) from 3.2.14 to 3.2.16.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.2.14...v3.2.16)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-01 01:33:47 +00:00
dependabot[bot]
3cdb2aeddd
Bump tokio from 1.20.0 to 1.20.1
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.20.0 to 1.20.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.20.0...tokio-1.20.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-01 01:33:36 +00:00
Jiahao XU
3d967a5405
Merge pull request #256 from NobodyXu/optimize-release-build
Use `build-std` feature for release build to reduce binary size
2022-07-31 19:44:13 +10:00
Jiahao XU
a6889c678e
Rm unused rustflags value in ci-scripts/compile-settings.jq
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-31 16:21:31 +10:00
Jiahao XU
9e5ff25be8
Fix release build: Set RUSTFLAGS to link with libgcc statically
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-31 13:40:17 +10:00
Jiahao XU
af3b87df7a
Fix releasae build: Install rust-src for release
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-30 16:20:18 +10:00
Jiahao XU
7a7220b1a2
Fix build: Rm unnecessary env.TOOLCHAIN
Since we build it using +nightly anyway.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-30 16:20:18 +10:00
Jiahao XU
98d8a96a02
Use build-std feature for release build to reduce binary size
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-30 16:20:17 +10:00
Félix Saparelli
ac995798ef
Split features and build args handling in build (#257) 2022-07-30 17:27:49 +12:00
Félix Saparelli
47fd7c14a6
Add -V, clean up errors and help text (#259)
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-30 17:26:52 +12:00
Félix Saparelli
806f69832e
Place import at the top (#258) 2022-07-30 10:07:54 +12:00
Jiahao XU
0c761857be
Merge pull request #252 from NobodyXu/feature/binstall-format
Feature: Create metafile format for cargo-binstall
2022-07-29 00:47:30 +10:00
Jiahao XU
6c6d0fe9c2
Update logging for binstall_v1::append
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 23:15:26 +10:00
Jiahao XU
241b763477
Use CompactString for field CrateVersionSource::name
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 23:14:00 +10:00
Jiahao XU
cb4cffd0ab
Fix confusing comment for field MetaData::other
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 20:33:24 +10:00
Jiahao XU
0d8b865ba4
Update binstall_v1::default_path and fix typo in it
The postfix should be `.json`, not `.toml`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:50:10 +10:00
Jiahao XU
c5db0fefb5
Use Vec for field MetaData::other
by using `tuple_vec_map` to make the `Vec<(CompactString,
serde_json::Value)>` appears as a map.

This is OK because we don't access that part anyway and only add such
field to avoid losing any information when deserialize, modify it and
serialize it again to overwrite existing metafile.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:45:47 +10:00
Jiahao XU
4ad8e4f46e
Add new dep serde-tuple-vec-map v1.0.1
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:43:58 +10:00
Jiahao XU
98556cb2af
Add field MetaData::other for forward compatibility
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:24:14 +10:00
Jiahao XU
00fb2528af
Rm unused import std::fs in binstall_v1
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 18:09:53 +10:00
Jiahao XU
73af5b2824
Test appending behavior of append_to_path
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 18:09:38 +10:00
Jiahao XU
96d90c0376
Fix append_to_path on windows: Use create_if_not_exist
to open the file.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 18:06:39 +10:00
Jiahao XU
3f72e9b81a
Use tempfile::NamedTempFile in unit test of binstall_v1
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 01:45:54 +10:00
Jiahao XU
3cd9866d32
Use unwrap in unit test for binstall_v1
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 01:24:16 +10:00
Jiahao XU
2490c08840
Write to .binstall-crates.toml in entry
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:15:54 +10:00
Jiahao XU
7ccbdb2356
Impl binstall_v1::append
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:15:46 +10:00
Jiahao XU
d796424199
Fix Records::overwrite: Update file len
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:13:41 +10:00
Jiahao XU
c9139fec68
Add unit tests for metafiles::binstall_v1
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:09:52 +10:00
Jiahao XU
5987acbf95
Derive Clone for Source
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:55:16 +10:00
Jiahao XU
671b2fb6f0
Derive Clone for MetaData
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:54:32 +10:00
Jiahao XU
cef4dfee5c
Update doc of binstall_v1::Records::insert
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:32:20 +10:00
Jiahao XU
e6ee493771
Impl binstall_v1::Records::{len, is_empty}
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:31:51 +10:00
Jiahao XU
8ec33c5b6c
Impl get, contains, insert, replace, remove & take
for `binstall_v1::Records`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:30:58 +10:00
Jiahao XU
04f167491a
Impl Borrow<str> for MetaData for Records
so that we can use `&str` to query `BTreeSet<MetaData>`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:25:36 +10:00
Jiahao XU
aba2c87d6d
Impl IntoIterator for &Records
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:22:07 +10:00
Jiahao XU
df3af9727e
Impl new fn Records::overwrite
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:15:21 +10:00
Jiahao XU
1047a782e5
Impl newtype Records and methods load{_from_path}
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 20:36:13 +10:00
Jiahao XU
90203dd467
Impl PartialOrd and Ord for MetaData
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 20:33:40 +10:00
Jiahao XU
4114b6e7c4
Impl PartialEq, Eq and Hash fo MetaData
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 20:19:05 +10:00
Jiahao XU
2f27a5fd93
Refactor: Use binstall_v1::MetaData in mod binstall
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:44:16 +10:00
Jiahao XU
05c0d5fcae
Mark binstall_v1::{Source, SourceType} pub
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:24:01 +10:00
Jiahao XU
1a8fda1f5e
Impl binstall_v1::Source::cratesio_registry
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:23:15 +10:00
Jiahao XU
cc13aa911f
Refactor: Extract helpers::cratesio_url
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:22:45 +10:00
Jiahao XU
5ca1278c22
Add new enum binstall_v1::SourceType
Use it to represent source type instead of using `CompactString`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:18:44 +10:00
Jiahao XU
cbd64b039d
Rename binstall_v1::Item to MetaData
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 18:50:21 +10:00
Jiahao XU
951a0f8b9f
Impl binstall_v1::default_path
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 18:39:22 +10:00
Jiahao XU
ce50186f4a
Impl io::Seek for FileLock
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:52:25 +10:00
Jiahao XU
ebb2d5d0c3
Impl io::Read for FileLock
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:51:20 +10:00
Jiahao XU
c6c5dcd79f
Rename binstall_v1::Entry to Item
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:47:57 +10:00
Jiahao XU
f0b6b7b1af
Impl binstall_v1::append_to_path
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:45:59 +10:00
Jiahao XU
461571075d
Impl binstall_v1::Error
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:45:48 +10:00
Jiahao XU
46c4d6f406
Impl io::Write for helpers::FileLock
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:39:15 +10:00
Jiahao XU
172af54cd8
Impl metafiles::binstall_v1::{Entry, Source}
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:29:10 +10:00
Jiahao XU
93d4dbcd1a
Enable feature serde of dep url
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:12:04 +10:00
Jiahao XU
f7c798352a
Enable feature serde of semver
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 21:57:57 +10:00
Jiahao XU
e990151919
Add new dep serde_json v1.0.82
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 21:31:58 +10:00
Félix Saparelli
9d99bfb81f
Add function and example program detecting WASI runability (#250) 2022-07-26 23:28:17 +12:00
Jiahao XU
900186e57d
Merge pull request #249 from NobodyXu/optimmiz
Optimze updating `CratesToml`
2022-07-26 15:01:39 +10:00
Jiahao XU
2dc246c392
Optimize CratesToml: Use CompactString for bins
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 13:48:04 +10:00
Jiahao XU
834b8bb9c5
Enable feature serde of dep compact_str
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 13:45:53 +10:00
Jiahao XU
928cc65778
Add new dep compact_str v0.5.2
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 13:44:50 +10:00
Jiahao XU
03c8295cd8
Optimize CratesToml: Use Vec instead of BTreeSet
for storing bins.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 13:43:30 +10:00
Jiahao XU
e86239f9be
Merge pull request #247 from NobodyXu/add-more-features
Add more features
2022-07-25 19:56:30 +10:00
Jiahao XU
c52a7b2c3b
Add new feature log_release_max_level_info
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-25 17:57:54 +10:00
Jiahao XU
77396d45bd
Fix release build for win: Enable fancy-no-backtrace
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-25 17:46:59 +10:00
Jiahao XU
daae462e59
Update Cargo.lock
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-25 17:45:34 +10:00
Jiahao XU
aca4528273
Enable fancy-with-backtrace on debug build
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-25 17:45:19 +10:00
Jiahao XU
df77ad9bba
Add new feature fancy-with-backtrace
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-25 17:44:10 +10:00
Jiahao XU
8b8925e949
Add new feature fancy-no-backtrace (enabled by default)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-25 17:43:32 +10:00
Jiahao XU
8183bc2cf3
Merge pull request #245 from NobodyXu/fix/help
Print out help when `crate_names` is empty
2022-07-24 19:19:09 +10:00
Jiahao XU
48f1825c98
Print out help when crate_names is empty
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-24 19:03:55 +10:00
github-actions[bot]
faf4c5e16a
release: v0.11.1 (#243)
Co-authored-by: github-actions <github-actions@github.com>
2022-07-24 20:38:25 +12:00
Félix Saparelli
51b300d29e
Fixes for the CI (#242) 2022-07-24 20:33:56 +12:00
github-actions[bot]
450e29d9cc
release: v0.11.0 (#234)
Co-authored-by: github-actions <github-actions@github.com>
2022-07-24 16:16:27 +12:00
Félix Saparelli
310c07d9c8
Reconfigure CI cache with fallbacks (#240) 2022-07-24 16:10:43 +12:00
Félix Saparelli
ef2752cd42
Stop using actions-rs (#239) 2022-07-24 15:37:41 +12:00
Félix Saparelli
88b9aceb01
Fix the instructions for publish on the release PR (#237) 2022-07-24 14:32:37 +12:00
Félix Saparelli
adef01f3dd
Find best download source out of alternatives (format extension) (#236) 2022-07-24 14:32:23 +12:00
Félix Saparelli
19266a4fb6
Disable zig for now (#238) 2022-07-24 13:41:58 +12:00
Félix Saparelli
6401f2bfa0
Replace toml with toml_edit (#233) 2022-07-24 03:33:55 +12:00
Félix Saparelli
e93f0beb4b
Remove support for .crates2.json (#235) 2022-07-24 03:33:31 +12:00
Jiahao XU
009a3a6778
Merge pull request #231 from NobodyXu/add-more-targets
Try to reenable armv7, aarch64 gnu targets
2022-07-24 00:52:39 +10:00
Félix Saparelli
7603267e33
Update dependencies (#232) 2022-07-24 01:33:34 +12:00
Jiahao XU
db0ae7cde5
Enable zig for all cross targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 23:22:01 +10:00
Jiahao XU
e857a88426
Add back target aarch64-unknown-linux-gnu
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:51:46 +10:00
Jiahao XU
e3a5ca2991
Add back target armv7-unknown-linux-gnueabihf
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:50:57 +10:00
Jiahao XU
00a56dc899
Merge pull request #230 from NobodyXu/speedup-ci
Speedup ci by using liblzma-dev, libzip and libzstd provided by `apt`
2022-07-23 22:48:51 +10:00
Jiahao XU
788bb85b8f
Use zig-cc for cross
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:42:07 +10:00
Jiahao XU
18e0730afb
Disable static and zlib-ng on cross compilation
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:42:06 +10:00
Jiahao XU
b33a606109
Use native-tls for x86_64-pc-windows-msvc on release
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:41 +10:00
Jiahao XU
23139e9db5
Use rustls on debug for aarch64-apple-darwin
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:41 +10:00
Jiahao XU
82aa893306
Disable feature static & zlib-ng on x86_64-apple-darwin
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:41 +10:00
Jiahao XU
291269f50f
Fix "Build debug": Add back use-cross
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:40 +10:00
Jiahao XU
026aefb5a7
Enable rustls for x86_64-unknown-linux-gnu
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:40 +10:00
Jiahao XU
018196de45
Disable default features only when debug_build_args is overriden
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:40 +10:00
Jiahao XU
6e1f930c8e
Disable native-tls for x86_64 linux-gnu and apple-darwin
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:40 +10:00
Jiahao XU
450facd260
Install deps only on x86_64 linux gnu
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:40 +10:00
Jiahao XU
1df00e5ba8
Enable native-tls on non-cross build & pkg-config on x86_64 linux gnu
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:40 +10:00
Jiahao XU
272d049cf6
Fix cond in integration test CI
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:40 +10:00
Jiahao XU
bdef2169a3
Fix typo in integration test CI
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:40 +10:00
Jiahao XU
d3bd11c182
Improve readability of features in Cargo.toml
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:39 +10:00
Jiahao XU
00f60c18b4
Enable feature pkg-config in debug build of integration CI
when not doing cross compilation.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:39 +10:00
Jiahao XU
8e10c0d356
Enable feature native-tls in debug build in integration CI
when not doing cross compilation

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:39 +10:00
Jiahao XU
f7caeea0e6
Enable feature native-tls in unit-tests
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:39 +10:00
Jiahao XU
0150e229aa
Add new feature native-tls
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:39 +10:00
Jiahao XU
162e4838d8
Add new feature rustls (enabled by default)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:39 +10:00
Jiahao XU
6fe2762f11
Add new feature zlib-ng (enabeld by default)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:39 +10:00
Jiahao XU
f2d5d0291b
Always disable feature pkg-config in integration test CI
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:38 +10:00
Jiahao XU
adbc2d4a11
Disable feature pkg-config for cross compilation.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:38 +10:00
Jiahao XU
8a32ab5dd3
Refactor: Extract ci-scripts/install-deps.sh
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:38 +10:00
Jiahao XU
74dd3b6c70
Build debug with feature pkg-config in integration test CI
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:38 +10:00
Jiahao XU
c2349a15cb
Install lzma, bzip & zstd only on debug build in integration test CI
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:38 +10:00
Jiahao XU
3dbec7718d
Fix dep installation in workflow "unit-tests"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:38 +10:00
Jiahao XU
1499f5c201
Install lzma, bzip & zstd in integration test CI
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:38 +10:00
Jiahao XU
b22a55f08f
Install lzma, bzip and zstd lib in workflow unit-tests
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:38 +10:00
Jiahao XU
997d4e4e9d
Run workflow unit-tests with feature pkg-config
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:37 +10:00
Jiahao XU
6c09cb05c9
Add new feature pkg-config: Enable linking with sys packages
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:37 +10:00
Jiahao XU
818f4da577
Add new feature static that is enabled by default
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 22:41:34 +10:00
Félix Saparelli
3889d122a7
Releng improvements (#224) 2022-07-24 00:39:54 +12:00
Jiahao XU
1768392413
Merge pull request #228 from NobodyXu/fix/skip-on-custom-install
Fix updating metafiles: Skip on custom install path
2022-07-23 19:57:58 +10:00
Jiahao XU
5367b366d1
Use home::cargo_home in helpers::cargo_home
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 19:17:47 +10:00
Jiahao XU
ad2d393be7
Add back dep home v0.5.3
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 19:17:26 +10:00
Jiahao XU
b4d2e9b99c
Fix get_install_path where cargo_home succeeds
The returned path must join with `"bin"`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 19:16:23 +10:00
Jiahao XU
49f665d680
Fix confusing comment in helpers::cargo_home
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 19:10:15 +10:00
Jiahao XU
3838219d89
Rm dep home
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 19:09:06 +10:00
Jiahao XU
5bf2b4e45d
Fix helpers::cargo_home: home::cargo_home is buggy
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 19:08:29 +10:00
Jiahao XU
3c09cfb196
Fix ci-scripts/run_tests_unix.sh: unset CARGO_HOME
and `CARGO_INSTALL_ROOT`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 18:51:50 +10:00
Jiahao XU
5ea66574c3
Mod get_install_path to ret Arc<Path> instead of PathBuf
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 18:37:59 +10:00
Jiahao XU
5620810c55
Simplify get_install_path using cargo_home
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 18:36:01 +10:00
Jiahao XU
79476e490b
Fix custom_install_path detection
Installing to `CARGO_INSTALL_ROOT` or the local executable dir should be
considered a custom installation path.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-23 18:33:30 +10:00
Jiahao XU
45ba1de441
Merge pull request #227 from NobodyXu/fix/flock
Fix updating metafiles: Use file lock to fix race condition
2022-07-23 12:23:23 +10:00
Jiahao XU
7bdc720a9a
Fix updating metafiles: Skip on custom install path
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 22:59:02 +10:00
Jiahao XU
6ce48419b6
Fix CratesToml::write_to_{writer, file}
Make them consistent with `Crates2Json::write_to_{writer, file}`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 22:55:44 +10:00
Jiahao XU
0a753f3e4b
Fix Crates2Json::append_to_path: Use file lock
to fix race condition.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 22:50:58 +10:00
Jiahao XU
d432d54c28
Add new fn Crates2Json::write_to_file
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 22:48:54 +10:00
Jiahao XU
1766b92547
Add new fn Crates2Json::write_to_writer
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 22:45:55 +10:00
Jiahao XU
15e2213225
Add new fn Crates2Json::load_from_reader
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 22:44:28 +10:00
Jiahao XU
d9fe7bfaf4
Fix bug in helpers::create_if_not_exist
Returned `File` must be both readable and writable.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 22:40:00 +10:00
Jiahao XU
09d210bf62
Simplify helpers::create_if_not_exist implementation
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 22:32:45 +10:00
Jiahao XU
d7bd96660e
Fix CratesToml::append_to_path: Lock file to avoid race condition
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 22:22:31 +10:00
Jiahao XU
e1b6fb85aa
Add new fn CratesToml::write_to_file
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 22:22:18 +10:00
Jiahao XU
05115641ff
Add new fn helpers::create_if_not_exist
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 22:12:16 +10:00
Jiahao XU
1cfdd3b8bc
Merge pull request #225 from NobodyXu/fix/tempdir
Fix: Create `temp_dir` in `install_path`
2022-07-22 21:55:38 +10:00
Jiahao XU
7311f77f29
Impl new fn CratesToml::write_to_writer
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 20:19:04 +10:00
Jiahao XU
565b404dce
Impl fn CratesToml::load_from_reader
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 20:15:03 +10:00
Jiahao XU
9e45ba1032
Impl new RAII type helpers::flock::FileLock
that locks a file exclusive or shared

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 19:48:37 +10:00
Jiahao XU
751cf47716
Add new dep fs4 v0.6.2
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 19:42:33 +10:00
Jiahao XU
95c30122e9
Rm unused import tempfile::TempDir in main.rs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 19:17:23 +10:00
Jiahao XU
fb35863faa
Create temp_dir in install_path
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 19:17:09 +10:00
Jiahao XU
d21dde4889
Merge pull request #226 from NobodyXu/fix/metafile-update
Fix race condition when updating metafile
2022-07-22 19:15:36 +10:00
Jiahao XU
92f4d0af95
Fix metafile updating: Update them in entry only
to avoid race condition.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 17:58:29 +10:00
Jiahao XU
488e7b8492
Update CratesToml::append to accept iter
intead of one single pair of value.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 17:57:51 +10:00
Jiahao XU
739b3ee247
Update Crates2Json::append to accept iter
instead of one single pair of value.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 17:57:25 +10:00
Jiahao XU
6964eee5d1
Merge pull request #223 from NobodyXu/fix/join-err
Fix: join err handling, unify it using `BinstallError`
2022-07-22 11:29:21 +10:00
Jiahao XU
adbc587f3b
Merge pull request #222 from NobodyXu/refactor
Refactor: Make appending to metafiles easier and fix their err handling
2022-07-22 11:29:12 +10:00
Jiahao XU
4716389a52
Merge pull request #221 from NobodyXu/optimize
Minor Optimization
2022-07-22 11:27:13 +10:00
Jiahao XU
32b98f0c5a
Fix Deserialize for CrateVersionSource
Use `Cow::<'_, str>::deserialize` to ensure that it would still work
even if it contains escaped characters.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 01:43:40 +10:00
Jiahao XU
a3fcc298ab
Avoid CrateVersionSource::clone for insertion in metafiles
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 01:38:44 +10:00
Jiahao XU
de9404feda
Optimize Crates2Json: Use String as key
to avoid cost of deserializing (`CrateVersionSource::from_str`).

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 01:37:27 +10:00
Jiahao XU
96aaca1cc6
Optimize CratesToml: Use String as key
to avoid cost of deserializing (`CrateVersionSource::from_str`).

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 01:36:22 +10:00
Jiahao XU
9d9a31bef3
Optimize Deserialize impl for CrateVersionSource
Use `<&str>::deserialize` instead of `String::deserialize` to avoid
intermediate `String`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-22 01:23:58 +10:00
Jiahao XU
c2ce265afa
Optimize Crates2Json::write_to_path: Use to_writer
which avoids allocating a `Vec<u8>` just to hold serialized data.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 22:18:08 +10:00
Jiahao XU
d7ae1f242b
Optimize Crates2Json::load_from_path: Use from_reader
which avoids reading the entire file into string at once.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 22:14:20 +10:00
Jiahao XU
adc0a22a50
Rm unused variant MainExit::JoinErr
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 20:44:13 +10:00
Jiahao XU
d39bc0acab
Construct BinstallError from JoinError in main
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 20:43:47 +10:00
Jiahao XU
6e5ecc46cf
Construct BinstallError from JoinError in await_task
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 20:41:16 +10:00
Jiahao XU
46cf20a3f7
Add new variant BinstallError::TaskJoinError
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 20:40:31 +10:00
Jiahao XU
fb3e35624b
Fix err handling in Crates2Json::append_to_path
Only uses `Self::default()` if the file is not found.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 19:59:36 +10:00
Jiahao XU
1e725a9ffe
Refactor: Extract Crates2Json::append{_to_path}
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 19:58:23 +10:00
Jiahao XU
0157a594e6
Fix err handling in CratesToml::append_to_path
Make it more robust to `io::Error`: Only create a `Self::default()` if
fails to open the file.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 19:54:45 +10:00
Jiahao XU
31d9716d28
Refactor: Extract CratesToml::append{_to_path}
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 19:50:23 +10:00
Jiahao XU
4f0f01b75c
Fix typo in impl Version for crates_io_api::Version
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 19:20:21 +10:00
Jiahao XU
e308b275d5
Optimize and generalize find_version
- Rm the process of collecting into `BTreeMap` in `find_version`.
 - Accept any type that implements trait `Version`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 19:19:50 +10:00
Jiahao XU
b2d09e2b13
Rm unused derive(Clone) for DesiredTargets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 15:07:09 +10:00
Jiahao XU
eda7b9445a
Rm unnecessary Arc inside DesiredTargetsInner
Since `DesiredTargets` is now stored in `binstall::Options`, which
itself is wrapped in an `Arc`, `DesiredTargetsInner::Initialized` no
longer needs an `Arc` for O(1) `clone`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 15:06:00 +10:00
Jiahao XU
6a95bb07e0
Add field desired_targets to binstall::Options
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 15:05:12 +10:00
Jiahao XU
aa88dce215
Add field cli_overrides to binstall::Options
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 15:00:01 +10:00
Jiahao XU
f09004b5b7
Optimize: Share crates_io_api::AsyncClient
So that the connection pool and the rate limit will be shared.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 14:50:51 +10:00
Jiahao XU
21eac33e1f
Optimize: Create new fn helpers::cargo_home
that caches return value of `home::cargo_home`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 13:13:07 +10:00
Jiahao XU
305a4e4c30
Improve err msg in MultiFetcher::first_available
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 13:07:20 +10:00
Jiahao XU
dc8d8ccd88
Optimize MultiFetcher: Start checking ASAP
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 13:06:34 +10:00
Jiahao XU
6180e9ec3e
Add comment in fn resolve
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 13:00:58 +10:00
Jiahao XU
c418c2dbbe
Optimize arg parsing: Avoid O(n) Vec::remove
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-21 12:44:54 +10:00
Jiahao XU
ef72f851f7
Merge pull request #220 from NobodyXu/fix
Forbid --manifest-path to used with batch installation
2022-07-20 19:39:38 +10:00
Jiahao XU
cfe7703af9
Forbid --manifest-path to used with batch installation
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 19:11:02 +10:00
Jiahao XU
08190ac179
Add ManifestPathConflictedWithBatchInstallation
to error `BinstallError`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 19:09:59 +10:00
Jiahao XU
bcb97803c3
Merge pull request #219 from NobodyXu/dep
Enable feature "static" of dep xz2 & Disable all features of dep zstd
2022-07-20 18:57:35 +10:00
Jiahao XU
f7af4efa22
Disable feature flag "thin" of dep zstd
attempt to fix the CI

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 18:26:45 +10:00
Jiahao XU
f59d081733
Only enable feature "thin" of dep zstd
Disable "bindgen" that creates a bindgen at build time, which takes
quite some time and pulls in dep "bindgen" at bulid time.

Also disable feature "zstdmt" as we don't need multithreading here.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 18:18:39 +10:00
Jiahao XU
1e81babea8
Enable feature "static" of dep xz2
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 18:14:17 +10:00
Jiahao XU
15e0b22e50
Merge pull request #217 from NobodyXu/refactor
Refactor: Extract new mod `binstall`
2022-07-20 18:12:26 +10:00
Jiahao XU
9d6ed81d74
Merge pull request #218 from NobodyXu/optimize
Use `opt-level = "z"` for release
2022-07-20 18:11:02 +10:00
Jiahao XU
6324f9a7ca
Use opt-level = "z" for release
On M1 MacOS Darwin 21.5, this produces binary that is 0.3M smaller while
taking 10s less to build.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 18:00:22 +10:00
Jiahao XU
3981400ebb
Create new type LazyJobserverClient
and use it to replace `jobserver::Client`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 17:54:17 +10:00
Jiahao XU
a1d7a7c117
Refactor: Extract new mod jobserver_client.rs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 17:37:23 +10:00
Jiahao XU
2490cd5a84
Refactor: Extract new mod binstall/install.rs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 17:30:34 +10:00
Jiahao XU
5e35604012
Refactor: Extract new mod binstall/resolve.rs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 17:28:53 +10:00
Jiahao XU
921774b8f9
Refactor: Extract new mod binstall
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 17:26:24 +10:00
Jiahao XU
3a30e870b0
Merge pull request #216 from NobodyXu/feature/batch-installation
Feature: Implement batch installation
2022-07-20 17:18:35 +10:00
Jiahao XU
3b82e9e375
Rm unnecessary clone in install_from_package
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 17:04:26 +10:00
Jiahao XU
1eedae1ee2
Rm unused param temp_dir from install_from_package
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 16:59:23 +10:00
Jiahao XU
1ebd4bdb75
Refactor: Reduce params of install_from_package
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 16:58:12 +10:00
Jiahao XU
5bdffd9178
Refactor: Impl Source::cratesio_registry
Makes initializing `metafiles::CrateVersionSource` more readable and
improves performance since the parsing is now cached.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 16:48:34 +10:00
Jiahao XU
3961dbb84a
Add new dep once_cell v1.13.0
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 16:43:02 +10:00
Jiahao XU
67ca36a0b5
Fix jobserver_client: Create it as early as possible
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-19 12:15:00 +10:00
Jiahao XU
2bf7640729
Optimize: Avoid double spawn if no_confirm
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-19 12:06:16 +10:00
Jiahao XU
de7ecad32c
Optimize: Avoid creation of Arc<str> for target
in `entry`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-19 12:02:09 +10:00
Jiahao XU
758dab7d4f
Optimize DesiredTargets: Avoid mem alloc on clone
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-19 11:59:10 +10:00
Jiahao XU
d58f340a45
Test batch installtion in run_tests_unix.sh
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-19 00:45:15 +10:00
Jiahao XU
b026462018
Refactor: Simplify struct Resolution
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-19 00:43:17 +10:00
Jiahao XU
c6281d8ea0
Fix opts.no_cleanup behavior
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-19 00:39:27 +10:00
Jiahao XU
b223990bb1
Simplify helpers::await_task API
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-19 00:35:48 +10:00
Jiahao XU
072253ebae
Improve comment in create_jobserver_client
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-19 00:32:56 +10:00
Jiahao XU
fb0a6a5514
Use jobserver to limit parallism of cargo-install
Since we execute multiple `cargo-install` concurrently, we must use
jobserver to limit the parallism so that they won't spawn too much
processes/threads to overload the system.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 21:12:58 +10:00
Jiahao XU
c67c59b3ca
Impl new fn helpers::create_jobserver_client
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 21:04:36 +10:00
Jiahao XU
8cc085b1b6
Add new dep jobserver v0.1.24
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 20:46:44 +10:00
Jiahao XU
9552e0e8ed
Add comment to entry to improve readbility
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 17:31:29 +10:00
Jiahao XU
79ec122647
Refactor entry: Avoid Arc::clone
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 17:26:16 +10:00
Jiahao XU
119192f8ee
Refactor main.rs: Print resolution in resolve
This simplified `entry`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 17:21:35 +10:00
Jiahao XU
bcb46cd736
Optimize main.rs: Avoid frequent Box::clone
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 17:17:56 +10:00
Jiahao XU
c66d8154eb
Print out resolution in optimized path
where confirmation isn't required.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 17:13:06 +10:00
Jiahao XU
f0fb7da99b
Refactor main.rs: Extract fn Resolution::print
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 17:11:27 +10:00
Jiahao XU
90059c11cf
Optimize: Launch install immediately if confirmation is not required
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 17:09:29 +10:00
Jiahao XU
8ca85382af
Refactor: Avoid repeated heap alloc of temp_dir
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 17:00:18 +10:00
Jiahao XU
d514219ee4
Refactor main.rs: Extract new fn install
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 16:58:04 +10:00
Jiahao XU
40a872dbe3
Avoid Box::clone for targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 16:54:45 +10:00
Jiahao XU
7f11b74f5e
Support new feature batch installation!
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 16:46:51 +10:00
Jiahao XU
5e7aab7373
Impl helpers::await_task: Handle JoinError
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 16:46:21 +10:00
Jiahao XU
730f7d6c15
Refactor main.rs: Simplify install_from_source
Rm arg `opts`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 16:21:03 +10:00
Jiahao XU
d6db552db1
Refactor main.rs: Extract new fn resolve
prepare for the new feature batch installation.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 16:16:50 +10:00
Jiahao XU
409f31f0bf
derive(Clone) for CrateName
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 16:07:47 +10:00
Jiahao XU
9e1f873bb5
derive(Clone) for DesiredTargets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-18 16:05:37 +10:00
Jiahao XU
6de30afd01
Merge pull request #214 from ryankurte/dependabot/cargo/serde-1.0.139
Bump serde from 1.0.138 to 1.0.139
2022-07-18 15:07:48 +10:00
Jiahao XU
83e90fe229
Merge pull request #215 from ryankurte/dependabot/cargo/clap-3.2.12
Bump clap from 3.2.8 to 3.2.12
2022-07-18 15:06:43 +10:00
Jiahao XU
2065f2e63c
Merge pull request #213 from ryankurte/dependabot/cargo/tokio-1.20.0
Bump tokio from 1.19.2 to 1.20.0
2022-07-18 15:05:58 +10:00
dependabot[bot]
ee855264f7
Bump clap from 3.2.8 to 3.2.12
Bumps [clap](https://github.com/clap-rs/clap) from 3.2.8 to 3.2.12.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.2.8...v3.2.12)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-18 01:30:33 +00:00
dependabot[bot]
d9b30705dc
Bump serde from 1.0.138 to 1.0.139
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.138 to 1.0.139.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.138...v1.0.139)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-18 01:30:24 +00:00
dependabot[bot]
4ae7f31de4
Bump tokio from 1.19.2 to 1.20.0
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.19.2 to 1.20.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.19.2...tokio-1.20.0)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-18 01:30:13 +00:00
Jiahao XU
66ef2277e0
Merge pull request #212 from NobodyXu/speedup-ci
Speedup CI: Build cargo-binstall in debug mode for PR
2022-07-14 22:29:47 +10:00
Jiahao XU
9f914a3c84
Fix integration test: Copy from debug for PR
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-14 21:41:32 +10:00
Jiahao XU
2936f2c3f1
Build cargo-binstall in debug mode for PR
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-14 21:32:59 +10:00
Jiahao XU
a672f00575
Merge pull request #210 from NobodyXu/feature/crate-version
Feature: Support specifing versions via `crate_name@req`
2022-07-12 19:09:50 +10:00
Jiahao XU
aecc474f29
Rm unused BinstallError::VersionWarning
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-12 18:34:20 +10:00
Jiahao XU
c87941211c
Treat 1.2.3 as =1.2.3 to match cargo-install
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-12 18:33:31 +10:00
Jiahao XU
e2207f7b59
Add diagnostic(help) to DuplicateVersionReq
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-12 17:12:01 +10:00
Jiahao XU
ff0bd4d948
Support specifing ver via crate_name@version
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-12 17:08:54 +10:00
Jiahao XU
41961ce218
Add new variant BinstallError::DuplicateVersionReq
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-12 17:03:12 +10:00
Jiahao XU
38c8bc8cf2
Impl new type helpes::CrateName
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-12 16:47:44 +10:00
Jiahao XU
3b1b59c097
Merge pull request #209 from NobodyXu/refactor/confirm
Refactor: Confirm only once and move all confirmations into `entry`
2022-07-12 12:43:08 +10:00
Jiahao XU
4a9e04967c
Refactor: Mv confirmation from install_from_source to entry
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-11 22:21:11 +10:00
Jiahao XU
8bbc6d0171
Rm unused lint allow(clippy::too_many_arguments)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-11 22:19:21 +10:00
Jiahao XU
2d0c4a8c4e
Refactor: Extract fn collect_bin_files
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-11 22:18:45 +10:00
Jiahao XU
7a85cae859
Refactor: Mv confirm into entry and remove unncessary confirm
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-11 21:49:28 +10:00
Jiahao XU
e4b92a3bb7
Merge pull request #208 from ryankurte/dependabot/cargo/miette-5.1.1
Bump miette from 5.1.0 to 5.1.1
2022-07-11 12:44:36 +10:00
dependabot[bot]
d1fe2acfdd
Bump miette from 5.1.0 to 5.1.1
Bumps [miette](https://github.com/zkat/miette) from 5.1.0 to 5.1.1.
- [Release notes](https://github.com/zkat/miette/releases)
- [Changelog](https://github.com/zkat/miette/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zkat/miette/compare/miette-derive-v5.1.0...miette-derive-v5.1.1)

---
updated-dependencies:
- dependency-name: miette
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-11 01:44:00 +00:00
Jiahao XU
114c199e98
Merge pull request #207 from NobodyXu/refactor
Refactor: Rm global variable `helpers::Client`
2022-07-10 18:23:40 +10:00
Jiahao XU
aa466750b7
Rm unused dep once_cell
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-10 18:08:07 +10:00
Jiahao XU
fa63dbe5cf
Refactor: Rm global var helpers::CLIENT
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-10 18:07:07 +10:00
Félix Saparelli
3c06c45792
Merge pull request #206 from passcod/mimalloc-on-windows
Add mimalloc on feature flag
2022-07-07 00:14:31 +12:00
Félix Saparelli
63afa5b791
Just hide mimalloc behind a feature, available for all platforms 2022-07-06 23:33:51 +12:00
Félix Saparelli
e66dc60867
Also use mimalloc on musl 2022-07-06 23:31:24 +12:00
Félix Saparelli
57c6125fc1
Update Cargo.toml
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-05 23:56:30 +12:00
Félix Saparelli
fe724585ae
Use mimalloc on windows 2022-07-05 23:10:57 +12:00
Félix Saparelli
3348d3d7a2
(cargo-release) version 0.10.0 2022-07-05 22:46:43 +12:00
Félix Saparelli
9294b4e4bc
Merge pull request #198 from NobodyXu/optimize/reuse-client 2022-07-05 22:32:49 +12:00
Félix Saparelli
6605c00552
Merge pull request #202 from ryankurte/dependabot/cargo/serde-1.0.138 2022-07-05 22:31:44 +12:00
dependabot[bot]
efe04be5a5
Bump serde from 1.0.137 to 1.0.138
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.137 to 1.0.138.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.137...v1.0.138)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-05 10:29:38 +00:00
Félix Saparelli
9f48e47179
Merge pull request #204 from ryankurte/dependabot/cargo/semver-1.0.12 2022-07-05 22:27:42 +12:00
Félix Saparelli
6a127bab86
Don’t double up unit tests on PRs 2022-07-05 22:18:50 +12:00
Félix Saparelli
38ce26d0c4
Remame workflows for clarity 2022-07-05 22:17:10 +12:00
Jiahao XU
5ad572fa42
Rename new_reqwest_client > get_reqwest_client
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-05 19:57:56 +10:00
Jiahao XU
6582eefd25
Refactor: Replace REQWESTCONFIG with initialize_reqwest_client
so that we don't need two `OnceCell`s.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-05 19:57:54 +10:00
Jiahao XU
50b436100e
Reuse Client everywhere instead of recreate one
which pools the connection to the same site (github.com).

This commit also sets `USER_AGENT` so that quickinstall
can reuse it.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-05 19:57:14 +10:00
Félix Saparelli
9b26fea231
Merge pull request #203 from ryankurte/dependabot/cargo/clap-3.2.8 2022-07-05 21:54:14 +12:00
dependabot[bot]
a4663f46ee
Bump semver from 1.0.10 to 1.0.12
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.10 to 1.0.12.
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.10...1.0.12)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-05 09:53:24 +00:00
Félix Saparelli
7518993212
Merge pull request #195 from NobodyXu/feature/atomic-install 2022-07-05 21:52:06 +12:00
Félix Saparelli
f056978858
Merge pull request #199 from NobodyXu/fix-and-improve-windows-target-detection 2022-07-05 21:49:35 +12:00
Félix Saparelli
408c427ab4
Merge pull request #200 from NobodyXu/turn-down-opt-level-in-ci 2022-07-05 21:47:55 +12:00
Félix Saparelli
2eed701d3f
Merge pull request #205 from passcod/write-to-meta-files 2022-07-05 21:47:31 +12:00
Félix Saparelli
68ba9b06f5
Create meta files if not present 2022-07-05 21:46:58 +12:00
Félix Saparelli
17cf6f5dc5
Write to .crates2.json 2022-07-05 21:17:59 +12:00
Félix Saparelli
1c2d005fd4
Write to .crates.toml 2022-07-04 23:53:47 +12:00
dependabot[bot]
d8a3375bc3
Bump clap from 3.2.6 to 3.2.8
Bumps [clap](https://github.com/clap-rs/clap) from 3.2.6 to 3.2.8.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.2.6...v3.2.8)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-04 01:26:34 +00:00
Jiahao XU
267307fa28
Set opt-level for release to s
O3 mostly enables float optimization, more aggressive loop unrolling and
function inline.

O2 is probably OK, but I want to reduce the binary size a bit by using
opt level "s".

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-03 18:12:37 +10:00
Jiahao XU
1ec1f972b7
Fix copy-paste error in detect_targets_windows
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-01 19:46:30 +10:00
Jiahao XU
8e58398f57
Fix windows target detection for abi gnullvm
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-01 19:34:52 +10:00
Jiahao XU
ec6f81935c
Refactor: Extract detect_alternative_targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-01 19:30:31 +10:00
Félix Saparelli
caf6f3930b
(cargo-release) version 0.9.2 2022-06-29 02:05:27 +12:00
Félix Saparelli
43e4e17e84
Fix test 2022-06-29 01:48:59 +12:00
Félix Saparelli
72148ec572
Update deps 2022-06-28 03:19:05 +12:00
Félix Saparelli
66a14d0c7c
Polish up new secure options 2022-06-28 03:19:04 +12:00
Félix Saparelli
4bc16863e0
Format -> formats 2022-06-28 03:19:04 +12:00
Félix Saparelli
401fa8772c
Merge pull request #194 from NobodyXu/fix/blocking 2022-06-28 03:14:27 +12:00
Félix Saparelli
9d70e33337
Merge pull request #193 from NobodyXu/fix/macos-target-detection
Fix macos detection: Use built-time `TARGET` as fallback
2022-06-28 03:10:18 +12:00
Jiahao XU
14c606d72b
Simplify BinFile::link_dest
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 23:27:16 +10:00
Jiahao XU
43238e39a3
Use atomic_symlink_file in install_link
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 23:26:46 +10:00
Jiahao XU
77ce57815c
Impl new fn helpers::symlink_file
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 23:26:30 +10:00
Jiahao XU
e9c86dfad4
Rm set_permissions in BinFile::install_bin
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 22:51:50 +10:00
Jiahao XU
d4105585db
Fix atomic_install: Copy permissions of src
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 22:50:30 +10:00
Jiahao XU
97bfeb7bd8
Use atomic_install in install_bin
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 21:27:44 +10:00
Jiahao XU
7616546a61
Impl new fn atomic_install for atommically installing a file
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 21:27:15 +10:00
Jiahao XU
e18ac6e117
Run Manifest parsing in block_in_place mode
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 19:55:09 +10:00
Jiahao XU
60caa9ee17
Run load_manifest_path in block_in_place mode
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 19:50:25 +10:00
Jiahao XU
a35db557ea
Run "Install binaries" step in block_in_place mode
Since they execute a lot of blocking fs operations.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 19:48:03 +10:00
Félix Saparelli
cc8144e06d
Merge pull request #192 from NobodyXu/optimize/parallelize-target-detection
Optimize/parallelize target detection
2022-06-23 21:41:15 +12:00
Jiahao XU
536f3b2c6f
Fix macos detection: Use super::TARGET as fallback
When `guess_host_triple` failed to detect the target.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 19:39:36 +10:00
Félix Saparelli
ee4cbaa3d5
Merge pull request #191 from NobodyXu/feature/target-detection-windows
feature:  Detect `*-pc-windows-gnu` targets in `targets.rs`
2022-06-23 21:34:37 +12:00
Félix Saparelli
f25f6d2ce7
Merge pull request #189 from NobodyXu/feature/https-only-mode
Feature: Support https only mode and min tls version
2022-06-23 21:23:08 +12:00
Jiahao XU
68d111f946
Use get_desired_targets in entry
instead of `detect_targets`, so that if `opts.targets` is
`None`, the future returned by `detect_targets` can be run
in parallel by using `tokio::spawn` with other async code
in `entry`, such as `fetch_crate_cratesio`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 14:47:59 +10:00
Jiahao XU
be4b3ead97
Add new fn get_desired_targets & newtype DesiredTargets
so that if `opts.targets` is `None`, the future returned by
`detect_targets` can be run in parallel by using `tokio::spawn` with
other async code in `entry`, such as `fetch_crate_cratesio`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 14:46:53 +10:00
Jiahao XU
8bc0f11569
Detect *-pc-windows-gnu targets in targets
And add fallback `*-pc-windows-msvc` to the returned targets.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:59:53 +10:00
Jiahao XU
c36f1fe08a
Add dep guess_host_triple v0.1.3 for windows
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:43:13 +10:00
Jiahao XU
691bc18dd0
Set min TLS ver to 1.2 for https only mode
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:03:50 +10:00
Jiahao XU
9b62ebdae1
Fix https only mode: It should not be http2 only
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:01:22 +10:00
Jiahao XU
b03ec6fb93
Fix run_tests_unix.sh: Add --no-confirm
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:01:22 +10:00
Jiahao XU
423fb0e373
Test https-only-mode & min-tls-ver in run_tests_unix.sh
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:01:22 +10:00
Jiahao XU
087d544331
Initialize REQWESTGLOBALCONFIG in main::entry
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:01:22 +10:00
Jiahao XU
a3ab3ec502
Add new static var REQWESTGLOBALCONFIG
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:01:22 +10:00
Jiahao XU
0423f54b53
Add new dep once_cell v1.12.0
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:01:21 +10:00
Jiahao XU
64f468acd6
Add new opt https_only_mode & min_tls_version
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:00:52 +10:00
Jiahao XU
eb7d460a9a
Add new enum TLSVersion which impl ArgEnum
and can be converted to `reqwest::tls::Version`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:00:52 +10:00
Jiahao XU
8e92db3dc6
Refactor: Extract new_reqwest_client(_builder)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 13:00:52 +10:00
Félix Saparelli
a747edffd5
Merge pull request #183 from ryankurte/dependabot/cargo/semver-1.0.10 2022-06-23 10:36:13 +12:00
Félix Saparelli
a90d1328ea
Merge pull request #190 from ryankurte/dependabot/cargo/clap-3.2.6 2022-06-23 07:11:56 +12:00
dependabot[bot]
ba114fceae
Bump semver from 1.0.9 to 1.0.10
Bumps [semver](https://github.com/dtolnay/semver) from 1.0.9 to 1.0.10.
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.9...1.0.10)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-22 18:46:13 +00:00
dependabot[bot]
d8ad005800
Bump clap from 3.1.18 to 3.2.6
Bumps [clap](https://github.com/clap-rs/clap) from 3.1.18 to 3.2.6.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v3.1.18...v3.2.6)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-22 18:42:49 +00:00
Félix Saparelli
43511690f4
Add tbz2 to readme 2022-06-23 06:37:43 +12:00
Félix Saparelli
0998439312
Merge pull request #181 from qryxip/add-pkgfmt-tbz2 2022-06-23 06:37:02 +12:00
Félix Saparelli
ae9e0bdd77
Merge branch 'main' into add-pkgfmt-tbz2 2022-06-23 06:36:43 +12:00
Félix Saparelli
7baadebba3
Merge pull request #182 from ryankurte/dependabot/cargo/strum-0.24.1 2022-06-23 06:35:03 +12:00
Félix Saparelli
c042ccfaa5
Merge pull request #187 from ryankurte/dependabot/cargo/reqwest-0.11.11
Bump reqwest from 0.11.10 to 0.11.11
2022-06-23 06:20:21 +12:00
Félix Saparelli
ad091f7976
Merge pull request #188 from NobodyXu/remove-unused-dep
Rm unused dep `cargo_metadata`
2022-06-23 06:15:46 +12:00
Ryo Yamashita
27c0a379d4
Enable bzip2/static
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-23 02:38:04 +09:00
Ryo Yamashita
1b9f8c0ffc
Add PkgFmt::Tbz2 2022-06-23 02:37:55 +09:00
Jiahao XU
127d7045d5
Rm unused dep cargo_metadata
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-22 15:12:01 +10:00
Félix Saparelli
3b5ea35182
Merge pull request #180 from NobodyXu/refactor-and-optimize/AsyncExtracter 2022-06-22 15:25:39 +12:00
Jiahao XU
2f38925ee4
Refactor From<io::Error> for BinstallError
Avoid one `expect`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-21 14:10:27 +10:00
Jiahao XU
c5a2a89361
Rm the duplicate debug! in main.rs:214
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-21 13:52:27 +10:00
Jiahao XU
74a6e137be
Refactor: Mv debug! into create_request
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-21 13:47:00 +10:00
Jiahao XU
ad41756daa
Rename fmt.rs to format.rs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-21 13:45:56 +10:00
Jiahao XU
23bad39ba8
Refactor:Mv mod visitor vfs under crates_io
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-21 13:44:12 +10:00
Jiahao XU
b6f15f2e5e
Refactor: Extract fetch_crate_cratesio out into mod
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-21 13:42:39 +10:00
Jiahao XU
c916814e7e
Refactor: Extract find_version into mod
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-21 13:40:36 +10:00
Jiahao XU
5d79af545b
Add doc for Vfs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-21 13:38:24 +10:00
dependabot[bot]
1c9ec8d25c
Bump reqwest from 0.11.10 to 0.11.11
Bumps [reqwest](https://github.com/seanmonstar/reqwest) from 0.11.10 to 0.11.11.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.11.10...v0.11.11)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-20 01:25:13 +00:00
Jiahao XU
784a24577b
Refactor: Rm extract_impl
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-18 18:37:50 +10:00
Jiahao XU
db22d7d041
Fix codestyle in async_extracter
Use consistent codestyle for specifing trait bounds.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-18 18:35:01 +10:00
Jiahao XU
53bf76104b
Revert refactor: Put fetch_crate_cratesio back to drivers
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-18 18:27:08 +10:00
Jiahao XU
b14b71135e
Revert refactor: Put find_version back to drivers
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-18 18:25:50 +10:00
Jiahao XU
a5879e3d65
Rm unnecessary to_owned call in extract_*
It was called before because `spawn_blocking` requires that, but we now
switches to `block_in_place` which no longer needs this.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-18 18:24:01 +10:00
Jiahao XU
9de8a4841f
Update doc of mod async_extracter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-18 18:12:48 +10:00
Jiahao XU
b152358175
Rm unused trait bound in extract_impl
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-18 18:12:13 +10:00
Jiahao XU
621a641529
Rm unused items in mod helpers
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-18 18:10:22 +10:00
Jiahao XU
c15d99c6f0
Run downloader & extracter on the same thread
This have the following advantage:
 - Remove the mpsc channel, which:
    - Remove synchronization required for mpsc.
    - Remove the internal buffering of the mpsc channel, which avoid potentially OOM situation.
 - Improve data locality since it no longer needs to be sent over thread.
 - It uses `block_in_place` to avoid creating an additional blocking
   thread.

The disadvantages would be that the downloader can no longer be run in parallel to the extracter.

If the bottleneck is the decompressor, then the downloader should also pause and wait
for the decompressor to consume the data.

But if the bottleneck is the network, then that might be an issue.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-18 18:07:46 +10:00
Jiahao XU
aba1ba7b6d
Manually impl From<io::Error> for BinstallError
so that if the `io::Error` wraps a `BinstallError`, we would just unwrap
it and return the inner `BinstallError`.

Otherwise, just wrap the `io::Error` in a `BinstallError`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-18 18:05:15 +10:00
Jiahao XU
1161a60968
Simplify create_tar_decoder: Ret io::Result
instead of `Result<Archive, BinstallError>`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-18 17:56:17 +10:00
Jiahao XU
0480e99460
Impl newtype StreamReadable
It wraps a `Stream<Item = Result<Bytes, E>>` and implements `Read` and
`BufRead` on it so that it can be used on sync context.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-18 17:29:50 +10:00
Jiahao XU
39ab334da5
Add a simple optimization to normalize_path
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-15 17:52:49 +10:00
Jiahao XU
30b9a78520
Optimize normalize_path: Avoid copy if possible
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-15 17:45:50 +10:00
Jiahao XU
282805c3ac
Add reference to the src of path_ext
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-15 17:23:00 +10:00
Jiahao XU
9eb1128f9f
Rm unused DummyVisitor in extract_tar_based_stream
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-13 19:32:55 +10:00
dependabot[bot]
6578b67225
Bump strum from 0.24.0 to 0.24.1
Bumps [strum](https://github.com/Peternator7/strum) from 0.24.0 to 0.24.1.
- [Release notes](https://github.com/Peternator7/strum/releases)
- [Changelog](https://github.com/Peternator7/strum/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Peternator7/strum/commits)

---
updated-dependencies:
- dependency-name: strum
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-13 01:29:47 +00:00
Jiahao XU
2091345ce0
Refactor: Mv TarEntriesVisitor to mod async_extracter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-13 01:14:22 +10:00
Jiahao XU
467f7f6834
Refactor: Call create_tar_decoder directly
in `extract_tar_based_stream*`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-13 01:12:21 +10:00
Jiahao XU
9584c8d35e
Refactor: Extract create_tar_decoder
from `extract_compressed_from_readable`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-13 01:06:12 +10:00
Jiahao XU
8ef1e56fcc
Take Receiver by value in ReadableRx::new
It would remove the lifetime and make reasoning the code much easier.

It would also unblock the next commit I am going to make.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-13 01:05:07 +10:00
Jiahao XU
b4e61161f2
Derive strum_macros::Display on TarBasedFmt
sp that it can be printed.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-13 00:53:08 +10:00
Jiahao XU
c9b0c0c59c
Add .DS_Store to .gitignore
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 22:38:34 +10:00
Jiahao XU
94c77c32b4
Make debug! message more consistent
in `extract_compressed_from_readable`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 22:38:00 +10:00
Jiahao XU
225cf74cd9
Refactor: Ret impl Stream in create_request
Since both `download*` function takes a `impl Stream` and the
`Response::bytes_stream` takes `Response` by value, thus there is no
lifetime issue and we can return `impl Stream` instead of `Response`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 20:01:43 +10:00
Jiahao XU
baf9784b82
Update doc of mod async_extracter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 19:52:03 +10:00
Jiahao XU
3a1038c80b
Optimize binary size/compilation time
by reducing generics monomorphization using `Box<dyn Trait>`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 19:44:59 +10:00
Jiahao XU
bd39ce754f
Fix Vfs::add_path: Use to_string_lossy
instead of `to_str` to be compatible with the implementation in
`cargo_toml`:

https://docs.rs/cargo_toml/0.11.5/src/cargo_toml/afs.rs.html#24

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 19:23:03 +10:00
Jiahao XU
b88e384f95
Fix Vfs::add_path: Add insert filename instead of path
into the `HashSet<Box<Path>>`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 19:17:06 +10:00
Jiahao XU
b879c15c70
Update doc of PathExt::normalize_path
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:22:20 +10:00
Jiahao XU
989be49cb0
Fix confusing doc of Vfs::add_path
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:13:48 +10:00
Jiahao XU
24b1941c1a
Simplify fetch_crate_cratesio: Rm unused param temp_dir
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:09:17 +10:00
Jiahao XU
e39549f470
Improve debug! logging in download_and_extract
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:08:22 +10:00
Jiahao XU
f25306ff97
Simplify download_tar_based_and_visit: Rm unused param
`path`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:07:29 +10:00
Jiahao XU
e376b71cf4
Simplify extract_tar_based_stream_and_visit
Rm unused param `path` and the unnecessary
`fs::create_dir_all` since the tar will not be extracted to disk.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:05:35 +10:00
Jiahao XU
17fcac7e63
Refactor: Simplify untar with new enum Op
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 17:03:39 +10:00
Jiahao XU
b2c34137cc
Mark extract_compressed_from_readable & unzip to be pub(super)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:56:41 +10:00
Jiahao XU
f82890cba3
Rm download_and_extract_with_filter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:42:32 +10:00
Jiahao XU
e68eea35fe
Mark type ManifestVisitor as pub(super)
Since mod `cretesio` is the only one need to have access to it.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:40:51 +10:00
Jiahao XU
5bb5d12949
Optimize fetch_crate_cratesio using ManifestVisitor
and `download_tar_based_and_visit`.

By using these two items, we avoid any I/O altogether.
Everything happens in memory, thus there will be no i/o related errors
or cost.

This commit does not regress anything because
`helpers::load_manifest_path` calls `Manifest::from_path_with_metadata`,
which read in the whole `Cargo.toml` file at once.

Thus this commit would not cause any OOM when the the original code
would not.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:37:53 +10:00
Jiahao XU
f3d3c488e3
Impl new type `ManifestVisitor
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:32:36 +10:00
Jiahao XU
44d43113f4
Forward impl AbstractFilesystem for &Vfs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 16:08:41 +10:00
Jiahao XU
3c30722a06
Impl new type Vfs which impl AbstractFilesystem
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 01:57:34 +10:00
Jiahao XU
c6687edf48
Fix visbility of PathExt: Mark it as pub
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 01:54:15 +10:00
Jiahao XU
cb2be5a882
Add new trait PathExt & impl for Path
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-12 01:46:10 +10:00
Jiahao XU
0162f5f462
Add doc for TarEntriesVisitor
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 22:53:34 +10:00
Jiahao XU
0eb9424f17
Set vis of find_version to pub(super)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 22:47:47 +10:00
Jiahao XU
6c6055da69
Refactor mod drivers: Extract out sub mods
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 22:43:45 +10:00
Jiahao XU
f8c8c66f57
Impl new fn helpers::download_tar_based_and_visit
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:38:11 +10:00
Jiahao XU
4892d8bf3a
Impl forward of &mut T to T for TarEntriesVisitor
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:35:02 +10:00
Jiahao XU
90a96cabc9
Rewrite untar to take a visitor & simplify
signature of `download_and_extract_with_filter`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:31:46 +10:00
Jiahao XU
5a43ee2681
Simplify extract_compressed_from_readable impl
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:16:41 +10:00
Jiahao XU
57b40d809e
Cleanup mod async_extracter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
7b52eaad5b
Rewrite AsyncExtracter: Extract fmt logic as callback fn
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
d1033758a7
Update doc of download_and_extract_with_filter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
b1b79921b2
Simplify download_and_extract_with_filter: Take TarBasedFmt
instead of `PkgFmt`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
cbd57a1bce
Refactor async_extracter: Create multi extracters
dedicated to different tasks

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
bd68613448
Refactor and add new enum PkgFmtDecomposed
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Félix Saparelli
c33f195d5f
Merge pull request #178 from NobodyXu/ci 2022-06-11 21:57:38 +12:00
Jiahao XU
5302240829
Refactor workflow rust: Extract test into script
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 18:21:57 +10:00
Félix Saparelli
bd4cc85386
Merge pull request #179 from NobodyXu/feature/improve-readable-rx 2022-06-11 20:11:33 +12:00
Félix Saparelli
50183a38c5
Merge pull request #171 from NobodyXu/fix/confirm 2022-06-11 20:11:20 +12:00
Jiahao XU
9bf1ce3000
Fix typo in step "Test (Unix)"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 17:11:52 +10:00
Jiahao XU
dd24661091
Test installed bin in step "Test (Windows)"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 17:02:53 +10:00
Jiahao XU
19656b6f45
Fix typo in step "Test"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 17:02:31 +10:00
Jiahao XU
4b78d4eb4d
Fix step Test: Run cargo binstall --help instead
of `cargo binstall --version` since `--version` does not print the
version of `cargo-binstall`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 16:52:51 +10:00
Jiahao XU
58f0d5f12d
Run bins after installation in step "Test"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 16:43:11 +10:00
Jiahao XU
868f6c2759
Add more debug! to untar
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 16:13:33 +10:00
Jiahao XU
4a882dc2cb
Use BufRead inextract_compressed_from_readable
Use `BufRead` instead of `Read` to avoid copying of data and improve
efficiency.

`GzDecoder` and `XzDecoder` both have their `BufRead` counterpart
in mod `bufread` and their `read` counterpart merely wraps the input in
a `std::io::BufReader`.

`ZstdDecoder::new` also wraps it in a `BufReader` and pass it to
`ZstdDecoder::with_buffer`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 15:44:16 +10:00
Jiahao XU
e753c9ec30
Impl BufRead for ReadableRx
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 15:41:15 +10:00
Jiahao XU
ac22db5e79
Set log level to debug in step "Test"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 14:37:14 +10:00
Jiahao XU
4c210fd2c3
Rm unused imports in mod helpers
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:41 +10:00
Jiahao XU
88c3f15b3f
Rename Confirmer to UIThread
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:27 +10:00
Jiahao XU
9349fbabdc
Unwrap in Confirmer task if failed to read
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:27 +10:00
Jiahao XU
b2bf065a2b
Rm unused fn helpers::confirm::confirm
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:26 +10:00
Jiahao XU
47ed7ce27b
Use Confirmer instead of confirm in main.rs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:26 +10:00
Jiahao XU
dd2fa2de33
Impl helpers::confirm::Confirmer
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:26 +10:00
Jiahao XU
c1809d41fa
Refactor: Extract confirm into a new mod
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:22 +10:00
Félix Saparelli
f53680c497
Merge pull request #174 from NobodyXu/fix/find_crate_cratesio 2022-06-11 14:54:50 +12:00
Jiahao XU
4297b13ed9
Fix testing on Windows
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 18:20:59 +10:00
Jiahao XU
fbcfe369da
Rm cbindgen from bins in step "Test"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 18:16:28 +10:00
Jiahao XU
cfa6090e6e
Rm non-existent crate in step "Test"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 17:32:38 +10:00
Jiahao XU
ea71cede42
Fix if cond for step "Test"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 17:28:23 +10:00
Jiahao XU
e312a22ba2
set -euxo pipefail in step "Test"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 17:19:21 +10:00
Jiahao XU
dc5978e737
Fix step "Test": Fix invoking cargo-binstall directly
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 17:13:01 +10:00
Jiahao XU
68942f56e4
Merge two testing step into one in workflow rust
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 17:08:54 +10:00
Jiahao XU
57d2b4c3b4
Run job "Test binstall" only natively
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 17:08:26 +10:00
Jiahao XU
d038e77978
Fix typo in step "Test installing bins"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 17:02:18 +10:00
Jiahao XU
53c9d667ce
Enable caching on macos as issue has been fixed
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 16:55:21 +10:00
Jiahao XU
665564420a
Add more bins to test in job "Test installing bins"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 16:54:55 +10:00
Jiahao XU
4ff64dee34
Fix caching: Only cache .cargo/{git, registry}
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 16:53:34 +10:00
Jiahao XU
d4495cc3bb
Merge job test into job build to speedup workflow
so that testing does not have to wait for all build jobs with different
configurations to finish before starting.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 16:52:24 +10:00
Jiahao XU
3e5c7ec43f
Add back testing of --manifest-path in workflow rust
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 16:49:09 +10:00
Jiahao XU
b0598a1fad
Update workflow rust: Test find_crate_cratesio
by removing `--manifest-path`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 16:38:45 +10:00
Jiahao XU
62be22256b
Refactor: Extract download_and_extract_with_filter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 16:37:48 +10:00
Jiahao XU
1d139324c7
Rewrite untar: Takes a filter fn instead of array
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 16:35:51 +10:00
Félix Saparelli
1b39a7c86e
Merge pull request #172 from NobodyXu/refactor/AsyncExtracter 2022-06-10 18:26:06 +12:00
Jiahao XU
a681f3a156
Add debug! logging to untar
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 16:18:01 +10:00
Jiahao XU
fb5f61559b
Fix use of download_and_extract in find_crate_cratesio
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 15:50:56 +10:00
Jiahao XU
d2e688c4c2
Fix untar when desired_outputs is not None
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 15:49:54 +10:00
Jiahao XU
32ad530329
Rm use of AutoAbortJoinHandle in AsyncExtracter
Since there is no way to abort a blocking thread, using
`AutoAbortJoinHandle` does not add any value.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 13:54:43 +10:00
Jiahao XU
1c3a672108
Rm scopeguard creatd for mpsc::Receiver
Since `Receiver` always closes on drop, there is no need to call
`Receiver::close`, which is there so that you can close the mpsc channel
without dropping `Receiver`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 13:52:11 +10:00
Félix Saparelli
29b28a4f8f
Merge pull request #168 from NobodyXu/feature/avoid-oom 2022-06-10 01:55:22 +12:00
Jiahao XU
cadf045d0a
Refactor: Abstract away AsyncExtracter by new fn
`extract_archive_stream`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 22:29:33 +10:00
Jiahao XU
00242a40c6
Update doc for AsyncExtracter::new
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 22:22:39 +10:00
Jiahao XU
8a812c8d22
Rename AsyncExtracter::write to feed
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 22:09:46 +10:00
Jiahao XU
432376224f
Update doc of AsyncExtracter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 22:09:02 +10:00
Jiahao XU
945687c281
Rename AsyncFileWriter to AsyncExtracter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 22:00:00 +10:00
Jiahao XU
e62775a9ec
Add more doc for AsyncFileWriter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 21:34:07 +10:00
Jiahao XU
5ba8b07bcb
Rm helpers::extract
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 14:52:38 +10:00
Jiahao XU
728d1fd6dd
Rm unused param pkg_path in install_from_package
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 14:47:43 +10:00
Jiahao XU
1879a719e4
Rm fn helpers::download
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 14:47:15 +10:00
Jiahao XU
c9b0d45a24
Use download_and_extract in fetchers
to improve efficiency by avoiding disk io (except for `PkgFmt::Zip`
and `PkgFmt::Bin`) and run the compresser in parallel to the downloader.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 14:46:00 +10:00
Jiahao XU
b6bfd40c3a
Use download_and_extract in fetch_crate_cratesio
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 14:12:44 +10:00
Jiahao XU
72983e4113
Use untar in extract_compressed_from_readable
So that we can specify the files we want to extract to avoid io and save
disk usage.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 13:26:47 +10:00
Jiahao XU
be5e8616a2
Impl new fn helpers::extracter::untar
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 13:15:23 +10:00
Jiahao XU
cc13a23b07
Mark all internal types & fn as pub(crate)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 12:58:39 +10:00
Félix Saparelli
9ac40bb943
Merge pull request #166 from NobodyXu/optimize/quickinstall-report 2022-06-09 09:38:58 +12:00
Félix Saparelli
d0fed45ab5
Merge pull request #169 from NobodyXu/add-ci 2022-06-09 09:38:22 +12:00
Jiahao XU
951dacd03d
Fix cache key used in workflow "ci"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 02:00:38 +10:00
Jiahao XU
14823fbae7
Fix test::parse_meta in lib.rs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:53:24 +10:00
Jiahao XU
c9bd741c9b
Add new workflow ci
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:53:10 +10:00
Jiahao XU
1c40848f51
Rm ci.yml
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:52:30 +10:00
Jiahao XU
4b6b3e667c
Fix syntax err in workflow "ci"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:48:42 +10:00
Jiahao XU
2ea03f6b29
Add new workflow "ci" to run cargo-test
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:44:31 +10:00
Jiahao XU
441e004ef1
Fix test::parse_meta in lib.rs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:42:13 +10:00
Jiahao XU
784d1f0bf6
Impl new fn helpers::download_and_extract
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:32:38 +10:00
Jiahao XU
c3b5cb11c2
Support for any PkgFmt in AsyncFileWriter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:20:37 +10:00
Jiahao XU
58c775a648
Rename mod receiver_as_readable to readable_rx
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:02:53 +10:00
Jiahao XU
59544e8b55
Use BinstallError in AsyncFileWriter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:01:37 +10:00
Jiahao XU
f211788052
Impl ReadableRx in mod receiver_as_readable
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 23:04:14 +10:00
Jiahao XU
6bc04340b6
Impl extract_compressed_from_readable and unzip
in new mod `extracter`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 22:46:20 +10:00
Jiahao XU
894f9b49f9
Simplify AsyncFileWriter::new: Ret Self
instead of `io::Result<Self>`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 22:29:04 +10:00
Jiahao XU
911c52d8e1
Auto remove file in AsyncFileWriter
unless done is called.

Also moves creation of the dir/file into the blocking thread to avoid
blocking.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 22:27:19 +10:00
Jiahao XU
5d70f61317
Refactor: Extract AutoAbortJoinHandle
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 21:46:32 +10:00
Jiahao XU
358bea5c6d
Refactor: Extract AsyncFileWriter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 21:43:09 +10:00
Jiahao XU
6aced2ca9b
Disable feature "macros" of dep tokio
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 21:38:44 +10:00
Jiahao XU
e584b99240
Simplify AsyncFileWriter::write by closing rx on err
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 21:38:05 +10:00
Jiahao XU
d9bcca8b78
Impl AutoAbortJoinHandle::new & make its field private
plus change all its users to use its new APIs.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:53:49 +10:00
Jiahao XU
f41391a53c
Impl Future for AutoAbortJoinHandle
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:51:59 +10:00
Jiahao XU
52210d1a8c
Impl Deref{Mut} for AutoAbortJoinHandle
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:48:31 +10:00
Jiahao XU
d6a372a160
Use AutoAbortJoinHandle in AsyncFileWriter
to cancel the task on failure.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:46:00 +10:00
Jiahao XU
12931fc024
Refactor: Mv AutoAbortJoinHandle into helpers
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:44:20 +10:00
Jiahao XU
6367bfc1e3
Fix infinite block in AsyncFileWriter::write
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:42:22 +10:00
Jiahao XU
90186f0b15
Update Cargo.lock
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:40:02 +10:00
Jiahao XU
24d3a2af2b
Enable feature "macros" on dep tokio
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:39:39 +10:00
Jiahao XU
c7965ceb4f
Use ScopeGuard to auto remove file on failure
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:23:03 +10:00
Jiahao XU
80706dc3c4
Update Cargo.lock
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:12:53 +10:00
Jiahao XU
ba21372134
Add new dep scopeguard v1.1.0
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:12:37 +10:00
Jiahao XU
191fd6e981
Use AsyncFileWriter in helpers::download
so that writing to file will not block the download.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:11:01 +10:00
Jiahao XU
5fdeea86ad
Impl helpers::AsyncFileWriter
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:03:58 +10:00
Jiahao XU
570febdaad
Update Cargo.lock
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 19:43:56 +10:00
Jiahao XU
33e61f544a
Add new dep bytes v1.1.0
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 19:43:41 +10:00
Jiahao XU
6988264e99
Update Cargo.lock
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 19:38:45 +10:00
Jiahao XU
2e25360e82
Enable feature "sync" of dep tokio
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 19:38:26 +10:00
Jiahao XU
3b88913013
Add new dep futures-util v0.3.21 without default feature
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 19:37:52 +10:00
Jiahao XU
dab790deaf
Enable feature "stream" of dep reqwest
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 19:33:56 +10:00
Jiahao XU
cf87abba16
Run QuickInstall reporting using tokio::spawn
So that it is run in concurrent or even in parallel with the
`remote_exists`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 19:13:10 +10:00
Félix Saparelli
43d5a6bdb1
(cargo-release) version 0.9.1 2022-06-08 17:17:00 +12:00
Félix Saparelli
fdbf186561
(cargo-release) version 0.9.0 2022-06-08 17:16:28 +12:00
Félix Saparelli
bd6aec9abb
Merge pull request #154 from passcod/ed-2021 2022-06-08 17:11:35 +12:00
Félix Saparelli
b4df4d0de3
Update deps 2022-06-08 16:54:42 +12:00
Félix Saparelli
aad708a035
Slightly more ergo clone by ordering 2022-06-08 16:43:18 +12:00
Félix Saparelli
d59fd60e8a
Set MSRV
Not as policy, just because we use 1.61.0 features
2022-06-08 16:39:35 +12:00
Félix Saparelli
6333fb0bd3
Use newer format! syntax 2022-06-08 16:39:34 +12:00
Félix Saparelli
bd562924a2
Switch to edition 2021 2022-06-08 16:38:09 +12:00
Félix Saparelli
adfc260d58
Merge pull request #157 from passcod/clap3 2022-06-08 16:37:53 +12:00
Félix Saparelli
0b5d3ec1a6
Fix format now
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 01:44:11 +12:00
Félix Saparelli
fa56a729b0
Just unwrap it 2022-06-08 01:42:25 +12:00
Félix Saparelli
ea10736e13
Don't send qi reports in dev 2022-06-08 01:35:47 +12:00
Félix Saparelli
148d34e980
Log exact URL for qi report 2022-06-08 01:35:47 +12:00
Félix Saparelli
d0a292e173
Ignore rustls log output 2022-06-08 01:35:47 +12:00
Félix Saparelli
0abfcbd1fb
Simplify short help output 2022-06-08 01:04:46 +12:00
Félix Saparelli
235bcac300
Properly support multiple targets 2022-06-08 01:00:21 +12:00
Félix Saparelli
fcf5728dde
Replace Box<str> with String 2022-06-08 00:54:49 +12:00
Félix Saparelli
15d828b55b
Stop lying about url support 2022-06-08 00:54:30 +12:00
Félix Saparelli
f2582b9cf2
Expand help text 2022-06-08 00:11:39 +12:00
Félix Saparelli
d58ce3892a
Use clap3 2022-06-07 23:56:24 +12:00
Félix Saparelli
6877a0c3a9
Merge pull request #161 from NobodyXu/feature/bin-multi-targets 2022-06-07 23:55:05 +12:00
Félix Saparelli
d7792de0c6
Merge pull request #165 from NobodyXu/fix/arg-parsing 2022-06-07 23:54:42 +12:00
Jiahao XU
2ea341381d
Fix parsing in entry: Use std::env::args_os
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 17:07:17 +10:00
Jiahao XU
6f7c8fa8ab
Merge branch 'main' into feature/bin-multi-targets 2022-06-07 16:38:14 +10:00
Jiahao XU
ad3e707aa3
Fix install_from_package: Rm use of opts.target
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 16:37:04 +10:00
Jiahao XU
3f2e03893a
Add Fetcher::target to trait Fetcher
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 16:35:47 +10:00
Félix Saparelli
764a960c90
Merge pull request #164 from NobodyXu/optimize-tokio-usage 2022-06-07 18:35:43 +12:00
Jiahao XU
456e896483
Use code 17 for MainExit::JoinErr
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 16:22:01 +10:00
Jiahao XU
903c9f5591
Refactor: Use Result::map_or_else in main
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 16:19:07 +10:00
Jiahao XU
b6245bcf4b
Spawn entry() in main to improve parallelism
Using `rt.block_on`, the future returned by `entry` can only be run on
the main thread.

Buf if we use `tokio::spawn`, then it can be run on any thread.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 16:13:38 +10:00
Félix Saparelli
7fa053cbd1
Merge pull request #163 from NobodyXu/optimization 2022-06-07 17:58:58 +12:00
Félix Saparelli
20ec8d6359
Merge pull request #162 from NobodyXu/feature/parallelize-MultiFetcher 2022-06-07 17:54:12 +12:00
Jiahao XU
b2a533dbdb
Optimize GhCrateMeta::check: Avoid converting url to str
Only to convert it back to `Url` in `helpers::remote_exists`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:40:55 +10:00
Jiahao XU
3d6679fd7d
Refactor MultiFetcher.first_available
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:35:21 +10:00
Jiahao XU
c393270899
Run fetchers in parallel in MultiFetcher.first_available
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:29:09 +10:00
Jiahao XU
d373ad5145
Require Send and Sync for trait Fetcher
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:28:48 +10:00
Jiahao XU
31b7439a69
Mod trait Fetcher::new to return Arc<Self>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:16:10 +10:00
Jiahao XU
603955b848
Support for checking multi-targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:11:04 +10:00
Félix Saparelli
0c83d010b1
Merge pull request #160 from NobodyXu/feature/target-detection 2022-06-07 14:41:03 +12:00
Félix Saparelli
ee03e971f0
Merge pull request #158 from ryankurte/dependabot/cargo/tokio-1.19.1 2022-06-07 14:25:27 +12:00
Félix Saparelli
bc1491d6c6
Merge pull request #159 from ryankurte/dependabot/cargo/async-trait-0.1.56 2022-06-07 14:24:45 +12:00
Jiahao XU
0819b65308
Update Cargo.lock
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 12:21:50 +10:00
Jiahao XU
9c818e0e95
Remove dep arrayvec
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 12:21:03 +10:00
Jiahao XU
ecf6fdbab5
Revert back to using Vec<Box<str>> for targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 12:20:46 +10:00
Jiahao XU
9ee2609b25
Refactor get_target_from_rustc impl
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 12:14:27 +10:00
Jiahao XU
96336e4dd9
Update doc of get_target_from_rustc
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 12:11:49 +10:00
Jiahao XU
95b7c4f771
Rename get_targets_from_rustc to get_target_from_rustc
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 12:11:04 +10:00
Jiahao XU
1d71f92ee6
Impl IntoIterator for &Targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 12:10:05 +10:00
Jiahao XU
bd224f7186
Use star re-export for mod targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 11:49:02 +10:00
Jiahao XU
7a244176b4
Reorder dep in Cargo.toml
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 11:48:19 +10:00
Jiahao XU
efc8119c45
Add opaque newtype Targets over ArrayVec<Box<str>, 2>
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 11:45:53 +10:00
Jiahao XU
11fe943a11
Fix parse_abi for gnu_ilp32 and gnuspe
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 11:30:00 +10:00
Jiahao XU
1df135f4c0
Fix target::linux::parse_abi: Remove const
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 00:20:52 +10:00
Jiahao XU
44b1bdbfe5
Fix use of ends_with
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 23:20:09 +10:00
Jiahao XU
3f7f293b78
Fix bugs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 23:17:07 +10:00
Jiahao XU
c9c3cffb25
Fix detect_targets for win and other targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 23:08:00 +10:00
Jiahao XU
6b764b0b3f
Add fallbacks for get_targets_from_rustc
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 23:07:25 +10:00
Jiahao XU
cce378e2c5
Add get_targets_from_rustc to detect_targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 23:00:33 +10:00
Jiahao XU
8bf4d187ee
Rename parse_libc_version to parse_libc_version_from_ldd_output
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:53:12 +10:00
Jiahao XU
7232f32428
Use ArrayVec to avoid heap alloc in detect_targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:52:11 +10:00
Jiahao XU
c50e949170
Update Cargo.lock
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:45:21 +10:00
Jiahao XU
1ebc759b17
Add dep arrayvec v0.7.2
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:45:06 +10:00
Jiahao XU
b74139f457
Support for other platforms in detect_targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:42:43 +10:00
Jiahao XU
9a8b28afcf
Fix invocation of linux::detect_targets_linux
in `detect_targets`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:41:36 +10:00
Jiahao XU
4157f20b99
Support for macos in detect_targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:40:52 +10:00
Jiahao XU
ca5c9b7c23
Add dep guess_host_triple for target_os macos
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:35:51 +10:00
Jiahao XU
8bd4b9b6a1
Impl detect_targets for linux
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:32:15 +10:00
Jiahao XU
69f2a56595
Move TARGET in lib.rs into new mod target.rs
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-06 22:00:01 +10:00
dependabot[bot]
fe551438a0
Bump async-trait from 0.1.53 to 0.1.56
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.53 to 0.1.56.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.53...0.1.56)

---
updated-dependencies:
- dependency-name: async-trait
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-06 01:25:44 +00:00
dependabot[bot]
962e68f786
Bump tokio from 1.18.2 to 1.19.1
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.18.2 to 1.19.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.18.2...tokio-1.19.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-06 01:25:38 +00:00
Félix Saparelli
6ab55d9dda
Fix arm64 linux URL 2022-06-01 01:46:28 +12:00
Félix Saparelli
6457ab9b64
(cargo-release) version 0.8.0 2022-06-01 01:30:48 +12:00
Félix Saparelli
ab678a8127
Merge pull request #153 from passcod/clippy 2022-06-01 01:28:33 +12:00
Félix Saparelli
e3754de7f7
Formatting 2022-06-01 01:11:53 +12:00
Félix Saparelli
23f05f3985
Clippy in tests 2022-06-01 01:11:26 +12:00
Félix Saparelli
7ce1ac4ee6
Fix syntax 2022-06-01 01:11:26 +12:00
Félix Saparelli
f2905dd46e
Update src/helpers.rs
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-01 01:11:26 +12:00
Félix Saparelli
ac74da4a27
Clippy suggestions 2022-06-01 01:11:26 +12:00
Félix Saparelli
13a8e1e5fe
Merge pull request #152 from passcod/warn-on-http
Warn on non-HTTPS URLs
2022-06-01 01:11:01 +12:00
Félix Saparelli
b79d8d7fec
Warn on non-HTTPS url 2022-06-01 00:43:41 +12:00
Félix Saparelli
a1fa3a47e5
Merge pull request #151 from passcod/rich-errors 2022-06-01 00:42:36 +12:00
Félix Saparelli
73b3ac1adb
Drop tokio macros 2022-06-01 00:30:28 +12:00
Félix Saparelli
77b331f97c
Add error codes to documentation 2022-06-01 00:29:18 +12:00
Félix Saparelli
529781a9a9
Format and link version mismatch warning 2022-06-01 00:29:18 +12:00
Félix Saparelli
aa4339e07d
Expose crate::errors module 2022-06-01 00:29:17 +12:00
Félix Saparelli
1cac046ffd
Formatting 2022-06-01 00:29:17 +12:00
Félix Saparelli
dee45f4b81
Correct HTTP error for remote_exists() helper 2022-06-01 00:29:17 +12:00
Félix Saparelli
c83c184983
Default to no if nothing is entered on confirm 2022-06-01 00:29:17 +12:00
Félix Saparelli
52c0213d98
Show prompt for confirm 2022-06-01 00:29:17 +12:00
Félix Saparelli
7f0c818313
Don’t print "Fatal error" for UserAbort 2022-06-01 00:29:17 +12:00
Félix Saparelli
d21c4a0875
Add link to error code descriptions 2022-06-01 00:29:17 +12:00
Félix Saparelli
33f4c76826
Add help text for when a crate is not found 2022-06-01 00:29:17 +12:00
Félix Saparelli
84ebc0039e
Pretty-print errors 2022-06-01 00:29:17 +12:00
Félix Saparelli
02c8c0af00
Avoid bare url 2022-06-01 00:29:17 +12:00
Félix Saparelli
bd35c473a9
Use new Termination trait 2022-06-01 00:29:17 +12:00
Félix Saparelli
f56ed6fc4c
Add per-error exit codes 2022-06-01 00:29:17 +12:00
Félix Saparelli
f9e69503b0
Document the library error types 2022-06-01 00:29:17 +12:00
Félix Saparelli
c0eaffb05d
Refactor for rich errors, split user abort and genuine error 2022-06-01 00:29:14 +12:00
Félix Saparelli
3c38a2f0eb
Merge pull request #150 from NobodyXu/optimize-dependencies 2022-06-01 00:06:02 +12:00
Jiahao XU
39580cdc51
Update Cargo.lock
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 21:49:04 +10:00
Jiahao XU
fff4b72256
Enable feature zlib-ng of flate2 so that zlib-ng is used
which is the fastest implementation flate2 supports.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 21:45:12 +10:00
Jiahao XU
20b2c37ffb
Bump dep flate2 to v1.0.24
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 21:45:11 +10:00
Jiahao XU
355895d8b6
Disable all features of zip except deflate, bzip2 and zstd
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 21:45:10 +10:00
Jiahao XU
91bb84d5a8
Optimize dep tokio: Disable all feature except rt-multi-thread, macros
and process

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 21:44:20 +10:00
Félix Saparelli
db3f12c3ea
Merge pull request #148 from NobodyXu/feature/zstd 2022-05-31 23:02:16 +12:00
Jiahao XU
5d62f7f615
Rm target aarch64-unknown-linux-gnu & armv7-unknown-linux-gnueabihf
Since they are the only two targets that crate `zstd-sys` failed to
build.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 20:41:32 +10:00
Félix Saparelli
03d4630024
Merge pull request #149 from NobodyXu/optimize-release 2022-05-31 22:34:46 +12:00
Jiahao XU
393e808951
Update Cross.toml
Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
2022-05-31 19:36:39 +10:00
Jiahao XU
66a3e9f416
Add back workaround for musl targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 19:32:02 +10:00
Jiahao XU
e0f67973ae
Update Cross.toml
Co-authored-by: Emil Gardström <emil.gardstrom@gmail.com>
2022-05-31 19:31:20 +10:00
Jiahao XU
5f3396a886
Rm image specification for musl targets in Cross.toml
musl targets work fine, no workaound is required.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 19:25:44 +10:00
Jiahao XU
ca6469ca66
Fix image ver format in Cross.toml
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 19:23:20 +10:00
Jiahao XU
ba5a81d792
Pin image version in Cross.toml
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 19:09:26 +10:00
Jiahao XU
69a23e477a
Add workaround libclang.so not found error when cross bulding
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 18:19:09 +10:00
Jiahao XU
84d8b9295f
Set profile.release.strip to symbols in Cargo.toml
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 17:39:33 +10:00
Jiahao XU
7b39239729
Revert "Set RUSTFLAGS to -Cstrip=symbols in job build"
This reverts commit c3c1c97dd3.
2022-05-31 17:39:19 +10:00
Jiahao XU
c3c1c97dd3
Set RUSTFLAGS to -Cstrip=symbols in job build
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 17:31:59 +10:00
Jiahao XU
a378be8bc6
Revert "Run strip as a separate step in job build"
This reverts commit 8bdd089775.
2022-05-31 17:30:50 +10:00
Jiahao XU
8bdd089775
Run strip as a separate step in job build
except on windows.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 17:23:17 +10:00
Jiahao XU
3411812ee5
Revert "Set RUSTFLAGS to -Zstrip=symbols in job build"
This reverts commit 62b5ecbe83.
2022-05-31 17:22:17 +10:00
Jiahao XU
62b5ecbe83
Set RUSTFLAGS to -Zstrip=symbols in job build
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 17:18:51 +10:00
Jiahao XU
c989ed0823
Optimize release build
by enabling lto, setting `codegen-units` to 1 and setting panic behavior
to `abort`.

On my `aarch64-apple-darwin` with `rustc 1.61.0`, this reduces the size
of binary from 7.8M to 4.9M

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 17:12:15 +10:00
Jiahao XU
a59057b932
Update README.md: Tar.zst is now supported by cargo-binstall
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 16:59:00 +10:00
Jiahao XU
5b6634def6
Add new variant PkgFmt::Tzstd and update helpers::extract
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 16:50:55 +10:00
Jiahao XU
f555c75e23
Update Cargo.lock
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 16:50:36 +10:00
Jiahao XU
9e35efbd10
Add new dep zstd v0.10.0
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 16:43:45 +10:00
Félix Saparelli
f0e7fa0111
Merge pull request #147 from passcod/cli-overrides
Closes #70
Fixes #69
2022-05-31 18:16:41 +12:00
Félix Saparelli
2f9be15c30
Fix old template specifier in readme 2022-05-31 18:01:29 +12:00
Lea Fairbanks
19d0616324
Add cli overrides 2022-05-31 18:00:07 +12:00
Félix Saparelli
09129a4f7f
Merge pull request #146 from passcod/tempfile
Use tempfile over tempdir
2022-05-31 17:58:58 +12:00
Félix Saparelli
fd029bc583
Merge pull request #145 from passcod/apple-m1 2022-05-31 17:39:17 +12:00
Félix Saparelli
fbf26634c9
Formatting 2022-05-31 17:37:40 +12:00
Félix Saparelli
e8464aba3d
Use tempfile over tempdir
Closes #135
2022-05-31 17:37:34 +12:00
Félix Saparelli
151998a1eb
Cleanup yaml 2022-05-31 17:25:34 +12:00
Félix Saparelli
bee95cdb27
Fix markdown 2022-05-31 17:24:52 +12:00
Félix Saparelli
22f509fb72
Add macos arm64 to readme 2022-05-31 17:24:42 +12:00
Félix Saparelli
c1fd2398f0
Add linux arm64 to readme 2022-05-31 17:24:04 +12:00
Félix Saparelli
3a1d42fd6b
Default to musl builds on the readme 2022-05-31 17:19:56 +12:00
Félix Saparelli
832c51f025
Add apple m1 builds 2022-05-31 17:17:04 +12:00
Félix Saparelli
9026554471
Merge pull request #143 from NobodyXu/use-static-musl-libc-for-prebuilt 2022-05-31 17:00:53 +12:00
Jiahao XU
9ed7dc6970
Rm step for installing musl-tool in job test
The job `test` for target `x86_64-unknown-linux-musl` requires
`musl-tool` since there is no pre-built binary present for that target
and thus `cargo-binstall` automatically fall back to `cargo-build`.

Currently, the test for it also failed because `libssl-1.1` is not
present.

However, since this will be fixed once a new release of `cargo-binstall`
is published, this step should not be present.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 14:40:45 +10:00
Jiahao XU
aabf5c75a2
Add target aarch64 to job build
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 14:24:08 +10:00
Jiahao XU
9c9b8e55b3
Use cross to for target armv7-unknown-linux-gnueabihf
in job `build`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 14:08:51 +10:00
Jiahao XU
187ac2d20e
Refactor: Avoid duplicate job for building release
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 13:53:03 +10:00
Jiahao XU
6172bcb126
Fix step "Configure toolchain" in job test
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 13:08:13 +10:00
Jiahao XU
feb03e37d2
Fix job test for x86_64-unknown-linux-musl
Install corresponding rustup target and musl-tools

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 12:58:35 +10:00
Jiahao XU
d1c6a07a48
Fix typo in path of step "Configure caching"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 12:47:02 +10:00
Jiahao XU
ec5ab955b3
Fix use of || in if in steps
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 12:44:18 +10:00
Jiahao XU
7796f8760a
Enable use-cross for job "Build release for arm musl target"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 12:40:48 +10:00
Jiahao XU
37ddf3c435
Merge duplicate steps with different if using ||
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 12:37:49 +10:00
Jiahao XU
38849734b2
Remove steps to install libssl in job build
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 12:36:40 +10:00
Jiahao XU
7455037190
Add x86_64-unknown-linux-musl as target to job test
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 00:36:36 +10:00
Jiahao XU
bcc8057705
Add back {x86_64, armv7}unknown-linux-gnu{eabihf} targets
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 00:35:03 +10:00
Jiahao XU
cba8a05c82
Fix job "Install cross toolchain (armv7)"
Install "gcc-arm-linux-gnueabihf" as "gcc-arm-linux-musleabihf" does not
exist.

Also use `apt-get` instead of `apt`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-30 17:19:10 +10:00
Jiahao XU
4e1cb0fdcf
Compile prebuilt binaries using musl target
So that it is statically linked and does not depend on any dynamic
library and can be run anywhere.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-30 17:13:57 +10:00
Ryan
c2aab16940
Merge pull request #128 from somehowchris/feature/remove-git-index
feat: remove crates-index dependency
2022-05-02 10:39:31 +12:00
Christof Weickhardt
256e695aa5 feat: remove crates-index dependency 2022-05-01 07:45:23 +00:00
Ryan
2d68a74637
Merge pull request #126 from somehowchris/feature/crates_io_api-rustls
feat: use rustls for crates_io_api
2022-05-01 11:44:18 +12:00
Ryan
26711f3ae6
Merge pull request #125 from somehowchris/fix/package-version-abort-logic
fix: abort install for specific version if not confirmed
2022-05-01 11:44:01 +12:00
Ryan
60fc30461e
Merge pull request #122 from somehowchris/feature/ignore-yanked
fix: ignore crate version if yanked
2022-05-01 11:43:41 +12:00
Christof Weickhardt
62577a72f3 feat: use rustls for crates_io_api 2022-04-30 09:24:32 +00:00
Christof Weickhardt
42e327477b fix: abort install for specific version if not confirmed 2022-04-30 09:20:15 +00:00
Christof Weickhardt
5f9c673ea5 fix: ignore crate version if yanked 2022-04-29 11:10:05 +00:00
Félix Saparelli
77f51aff84 (cargo-release) version 0.7.0 2022-04-29 10:23:52 +12:00
Félix Saparelli
dd33a1d66e Mention source fallback in readme 2022-04-29 10:21:09 +12:00
Félix Saparelli
eeaba76b5f
Fallback to installing from source (#114)
Closes #108
2022-04-29 10:15:43 +12:00
Félix Saparelli
d68b0a209a
Clarify --version usage and add a warning at runtime (#116)
Fixes #113
2022-04-29 09:33:54 +12:00
Félix Saparelli
1757dc5344
Make fetcher creating infallible (#118)
Fixes #109
2022-04-29 09:24:46 +12:00
Félix Saparelli
62ec23e6f4
Use the correct link name (#117)
On windows, but also use templating to render it correctly everywhere.

Fixes #106
Fixes #111
2022-04-29 09:24:19 +12:00
Ryan
856728b2c7
Merge pull request #104 from nabijaczleweli/main
Point links to just basename-ver, print them the right way 'round
2022-03-14 11:58:27 +13:00
наб
f76791b9b9
Direct the symlink the right way in symlink info!(), point at actual destination 2022-03-13 16:32:58 +01:00
наб
5b4909f9eb
Link to basename instead of absolute path on unix
This renders the link (a) more likely to fit in an ext4 inode
and more importantly (b) makes the bindir impervious to being moved
around
2022-03-13 16:32:55 +01:00
Félix Saparelli
5506ffb5d0 (cargo-release) version 0.6.2 2022-02-16 22:44:10 +13:00
Félix Saparelli
b5d6d68d6d Fix quickinstall failing when packages are not wrapped in a folder 2022-02-16 22:42:37 +13:00
Félix Saparelli
49f3489398 (cargo-release) version 0.6.1 2022-02-16 22:11:55 +13:00
Félix Saparelli
7a1d8b42dd Revert Cargo.toml to {format} to allow self-upgrade 2022-02-16 22:06:03 +13:00
231 changed files with 28204 additions and 2419 deletions

View file

@ -1,11 +0,0 @@
[target.armv7-unknown-linux-gnueabihf]
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"

6
.config/nextest.toml Normal file
View file

@ -0,0 +1,6 @@
[test-groups]
rate-limited = { max-threads = 1 }
[[profile.default.overrides]]
filter = 'test(rate_limited::)'
test-group = 'rate-limited'

15
.editorconfig Normal file
View file

@ -0,0 +1,15 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[tests/snapshots/*]
trim_trailing_whitespace = false
[*.{cff,yml}]
indent_size = 2

1
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
github: [NobodyXu]

156
.github/actions/just-setup/action.yml vendored Normal file
View file

@ -0,0 +1,156 @@
name: Setup tools and cache
inputs:
tools:
description: Extra tools
required: false
default: ""
indexcache:
description: Enable index cache
required: true
default: true
type: boolean
buildcache:
description: Enable build cache
required: true
default: true
type: boolean
runs:
using: composite
steps:
- name: Enable macOS developer mode for better
if: runner.os == 'macOS'
run: sudo spctl developer-mode enable-terminal
shell: bash
- name: Enable transparent huge page
if: runner.os == 'Linux'
run: echo madvise | sudo tee /sys/kernel/mm/transparent_hugepage/enabled
shell: bash
- name: Configure jemalloc (used by rustc) to use transparent huge page
if: runner.os == 'Linux'
run: echo "MALLOC_CONF=thp:always,metadata_thp:always" >> "$GITHUB_ENV"
shell: bash
- name: Exclude workspace and cargo/rustup home from windows defender
if: runner.os == 'Windows'
run: |
Add-MpPreference -ExclusionPath '${{ github.workspace }}'
shell: pwsh
- name: Add just to tools to install
run: echo "tools=just" >>"$GITHUB_ENV"
shell: bash
- name: Add inputs.tools to tools to install
if: inputs.tools != ''
env:
inputs_tools: ${{ inputs.tools }}
run: echo "tools=$tools,$inputs_tools" >>"$GITHUB_ENV"
shell: bash
- name: Determine native target
run: |
if [ "$RUNNER_OS" = "Linux" ]; then RUNNER_TARGET=x86_64-unknown-linux-gnu; fi
if [ "$RUNNER_OS" = "macOS" ]; then RUNNER_TARGET=aarch64-apple-darwin; fi
if [ "$RUNNER_OS" = "Windows" ]; then RUNNER_TARGET=x86_64-pc-windows-msvc; fi
echo "RUNNER_TARGET=$RUNNER_TARGET" >>"$GITHUB_ENV"
shell: bash
- name: Install tools
uses: taiki-e/install-action@v2
with:
tool: ${{ env.tools }}
env:
CARGO_BUILD_TARGET: ${{ env.RUNNER_TARGET }}
- name: Install rust toolchains
run: just toolchain
shell: bash
- name: rustc version
run: rustc -vV
shell: bash
- name: Retrieve RUSTFLAGS for caching
if: inputs.indexcache || inputs.buildcache
id: retrieve-rustflags
run: |
if [ -n "${{ inputs.buildcache }}" ]; then
echo RUSTFLAGS="$(just print-rustflags)" >> "$GITHUB_OUTPUT"
else
echo RUSTFLAGS= >> "$GITHUB_OUTPUT"
fi
shell: bash
- run: just ci-install-deps
shell: bash
- if: inputs.indexcache || inputs.buildcache
uses: Swatinem/rust-cache@v2
with:
env-vars: "CARGO CC CFLAGS CXX CMAKE RUST JUST"
env:
RUSTFLAGS: ${{ steps.retrieve-rustflags.outputs.RUSTFLAGS }}
- name: Find zig location and create symlink to it in ~/.local/bin
if: env.JUST_USE_CARGO_ZIGBUILD
run: |
python_package_path=$(python3 -m site --user-site)
ln -s "${python_package_path}/ziglang/zig" "$HOME/.local/bin/zig"
shell: bash
- name: Calculate zig cache key
if: env.JUST_USE_CARGO_ZIGBUILD
run: |
ZIG_VERSION=$(zig version)
SYS_CRATE_HASHSUM=$(cargo tree --all-features --prefix none --no-dedupe --target "$CARGO_BUILD_TARGET" | grep -e '-sys' -e '^ring' | sort -u | sha1sum | sed 's/[ -]*//g')
PREFIX=v0-${JOB_ID}-zig-${ZIG_VERSION}-${CARGO_BUILD_TARGET}-
echo "ZIG_CACHE_KEY=${PREFIX}${SYS_CRATE_HASHSUM}" >> "$GITHUB_ENV"
echo -e "ZIG_CACHE_RESTORE_KEY=$PREFIX" >> "$GITHUB_ENV"
shell: bash
env:
RUSTFLAGS: ${{ steps.retrieve-rustflags.outputs.RUSTFLAGS }}
JOB_ID: ${{ github.job }}
- name: Get zig global cache dir
if: env.JUST_USE_CARGO_ZIGBUILD
id: zig_global_cache_dir_path
run: |
cache_dir=$(zig env | jq -r '.global_cache_dir')
echo "cache_dir=$cache_dir" >> "$GITHUB_OUTPUT"
shell: bash
- name: Cache zig compilation
if: env.JUST_USE_CARGO_ZIGBUILD
uses: actions/cache@v4
with:
path: ${{ steps.zig_global_cache_dir_path.outputs.cache_dir }}
key: ${{ env.ZIG_CACHE_KEY }}
restore-keys: |
${{ env.ZIG_CACHE_RESTORE_KEY }}
- name: Cache make compiled
if: runner.os == 'macOS'
id: cache-make
uses: actions/cache@v4
with:
path: /usr/local/bin/make
key: ${{ runner.os }}-make-4.4.1
- name: Build and use make 4.4.1 on macOS, since cc requires make >=4.3
if: runner.os == 'macOS' && steps.cache-make.outputs.cache-hit != 'true'
run: |
curl "https://ftp.gnu.org/gnu/make/make-${MAKE_VERSION}.tar.gz" | tar xz
pushd "make-${MAKE_VERSION}"
./configure
make -j 4
popd
cp -p "make-${MAKE_VERSION}/make" /usr/local/bin
env:
MAKE_VERSION: 4.4.1
shell: bash
- run: make -v
shell: bash

View file

@ -2,8 +2,20 @@
version: 2
updates:
- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "cargo"
directory: "/"
schedule:
# Only run dependabot after all compatible upgrades and transitive deps
# are done to reduce amount of PRs opened.
interval: "weekly"
day: "saturday"
groups:
deps:
patterns:
- "*"

12
.github/scripts/ephemeral-crate.sh vendored Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euxo pipefail
cat >> crates/bin/Cargo.toml <<EOF
[package.metadata.binstall.signing]
algorithm = "minisign"
pubkey = "$(tail -n1 minisign.pub)"
EOF
cp minisign.pub crates/bin/minisign.pub

12
.github/scripts/ephemeral-gen.sh vendored Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euxo pipefail
rsign generate -f -W -p minisign.pub -s minisign.key
set +x
echo "::add-mask::$(tail -n1 minisign.key)"
set -x
rage --encrypt --recipient "$AGE_KEY_PUBLIC" --output minisign.key.age minisign.key
rm minisign.key

20
.github/scripts/ephemeral-sign.sh vendored Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
[[ -z "$AGE_KEY_SECRET" ]] && { echo "!!! Empty age key secret !!!"; exit 1; }
cat >> age.key <<< "$AGE_KEY_SECRET"
set -x
rage --decrypt --identity age.key --output minisign.key minisign.key.age
ts=$(node -e 'console.log((new Date).toISOString())')
git=$(git rev-parse HEAD)
comment="gh=$GITHUB_REPOSITORY git=$git ts=$ts run=$GITHUB_RUN_ID"
for file in "$@"; do
rsign sign -W -s minisign.key -x "$file.sig" -t "$comment" "$file"
done
rm age.key minisign.key

41
.github/scripts/release-pr-template.ejs vendored Normal file
View file

@ -0,0 +1,41 @@
<% if (pr.metaComment) { %>
<!-- <%- JSON.stringify({ "release-pr": { v2: { crates, version } } }) %> -->
<% } %>
This is a release PR for **<%= crate.name %>** version **<%= version.actual %>**<%
if (version.actual != version.desired) {
%> (performing a <%= version.desired %> bump).<%
} else {
%>.<%
}
%>
**Use squash merge.**
<% if (crate.name == "cargo-binstall") { %>
Upon merging, this will automatically create the tag `v<%= version.actual %>`, build the CLI,
create a GitHub release with the release notes below
<% } else { %>
Upon merging, this will create the tag `<%= crate.name %>-v<%= version.actual %>`
<% } %>, and CI will publish to crates.io on merge of this PR.
**To trigger builds initially, close and then immediately re-open this PR once.**
<% if (pr.releaseNotes) { %>
---
_Edit release notes into the section below:_
<!-- do not change or remove this heading -->
### Release notes
_Binstall is a tool to fetch and install Rust-based executables as binaries. It aims to be a drop-in replacement for `cargo install` in most cases. Install it today with `cargo install cargo-binstall`, from the binaries below, or if you already have it, upgrade with `cargo binstall cargo-binstall`._
#### In this release:
-
#### Other changes:
-
<% } %>

18
.github/scripts/test-detect-targets-musl.sh vendored Executable file
View file

@ -0,0 +1,18 @@
#!/bin/bash
set -exuo pipefail
TARGET=${1?}
[ "$(detect-targets)" = "$TARGET" ]
apk update
apk add gcompat
ls -lsha /lib
GNU_TARGET=${TARGET//musl/gnu}
[ "$(detect-targets)" = "$(printf '%s\n%s' "$GNU_TARGET" "$TARGET")" ]
echo

40
.github/workflows/cache-cleanup.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: Cleanup caches for closed PRs
on:
# Run twice every day to remove the cache so that the caches from the closed prs
# are removed.
schedule:
- cron: "0 17 * * *"
- cron: "30 18 * * *"
workflow_dispatch:
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cleanup
run: |
set -euxo pipefail
gh extension install actions/gh-actions-cache
export REPO="${{ github.repository }}"
# Setting this to not fail the workflow while deleting cache keys.
set +e
# Remove pull requests cache, since they cannot be reused
gh pr list --state closed -L 20 --json number --jq '.[]|.number' | (
while IFS='$\n' read -r closed_pr; do
BRANCH="refs/pull/${closed_pr}/merge" ./cleanup-cache.sh
done
)
# Remove merge queue cache, since they cannot be reused
gh actions-cache list -L 100 | cut -f 3 | (grep 'gh-readonly-queue' || true) | sort -u | (
while IFS='$\n' read -r branch; do
BRANCH="$branch" ./cleanup-cache.sh
done
)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

398
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,398 @@
name: CI
on:
workflow_dispatch:
workflow_call:
inputs:
additional_key:
required: true
type: string
default: ""
merge_group:
pull_request:
types:
- opened
- reopened
- synchronize
push:
branches:
- main
paths:
- 'Cargo.lock'
- 'Cargo.toml'
- '**/Cargo.toml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.event.pull_request.number || github.sha }}-${{ inputs.additional_key }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
JUST_ENABLE_H3: true
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 4
CARGO_PROFILE_DEV_CODEGEN_UNITS: 4
CARGO_PROFILE_CHECK_ONLY_CODEGEN_UNITS: 4
jobs:
changed-files:
runs-on: ubuntu-latest
name: Test changed-files
permissions:
pull-requests: read
outputs:
crates_changed: ${{ steps.list-changed-files.outputs.crates_changed }}
has_detect_target_changed: ${{ steps.list-changed-files.outputs.has_detect_target_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@6f67ee9ac810f0192ea7b3d2086406f97847bcf9
with:
dir_names: true
dir_names_exclude_current_dir: true
dir_names_max_depth: 2
- name: List all changed files
id: list-changed-files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
set -euxo pipefail
crates_changed="$(for file in $ALL_CHANGED_FILES; do echo $file; done | grep crates | cut -d / -f 2 | sed 's/^bin$/cargo-binstall/' || echo)"
has_detect_target_changed="$(echo "$crates_changed" | grep -q detect-targets && echo true || echo false)"
echo "crates_changed=${crates_changed//$'\n'/ }" | tee -a "$GITHUB_OUTPUT"
echo "has_detect_target_changed=$has_detect_target_changed" | tee -a "$GITHUB_OUTPUT"
unit-tests:
needs: changed-files
runs-on: ubuntu-latest
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/just-setup
env:
# just-setup use binstall to install sccache,
# which works better when we provide it with GITHUB_TOKEN.
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
with:
tools: cargo-nextest
- name: Decide crates to test
shell: bash
env:
CRATES_CHANGED: ${{ needs.changed-files.outputs.crates_changed }}
run: |
ARGS=""
for crate in $CRATES_CHANGED; do
ARGS="$ARGS -p $crate"
done
echo "CARGO_NEXTEST_ADDITIONAL_ARGS=$ARGS" | tee -a "$GITHUB_ENV"
- run: just unit-tests
if: env.CARGO_NEXTEST_ADDITIONAL_ARGS != ''
env:
GITHUB_TOKEN: ${{ secrets.CI_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
CI_UNIT_TEST_GITHUB_TOKEN: ${{ secrets.CI_UNIT_TEST_GITHUB_TOKEN }}
e2e-tests:
if: github.event_name != 'pull_request'
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/just-setup
env:
# just-setup use binstall to install sccache,
# which works better when we provide it with GITHUB_TOKEN.
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN }}
- run: just build
- run: just e2e-tests
env:
GITHUB_TOKEN: ${{ secrets.CI_TEST_GITHUB_TOKEN }}
cross-check:
strategy:
fail-fast: false
matrix:
include:
- target: armv7-unknown-linux-musleabihf
os: ubuntu-latest
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- name: Enable cargo-zigbuild
if: matrix.os == 'ubuntu-latest'
run: echo JUST_USE_CARGO_ZIGBUILD=true >> "$GITHUB_ENV"
- uses: ./.github/actions/just-setup
with:
tools: cargo-hack@0.6.10
env:
# just-setup use binstall to install sccache,
# which works better when we provide it with GITHUB_TOKEN.
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- run: just avoid-dev-deps
- run: just check
lint:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/just-setup
env:
# just-setup use binstall to install sccache,
# which works better when we provide it with GITHUB_TOKEN.
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- run: just toolchain rustfmt,clippy
- run: just avoid-dev-deps
- run: just lint
pr-info:
outputs:
is-release: ${{ steps.meta.outputs.is-release }}
crate: ${{ steps.meta.outputs.crates-names }}
runs-on: ubuntu-latest
steps:
- id: meta
if: github.event_name == 'pull_request'
uses: cargo-bins/release-meta@v1
with:
event-data: ${{ toJSON(github.event) }}
extract-notes-under: "### Release notes"
release-dry-run:
needs: pr-info
uses: ./.github/workflows/release-cli.yml
if: github.event_name != 'pull_request'
secrets: inherit
with:
info: |
{
"is-release": false,
"crate": "${{ needs.pr-info.outputs.crate }}",
"version": "0.0.0",
"notes": ""
}
CARGO_PROFILE_RELEASE_LTO: no
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 4
detect-targets-build:
needs: changed-files
if: needs.changed-files.outputs.has_detect_target_changed == 'true'
runs-on: ubuntu-latest
env:
CARGO_BUILD_TARGET: x86_64-unknown-linux-musl
steps:
- uses: actions/checkout@v4
- name: Install ${{ env.CARGO_BUILD_TARGET }} target
run: |
rustup target add $CARGO_BUILD_TARGET
pip3 install -r zigbuild-requirements.txt
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
- name: Build detect-targets
run: |
cargo zigbuild --features cli-logging --target $CARGO_BUILD_TARGET
# Set working directory here, otherwise `cargo-zigbuild` would download
# and build quite a few unused dependencies.
working-directory: crates/detect-targets
- uses: actions/upload-artifact@v4
with:
name: detect-targets
path: target/${{ env.CARGO_BUILD_TARGET }}/debug/detect-targets
detect-targets-alpine-test:
runs-on: ubuntu-latest
needs:
- detect-targets-build
- changed-files
if: needs.changed-files.outputs.has_detect_target_changed == 'true'
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: detect-targets
- run: chmod +x detect-targets
- name: Run test in alpine
run: |
docker run --rm \
--mount src="$PWD/detect-targets",dst=/usr/local/bin/detect-targets,type=bind \
--mount src="$PWD/.github/scripts/test-detect-targets-musl.sh",dst=/usr/local/bin/test.sh,type=bind \
alpine /bin/ash -c "apk update && apk add bash && test.sh x86_64-unknown-linux-musl"
detect-targets-ubuntu-test:
needs:
- detect-targets-build
- changed-files
if: needs.changed-files.outputs.has_detect_target_changed == 'true'
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/download-artifact@v4
with:
name: detect-targets
- run: chmod +x detect-targets
- name: Run test in ubuntu
run: |
set -exuo pipefail
[ "$(./detect-targets)" = "$(printf 'x86_64-unknown-linux-gnu\nx86_64-unknown-linux-musl')" ]
detect-targets-more-glibc-test:
needs:
- detect-targets-build
- changed-files
if: needs.changed-files.outputs.has_detect_target_changed == 'true'
strategy:
fail-fast: false
matrix:
container:
- archlinux
- fedora:37
- fedora:38
- fedora:39
- fedora
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: detect-targets
- run: chmod +x detect-targets
- name: Run test
run: |
set -exuo pipefail
[ "$(docker run --rm \
--mount src="$PWD/detect-targets",dst=/usr/local/bin/detect-targets,type=bind \
${{ matrix.container }} detect-targets )" = "$(printf 'x86_64-unknown-linux-gnu\nx86_64-unknown-linux-musl')" ]
detect-targets-nix-test:
needs:
- detect-targets-build
- changed-files
if: needs.changed-files.outputs.has_detect_target_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: detect-targets
- run: chmod +x detect-targets
- name: Run test
run: |
set -exuo pipefail
[ "$(docker run --rm \
--mount src="$PWD/detect-targets",dst=/detect-targets,type=bind \
nixos/nix /detect-targets )" = x86_64-unknown-linux-musl ]
detect-targets-android-check:
needs: changed-files
if: needs.changed-files.outputs.has_detect_target_changed == 'true'
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-linux-android
runs-on: ubuntu-latest
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v4
- name: Add ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: true
- name: Build detect-targets
run: |
cargo check --target ${{ matrix.target }}
# Set working directory here, otherwise `cargo-check` would download
# and build quite a few unused dependencies.
working-directory: crates/detect-targets
# Dummy job to have a stable name for the "all tests pass" requirement
tests-pass:
name: Tests pass
needs:
- unit-tests
- e2e-tests
- cross-check
- lint
- release-dry-run
- detect-targets-build
- detect-targets-alpine-test
- detect-targets-ubuntu-test
- detect-targets-more-glibc-test
- detect-targets-nix-test
- detect-targets-android-check
if: always() # always run even if dependencies fail
runs-on: ubuntu-latest
steps:
# fail if ANY dependency has failed or cancelled
- if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')"
run: exit 1
- run: exit 0

40
.github/workflows/gh-action.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: Test GitHub Action installer
on:
merge_group:
pull_request:
paths:
- install-from-binstall-release.ps1
- install-from-binstall-release.sh
- action.yml
push:
branches:
- main
paths:
- install-from-binstall-release.ps1
- install-from-binstall-release.sh
- action.yml
jobs:
test-gha-installer:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Install cargo-binstall
uses: ./ # uses action.yml from root of the repo
env:
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: Verify successful installation - display cargo-binstall's help
run: cargo binstall --help
- name: Verify successful installation - install example binary using cargo-binstall
run: cargo binstall -y ripgrep
env:
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: Verify successful installation - display help of installed binary
run: rg --help

154
.github/workflows/install-script.yml vendored Normal file
View file

@ -0,0 +1,154 @@
name: Test install-script
on:
merge_group:
pull_request:
types:
- opened
- reopened
- synchronize
paths:
- install-from-binstall-release.ps1
- install-from-binstall-release.sh
- .github/workflows/install-script.yml
push:
branches:
- main
paths:
- install-from-binstall-release.ps1
- install-from-binstall-release.sh
- .github/workflows/install-script.yml
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
unix:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
set_cargo_home: [t, f]
set_binstall_version: ['no', 'with-v', 'without-v']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set `CARGO_HOME`
if: matrix.set_cargo_home == 't'
run: |
CARGO_HOME="$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')"
mkdir -p "${CARGO_HOME}/bin"
echo "CARGO_HOME=$CARGO_HOME" >> "$GITHUB_ENV"
- name: Set `BINSTALL_VERSION`
if: matrix.set_binstall_version != 'no'
env:
STRIP_V: ${{ matrix.set_binstall_version }}
GH_TOKEN: ${{ github.token }}
run: |
# fetch most recent release tag.
BINSTALL_VERSION="$(gh release list --json name --jq '[.[] | select(.name | startswith("v")) | .name] | first')"
if [[ $STRIP_V == 'without-v' ]]; then BINSTALL_VERSION="${BINSTALL_VERSION#v*}"; fi
echo "Setting BINSTALL_VERSION=$BINSTALL_VERSION"
echo "BINSTALL_VERSION=$BINSTALL_VERSION" >> "$GITHUB_ENV"
- name: Install `cargo-binstall` using scripts
run: ./install-from-binstall-release.sh
env:
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: Verify `cargo-binstall` installation
run: |
which cargo-binstall
cargo binstall -vV
windows:
strategy:
fail-fast: false
matrix:
set_cargo_home: [t, f]
set_binstall_version: ['no', 'with-v', 'without-v']
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set `CARGO_HOME`
if: matrix.set_cargo_home == 't'
shell: bash
run: |
CARGO_HOME="$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')"
mkdir -p "${CARGO_HOME}/bin"
echo "CARGO_HOME=$CARGO_HOME" >> "$GITHUB_ENV"
- name: Set `BINSTALL_VERSION`
if: matrix.set_binstall_version != 'no'
shell: bash
env:
GH_TOKEN: ${{ github.token }}
STRIP_V: ${{ matrix.set_binstall_version }}
run: |
# fetch most recent release name.
BINSTALL_VERSION="$(gh release list --json name --jq '[.[] | select(.name | startswith("v")) | .name] | first')"
if [[ $STRIP_V == 'without-v' ]]; then BINSTALL_VERSION="${BINSTALL_VERSION#v*}"; fi
echo "Setting BINSTALL_VERSION=$BINSTALL_VERSION"
echo "BINSTALL_VERSION=$BINSTALL_VERSION" >> "$GITHUB_ENV"
- name: Install `cargo-binstall` using scripts
run: ./install-from-binstall-release.ps1
env:
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: Verify `cargo-binstall` installation
run: cargo binstall -vV
windows-bash:
strategy:
fail-fast: false
matrix:
set_cargo_home: [t, f]
set_binstall_version: ['no', 'with-v', 'without-v']
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set `CARGO_HOME`
if: matrix.set_cargo_home == 't'
shell: bash
run: |
CARGO_HOME="$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')"
mkdir -p "${CARGO_HOME}/bin"
echo "CARGO_HOME=$CARGO_HOME" >> "$GITHUB_ENV"
- name: Set `BINSTALL_VERSION`
if: matrix.set_binstall_version != 'no'
shell: bash
env:
GH_TOKEN: ${{ github.token }}
STRIP_V: ${{ matrix.set_binstall_version }}
run: |
# fetch most recent release name.
BINSTALL_VERSION="$(gh release list --json name --jq '[.[] | select(.name | startswith("v")) | .name] | first')"
if [[ $STRIP_V == 'without-v' ]]; then BINSTALL_VERSION="${BINSTALL_VERSION#v*}"; fi
echo "Setting BINSTALL_VERSION=$BINSTALL_VERSION"
echo "BINSTALL_VERSION=$BINSTALL_VERSION" >> "$GITHUB_ENV"
- name: Install `cargo-binstall` using scripts
shell: bash
run: ./install-from-binstall-release.sh
env:
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: Verify `cargo-binstall` installation
shell: bash
run: cargo binstall -vV

135
.github/workflows/release-cli.yml vendored Normal file
View file

@ -0,0 +1,135 @@
name: Release CLI
on:
workflow_call:
inputs:
info:
description: "The release metadata JSON"
required: true
type: string
CARGO_PROFILE_RELEASE_LTO:
description: "Used to speed up CI"
required: false
type: string
CARGO_PROFILE_RELEASE_CODEGEN_UNITS:
description: "Used to speed up CI"
required: false
type: string
jobs:
tag:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- if: fromJSON(inputs.info).is-release == 'true'
name: Push cli release tag
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ fromJSON(inputs.info).version }}
tag_prefix: v
keygen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cargo-bins/cargo-binstall@main
env:
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: Install binaries required
run: cargo binstall -y --force rsign2 rage
env:
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: Create ephemeral keypair
id: keypair
env:
AGE_KEY_PUBLIC: ${{ vars.AGE_KEY_PUBLIC }}
run: .github/scripts/ephemeral-gen.sh
- uses: actions/upload-artifact@v4
with:
name: minisign.pub
path: minisign.pub
- uses: actions/upload-artifact@v4
with:
name: minisign.key.age
path: minisign.key.age
retention-days: 1
- name: Check that key can be decrypted
env:
AGE_KEY_SECRET: ${{ secrets.AGE_KEY_SECRET }}
shell: bash
run: .github/scripts/ephemeral-sign.sh minisign.pub
package:
needs:
- tag
- keygen
uses: ./.github/workflows/release-packages.yml
secrets: inherit
with:
publish: ${{ inputs.info }}
CARGO_PROFILE_RELEASE_LTO: ${{ inputs.CARGO_PROFILE_RELEASE_LTO }}
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: ${{ inputs.CARGO_PROFILE_RELEASE_CODEGEN_UNITS }}
publish:
needs: package
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: minisign.pub
- run: rustup toolchain install stable --no-self-update --profile minimal
- run: .github/scripts/ephemeral-crate.sh
- if: fromJSON(inputs.info).is-release != 'true' && fromJSON(inputs.info).crate != ''
name: DRY-RUN Publish to crates.io
env:
crate: ${{ fromJSON(inputs.info).crate }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --dry-run -p "$crate" --allow-dirty --no-default-features
- if: fromJSON(inputs.info).is-release != 'true' && fromJSON(inputs.info).crate != ''
name: Upload crate package as artifact
uses: actions/upload-artifact@v4
with:
name: crate-package
path: target/package/*.crate
- if: fromJSON(inputs.info).is-release == 'true'
name: Publish to crates.io
env:
crate: ${{ fromJSON(inputs.info).crate }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p "$crate" --allow-dirty --no-default-features
- if: fromJSON(inputs.info).is-release == 'true'
name: Upload minisign.pub
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: v${{ fromJSON(inputs.info).version }}
tag: v${{ fromJSON(inputs.info).version }}
body: ${{ fromJSON(inputs.info).notes }}
promote: true
file: minisign.pub
- if: fromJSON(inputs.info).is-release == 'true'
name: Make release latest
run: gh release edit v${{ fromJSON(inputs.info).version }} --latest --draft=false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: fromJSON(inputs.info).is-release == 'true'
name: Delete signing key artifact
uses: geekyeggo/delete-artifact@v5
with:
name: minisign.key.age
failOnError: false

202
.github/workflows/release-packages.yml vendored Normal file
View file

@ -0,0 +1,202 @@
name: Build packages for release
on:
workflow_call:
inputs:
publish:
description: "The release metadata JSON"
required: true
type: string
CARGO_PROFILE_RELEASE_LTO:
description: "Used to speed up CI"
required: false
type: string
CARGO_PROFILE_RELEASE_CODEGEN_UNITS:
description: "Used to speed up CI"
required: false
type: string
env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
JUST_TIMINGS: true
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- { o: macos-latest, t: x86_64-apple-darwin }
- { o: macos-latest, t: x86_64h-apple-darwin }
- { o: macos-latest, t: aarch64-apple-darwin, r: true }
- {
o: ubuntu-latest,
t: x86_64-unknown-linux-gnu,
g: 2.17,
r: true,
c: true,
}
- {
o: ubuntu-latest,
t: armv7-unknown-linux-gnueabihf,
g: 2.17,
c: true,
}
- { o: ubuntu-latest, t: aarch64-unknown-linux-gnu, g: 2.17, c: true }
- { o: ubuntu-latest, t: x86_64-unknown-linux-musl, r: true, c: true }
- { o: ubuntu-latest, t: armv7-unknown-linux-musleabihf, c: true }
- { o: ubuntu-latest, t: aarch64-unknown-linux-musl, c: true }
- { o: windows-latest, t: x86_64-pc-windows-msvc, r: true }
- { o: windows-latest, t: aarch64-pc-windows-msvc }
name: ${{ matrix.t }}
runs-on: ${{ matrix.o }}
permissions:
contents: write
env:
CARGO_BUILD_TARGET: ${{ matrix.t }}
GLIBC_VERSION: ${{ matrix.g }}
JUST_USE_CARGO_ZIGBUILD: ${{ matrix.c }}
JUST_FOR_RELEASE: true
JUST_USE_AUDITABLE: true
JUST_ENABLE_H3: true
steps:
- uses: actions/checkout@v4
- name: Override release profile lto settings
if: inputs.CARGO_PROFILE_RELEASE_LTO
run: echo "CARGO_PROFILE_RELEASE_LTO=${{ inputs.CARGO_PROFILE_RELEASE_LTO }}" >> "$GITHUB_ENV"
shell: bash
- name: Override release profile codegen-units settings
if: inputs.CARGO_PROFILE_RELEASE_CODEGEN_UNITS
run: echo "CARGO_PROFILE_RELEASE_CODEGEN_UNITS=${{ inputs.CARGO_PROFILE_RELEASE_CODEGEN_UNITS }}" >> "$GITHUB_ENV"
shell: bash
- uses: ./.github/actions/just-setup
with:
tools: cargo-auditable,rsign2,rage
env:
# just-setup use binstall to install sccache,
# which works better when we provide it with GITHUB_TOKEN.
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN }}
- run: just toolchain rust-src
- uses: actions/download-artifact@v4
with:
name: minisign.pub
- run: just package
- if: runner.os == 'Windows'
run: Get-ChildItem packages/
- if: runner.os != 'Windows'
run: ls -shal packages/
- name: Ensure release binary is runnable
if: "matrix.r"
run: just e2e-tests
env:
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: minisign.key.age
- name: Sign package
env:
AGE_KEY_SECRET: ${{ secrets.AGE_KEY_SECRET }}
shell: bash
run: .github/scripts/ephemeral-sign.sh packages/cargo-binstall-*
- if: fromJSON(inputs.publish).is-release == 'true'
name: Upload to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: v${{ fromJSON(inputs.publish).version }}
tag: v${{ fromJSON(inputs.publish).version }}
body: ${{ fromJSON(inputs.publish).notes }}
file: packages/cargo-binstall-*
file_glob: true
prerelease: true
- if: "fromJSON(inputs.publish).is-release != 'true' || runner.os == 'macOS'"
name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.t }}
path: packages/cargo-binstall-*
retention-days: 1
- name: Upload timings
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.t }}-cargo-timings
path: target/cargo-timings
retention-days: 1
lipo:
needs: build
name: universal-apple-darwin
permissions:
contents: write
runs-on: macos-latest
env:
JUST_FOR_RELEASE: true
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: just,rsign2,rage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: x86_64h-apple-darwin
path: packages/
- uses: actions/download-artifact@v4
with:
name: x86_64-apple-darwin
path: packages/
- uses: actions/download-artifact@v4
with:
name: aarch64-apple-darwin
path: packages/
- uses: actions/download-artifact@v4
with:
name: minisign.pub
- run: ls -shalr packages/
- run: just repackage-lipo
- run: ls -shal packages/
- uses: actions/download-artifact@v4
with:
name: minisign.key.age
- env:
AGE_KEY_SECRET: ${{ secrets.AGE_KEY_SECRET }}
shell: bash
run: .github/scripts/ephemeral-sign.sh packages/cargo-binstall-universal-*
- if: fromJSON(inputs.publish).is-release == 'true'
name: Upload to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: v${{ fromJSON(inputs.publish).version }}
release_name: v${{ fromJSON(inputs.publish).version }}
body: ${{ fromJSON(inputs.publish).notes }}
file: packages/cargo-binstall-universal-*
file_glob: true
overwrite: true
prerelease: true
- if: fromJSON(inputs.publish).is-release != 'true'
name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: universal-apple-darwin
path: packages/cargo-binstall-universal-*
retention-days: 1

27
.github/workflows/release-plz.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: Release-plz
permissions:
pull-requests: write
contents: write
on:
push:
branches:
- main
jobs:
release-plz:
name: Release-plz
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
run: rustup toolchain install stable --no-self-update --profile minimal
- name: Run release-plz
uses: MarcoIeni/release-plz-action@v0.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

47
.github/workflows/release-pr.yml vendored Normal file
View file

@ -0,0 +1,47 @@
name: Open cargo-binstall release PR
on:
workflow_dispatch:
inputs:
version:
description: Version to release
required: true
type: string
default: patch
permissions:
pull-requests: write
jobs:
make-release-pr:
permissions:
id-token: write # Enable OIDC
pull-requests: write
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure toolchain
run: |
rustup toolchain install --profile minimal --no-self-update nightly
rustup default nightly
- uses: chainguard-dev/actions/setup-gitsign@main
- name: Install cargo-release
uses: taiki-e/install-action@v2
with:
tool: cargo-release,cargo-semver-checks
env:
GITHUB_TOKEN: ${{ secrets.CI_RELEASE_TEST_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- run: rustup toolchain install stable --no-self-update --profile minimal
- uses: cargo-bins/release-pr@v2.1.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ inputs.version }}
crate-path: crates/bin
pr-label: release
pr-release-notes: true
pr-template-file: .github/scripts/release-pr-template.ejs
check-semver: false
check-package: true
env:
RUSTFLAGS: --cfg reqwest_unstable

54
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,54 @@
name: On release
on:
pull_request:
types: closed
branches: [main] # target branch of release PRs
jobs:
info:
if: github.event.pull_request.merged
outputs:
is-release: ${{ steps.meta.outputs.is-release }}
crate: ${{ steps.meta.outputs.crates-names }}
version: ${{ steps.meta.outputs.version-actual }}
notes: ${{ steps.meta.outputs.notes }}
runs-on: ubuntu-latest
steps:
- id: meta
uses: cargo-bins/release-meta@v1
with:
event-data: ${{ toJSON(github.event) }}
extract-notes-under: '### Release notes'
release-lib:
if: needs.info.outputs.is-release == 'true' && needs.info.outputs.crate != 'cargo-binstall'
needs: info
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --no-self-update --profile minimal
- name: Push lib release tag
if: needs.info.outputs.crate != 'cargo-binstall'
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ needs.info.outputs.version }}
tag_prefix: ${{ needs.info.outputs.crate }}-v
- name: Publish to crates.io
run: |
cargo publish -p '${{ needs.info.outputs.crate }}'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
release-cli:
if: needs.info.outputs.crate == 'cargo-binstall'
needs: info
uses: ./.github/workflows/release-cli.yml
secrets: inherit
with:
info: ${{ toJSON(needs.info.outputs) }}

View file

@ -1,156 +0,0 @@
name: Rust
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- 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: zip
- 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
- uses: FranzDiebold/github-env-vars-action@v1.2.1
- name: Configure toolchain
uses: actions-rs/toolchain@v1
with:
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
# Caching disabled on macos due to https://github.com/actions/cache/issues/403
if: ${{ matrix.os != 'macos-latest' }}
with:
key: ${{ matrix.os }}-${{ matrix.target }}
path: |
${{ env.HOME }}/.cargo"
target
- name: Install cross toolchain (armv7)
if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }}
run: sudo apt install gcc-arm-linux-gnueabihf
- name: Enable cross compilation (armv7)
if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }}
run: |
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
echo "LZMA_API_STATIC=1" >> $GITHUB_ENV
- name: Build release
uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }} --release
- name: Copy and rename utility
run: cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }}
- name: Create archive (tgz, linux)
if: ${{ matrix.os != 'macos-latest' && matrix.os != 'windows-latest' }}
run: tar -czvf cargo-binstall-${{ matrix.target }}.tgz ${{ matrix.output }}
- name: Create archive (zip, windows)
if: ${{ matrix.os == 'windows-latest' }}
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
uses: actions/upload-artifact@v1
with:
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 }}.${{ matrix.archive }}
asset_name: cargo-binstall-${{ matrix.target }}.${{ matrix.archive }}
tag: ${{ github.ref }}
overwrite: true
test:
name: Test
runs-on: ${{ matrix.os }}
needs: build
strategy:
fail-fast: false
matrix:
include:
- 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: zip
- target: x86_64-pc-windows-msvc
os: windows-latest
output: cargo-binstall.exe
archive: zip
steps:
- uses: actions/checkout@v2
- uses: FranzDiebold/github-env-vars-action@v1.2.1
- uses: actions/download-artifact@v2
with:
name: cargo-binstall-${{ matrix.target }}.${{ matrix.archive }}
- name: "Extract build artifact (tgz, linux)"
if: ${{ matrix.os != 'windows-latest' && matrix.os != 'macos-latest' }}
run: tar -xvf cargo-binstall-${{ matrix.target }}.tgz
- name: "Extract build artifact (zip, windows)"
if: ${{ matrix.os == 'windows-latest' }}
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"
run: ./${{ matrix.output }} cargo-binstall --manifest-path . --no-confirm

32
.github/workflows/shellcheck.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: Shellcheck
on:
merge_group:
pull_request:
types:
- opened
- reopened
- synchronize
paths:
- '**.sh'
push:
branches:
- main
paths:
- '**.sh'
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: fd-find
- name: shellcheck
run: fd -e sh -t f -X shellcheck

View file

@ -0,0 +1,48 @@
name: Upgrade transitive dependencies
on:
workflow_dispatch: # Allow running on-demand
schedule:
- cron: "0 3 * * 5"
jobs:
upgrade:
name: Upgrade & Open Pull Request
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: true
- name: Generate branch name
run: |
git checkout -b deps/transitive/${{ github.run_id }}
- name: Install rust
run: |
rustup toolchain install stable --no-self-update --profile minimal
- name: Upgrade transitive dependencies
run: cargo update --aggressive
- name: Detect changes
id: changes
run:
# This output boolean tells us if the dependencies have actually changed
echo "count=$(git status --porcelain=v1 | wc -l)" >> $GITHUB_OUTPUT
- name: Commit and push changes
# Only push if changes exist
if: steps.changes.outputs.count > 0
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git commit -am "dep: Upgrade transitive dependencies"
git push origin HEAD
- name: Open pull request if needed
if: steps.changes.outputs.count > 0
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --base main --label 'PR: dependencies' --title 'dep: Upgrade transitive dependencies' --body 'Update dependencies' --head $(git branch --show-current)

3
.gitignore vendored
View file

@ -1 +1,4 @@
/target
.DS_Store
/packages
/e2e-tests/cargo-binstall*

5079
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,47 +1,73 @@
[package]
name = "cargo-binstall"
description = "Rust binary package installer for CI integration"
repository = "https://github.com/ryankurte/cargo-binstall"
documentation = "https://docs.rs/cargo-binstall"
version = "0.6.0"
authors = ["ryan <ryan@kurte.nz>"]
edition = "2018"
license = "GPL-3.0"
[workspace]
resolver = "2"
members = [
"crates/atomic-file-install",
"crates/bin",
"crates/binstalk",
"crates/binstalk-bins",
"crates/binstalk-fetchers",
"crates/binstalk-registry",
"crates/binstalk-manifests",
"crates/binstalk-types",
"crates/binstalk-downloader",
"crates/cargo-toml-workspace",
"crates/detect-wasi",
"crates/fs-lock",
"crates/normalize-path",
"crates/detect-targets",
"crates/binstalk-git-repo-api",
]
[profile.release]
opt-level = 3
lto = true
codegen-units = 1
panic = "abort"
strip = "symbols"
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }.{ archive-format }"
bin-dir = "{ bin }{ binary-ext }"
[profile.release.build-override]
inherits = "dev.build-override"
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-fmt = "zip"
[package.metadata.binstall.overrides.x86_64-apple-darwin]
pkg-fmt = "zip"
[profile.release.package."tokio-tar"]
opt-level = "z"
[dependencies]
crates_io_api = "0.8.0"
cargo_metadata = "0.14.1"
tinytemplate = "1.2.1"
tokio = { version = "1.16.1", features = [ "full" ] }
log = "0.4.14"
structopt = "0.3.26"
simplelog = "0.11.2"
anyhow = "1.0.53"
reqwest = { version = "0.11.9", features = [ "rustls-tls" ], default-features = false }
tempdir = "0.3.7"
flate2 = "1.0.22"
tar = "0.4.38"
cargo_toml = "0.11.4"
serde = { version = "1.0.136", features = [ "derive" ] }
strum_macros = "0.23.1"
strum = "0.23.0"
dirs = "4.0.0"
crates-index = "0.18.5"
semver = "1.0.5"
xz2 = "0.1.6"
zip = "0.5.13"
async-trait = "0.1.52"
url = "2.2.2"
[profile.release.package."binstall-tar"]
opt-level = "z"
[dev-dependencies]
env_logger = "0.9.0"
[profile.dev]
opt-level = 0
debug = true
lto = false
debug-assertions = true
overflow-checks = true
codegen-units = 32
# Set the default for dependencies on debug.
[profile.dev.package."*"]
opt-level = 3
[profile.dev.package."tokio-tar"]
opt-level = "z"
[profile.dev.package."binstall-tar"]
opt-level = "z"
[profile.dev.build-override]
inherits = "dev"
debug = false
debug-assertions = false
overflow-checks = false
incremental = false
[profile.check-only]
inherits = "dev"
debug = false
debug-assertions = false
overflow-checks = false
panic = "abort"
[profile.check-only.build-override]
inherits = "check-only"
[profile.check-only.package."*"]
inherits = "check-only"

295
README.md
View file

@ -1,184 +1,177 @@
# Cargo B(inary)Install
`cargo binstall` provides a low-complexity mechanism for installing rust binaries as an alternative to building from source (via `cargo install`) or manually downloading packages. This is intended to work with existing CI artifacts and infrastructure, and with minimal overhead for package maintainers.
To support `binstall` maintainers must add configuration values to `Cargo.toml` to allow the tool to locate the appropriate binary package for a given version and target. See [Supporting Binary Installation](#Supporting-Binary-Installation) for instructions on how to support `binstall` in your projects.
Binstall provides a low-complexity mechanism for installing Rust binaries as an alternative to building from source (via `cargo install`) or manually downloading packages.
This is intended to work with existing CI artifacts and infrastructure, and with minimal overhead for package maintainers.
## Installing
Binstall works by fetching the crate information from `crates.io` and searching the linked `repository` for matching releases and artifacts, falling back to the [quickinstall](https://github.com/alsuren/cargo-quickinstall) third-party artifact host, to alternate targets as supported, and finally to `cargo install` as a last resort.
To get started _using_ `cargo-binstall`, first install the binary (either via `cargo install cargo-binstall` or by downloading a pre-compiled [release](https://github.com/ryankurte/cargo-binstall/releases).
[![CI build](https://github.com/cargo-bins/cargo-binstall/actions/workflows/ci.yml/badge.svg)](https://github.com/cargo-bins/cargo-binstall/actions)
[![GitHub tag](https://img.shields.io/github/tag/cargo-bins/cargo-binstall.svg)](https://github.com/cargo-bins/cargo-binstall)
[![Crates.io](https://img.shields.io/crates/v/cargo-binstall.svg)](https://crates.io/crates/cargo-binstall)
linux x86_64:
```
wget https://github.com/ryankurte/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-gnu.tgz
```
linux armv7:
```
wget https://github.com/ryankurte/cargo-binstall/releases/latest/download/cargo-binstall-armv7-unknown-linux-gnueabihf.tgz
```
macos x86_64:
```
wget https://github.com/ryankurte/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-apple-darwin.zip
```
windows x86_64:
```
wget https://github.com/ryankurte/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-pc-windows-msvc.zip
```
_You may want to [see this page as it was when the latest version was published](https://crates.io/crates/cargo-binstall)._
## Usage
Supported packages can be installed using `cargo binstall NAME` where `NAME` is the crate.io package name.
Package versions and targets may be specified using the `--version` and `--target` arguments respectively, and install directory with `--install-dir` (this defaults to `$HOME/.cargo/bin`, with fall-backs to `$HOME/.bin` if unavailable). For additional options please see `cargo binstall --help`.
```
[garry] ➜ ~ cargo binstall radio-sx128x --version 0.14.1-alpha.5
21:14:09 [INFO] Installing package: 'radio-sx128x'
21:14:13 [INFO] Downloading package from: 'https://github.com/rust-iot/rust-radio-sx128x/releases/download/v0.14.1-alpha.5/sx128x-util-x86_64-apple-darwin.tgz'
21:14:18 [INFO] This will install the following binaries:
21:14:18 [INFO] - sx128x-util (sx128x-util-x86_64-apple-darwin -> /Users/ryankurte/.cargo/bin/sx128x-util-v0.14.1-alpha.5)
21:14:18 [INFO] And create (or update) the following symlinks:
21:14:18 [INFO] - sx128x-util (/Users/ryankurte/.cargo/bin/sx128x-util-v0.14.1-alpha.5 -> /Users/ryankurte/.cargo/bin/sx128x-util)
21:14:18 [INFO] Do you wish to continue? yes/no
yes
21:15:30 [INFO] Installing binaries...
21:15:30 [INFO] Installation complete!
```console
$ cargo binstall radio-sx128x@0.14.1-alpha.5
INFO resolve: Resolving package: 'radio-sx128x@=0.14.1-alpha.5'
WARN The package radio-sx128x v0.14.1-alpha.5 (x86_64-unknown-linux-gnu) has been downloaded from github.com
INFO This will install the following binaries:
INFO - sx128x-util (sx128x-util-x86_64-unknown-linux-gnu -> /home/.cargo/bin/sx128x-util)
Do you wish to continue? [yes]/no
? yes
INFO Installing binaries...
INFO Done in 2.838798298s
```
Binstall aims to be a drop-in replacement for `cargo install` in many cases, and supports similar options.
## Status
For unattended use (e.g. in CI), use the `--no-confirm` flag.
For additional options please see `cargo binstall --help`.
![Build](https://github.com/ryankurte/cargo-binstall/workflows/Rust/badge.svg)
[![GitHub tag](https://img.shields.io/github/tag/ryankurte/cargo-binstall.svg)](https://github.com/ryankurte/cargo-binstall)
[![Crates.io](https://img.shields.io/crates/v/cargo-binstall.svg)](https://crates.io/crates/cargo-binstall)
[![Docs.rs](https://docs.rs/cargo-binstall/badge.svg)](https://docs.rs/cargo-binstall)
## Installation
### Features
### If you already have it
- Manifest discovery
- [x] Fetch crate / manifest via crates.io
- [ ] Fetch crate / manifest via git (/ github / gitlab)
- [x] Use local crate / manifest (`--manifest-path`)
- [x] Fetch build from the [quickinstall](https://github.com/alsuren/cargo-quickinstall) repository
- [ ] Unofficial packaging
- Package formats
- [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)
- [x] Extract specific files from archive (ie. support single archive with multiple platform binaries)
- Security
- [ ] Package signing
- [ ] Package verification
To upgrade cargo-binstall, use `cargo binstall cargo-binstall`!
### Quickly
## Supporting Binary Installation
Here are one-liners for downloading and installing a pre-compiled `cargo-binstall` binary.
`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.
To get started, add a `[package.metadata.binstall]` section to your `Cargo.toml`. As an example, the default configuration would be:
```toml
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }-v{ version }.{ archive-format }"
bin-dir = "{ name }-{ target }-v{ version }/{ bin }{ binary-ext }"
pkg-fmt = "tgz"
```
With the following configuration keys:
- `pkg-url` specifies the package download URL for a given target/version, templated
- `bin-dir` specifies the binary path within the package, templated (with an `.exe` suffix on windows)
- `pkg-fmt` overrides the package format for download/extraction (defaults to: `tgz`)
`pkg-url` and `bin-dir` are templated to support different names for different versions / architectures / etc.
Template variables use the format `{ VAR }` where `VAR` is the name of the variable, with the following variables available:
- `name` is the name of the crate / package
- `version` is the crate version (per `--version` and the crate manifest)
- `repo` is the repository linked in `Cargo.toml`
- `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()
- `archive-format` is the filename extension of the package archive format
- `binary-ext` is the string `.exe` if the `target` is for Windows, or the empty string otherwise
- `format` is a soft-deprecated alias for `archive-format` in `pkg-url`, and for `binary-ext` in `bin-dir`; in the future this may warn at install time.
`pkg-url`, `pkg-fmt` and `bin-dir` 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:
#### Linux and macOS
```
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-fmt = "zip"
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
```
### Defaults
or if you have [homebrew](https://brew.sh/) installed:
By default `binstall` is setup to work with github releases, and expects to find:
- an archive named `{ name }-{ target }-v{ version }.{ archive-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
- containing a folder named `{ name }-{ target }-v{ version }`
- so that prior binary files are not overwritten when manually executing `tar -xvf ...`
- containing binary files in the form `{ bin }{ binary-ext }` (where `bin` is the cargo binary name and `binary-ext` is `.exe` on windows and empty on other platforms)
If your package already uses this approach, you shouldn't need to set anything.
### QuickInstall
[QuickInstall](https://github.com/alsuren/cargo-quickinstall) is an unofficial repository of prebuilt binaries for Crates, and `binstall` has built-in support for it! If your crate is built by QuickInstall, it will already work with `binstall`. However, binaries as configured above take precedence when they exist.
### Examples
For example, the default configuration (as shown above) for a crate called `radio-sx128x` (version: `v0.14.1-alpha.5` on x86_64 linux) would be interpolated to:
- A download URL of `https://github.com/rust-iot/rust-radio-sx128x/releases/download/v0.14.1-alpha.5/rust-radio-sx128x-x86_64-unknown-linux-gnu-v0.14.1-alpha.5.tgz`
- Containing a single binary file `rust-radio-sx128x-x86_64-unknown-linux-gnu-v0.14.1-alpha.5/rust-radio-x86_64-unknown-linux-gnu`
- Installed to`$HOME/.cargo/bin/rust-radio-sx128x-v0.14.1-alpha.5`
- With a symlink from `$HOME/.cargo/bin/rust-radio-sx128x`
#### If the package name does not match the crate name
As is common with libraries / utilities (and the `radio-sx128x` example), this can be overridden by specifying the `pkg-url`:
```toml
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/sx128x-util-{ target }-v{ version }.{ archive-format }"
```
brew install cargo-binstall
```
Which provides a download URL of: `https://github.com/rust-iot/rust-radio-sx128x/releases/download/v0.14.1-alpha.5/sx128x-util-x86_64-unknown-linux-gnu-v0.14.1-alpha.5.tgz`
#### Windows
#### If the package structure differs from the default
Were the package to contain binaries in the form `name-target[.exe]`, this could be overridden using the `bin-dir` key:
```toml
[package.metadata.binstall]
bin-dir = "{ bin }-{ target }{ binary-ext }"
```
Set-ExecutionPolicy Unrestricted -Scope Process; iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content
```
Which provides a binary path of: `sx128x-util-x86_64-unknown-linux-gnu[.exe]`. It is worth noting that binary names are inferred from the crate, so long as cargo builds them this _should_ just work.
### Manually
Download the relevant package for your system below, unpack it, and move the `cargo-binstall` executable into `$HOME/.cargo/bin`:
| OS | Arch | URL |
| ------- | ------- | ------------------------------------------------------------ |
| Linux | x86\_64 | https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz |
| Linux | armv7 | https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-armv7-unknown-linux-musleabihf.tgz |
| Linux | arm64 | https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-aarch64-unknown-linux-musl.tgz |
| Mac | Intel | https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-apple-darwin.zip |
| Mac | Apple Silicon | https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-aarch64-apple-darwin.zip |
| Mac | Universal<br>(both archs) | https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-universal-apple-darwin.zip |
| Windows | Intel/AMD | https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-pc-windows-msvc.zip |
| Windows | ARM 64 | https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-aarch64-pc-windows-msvc.zip |
### From source
With a recent [Rust](https://rustup.rs) installed:
```
cargo install cargo-binstall
```
### In GitHub Actions
We provide a first-party, minimal action that installs the latest version of Binstall:
```yml
- uses: cargo-bins/cargo-binstall@main
```
For more features, we recommend the excellent [taiki-e/install-action](https://github.com/marketplace/actions/install-development-tools), which has dedicated support for selected tools and uses Binstall for everything else.
## Companion tools
These are useful *third-party* tools which work well with Binstall.
### [`cargo-update`](https://github.com/nabijaczleweli/cargo-update)
While you can upgrade crates explicitly by running `cargo binstall` again, `cargo-update` takes care of updating all tools as needed.
It automatically uses Binstall to install the updates if it is present.
### [`cargo-run-bin`](https://github.com/dustinblackman/cargo-run-bin)
Binstall and `cargo install` both install tools globally by default, which is fine for system-wide tools.
When installing tooling for a project, however, you may prefer to both scope the tools to that project and control their versions in code.
That's where `cargo-run-bin` comes in, with a dedicated section in your Cargo.toml and a short cargo subcommand.
When Binstall is available, it installs from binary whenever possible... and you can even manage Binstall itself with `cargo-run-bin`!
## Unsupported crates
Binstall is generally smart enough to auto-detect artifacts in most situations.
However, if a package fails to install, you can manually specify the `pkg-url`, `bin-dir`, and `pkg-fmt` as needed at the command line, with values as documented in [SUPPORT.md](https://github.com/cargo-bins/cargo-binstall/blob/main/SUPPORT.md).
```console
$ cargo-binstall \
--pkg-url="{ repo }/releases/download/{ version }/{ name }-{ version }-{ target }.{ archive-format }" \
--pkg-fmt="txz" \
crate_name
```
Maintainers wanting to make their users' life easier can add [explicit Binstall metadata](https://github.com/cargo-bins/cargo-binstall/blob/main/SUPPORT.md) to `Cargo.toml` to locate the appropriate binary package for a given version and target.
## Signatures
We have initial, limited [support](https://github.com/cargo-bins/cargo-binstall/blob/main/SIGNING.md) for maintainers to specify a signing public key and where to find package signatures.
With this enabled, Binstall will download and verify signatures for that package.
You can use `--only-signed` to refuse to install packages if they're not signed.
If you like to live dangerously (please don't use this outside testing), you can use `--skip-signatures` to disable checking or even downloading signatures at all.
## FAQ
- Why use this?
- Because `wget`-ing releases is frustrating, `cargo install` takes a not inconsequential portion of forever on constrained devices,
and often putting together actual _packages_ is overkill.
- Why use the cargo manifest?
- Crates already have these, and they already contain a significant portion of the required information.
Also there's this great and woefully underused (imo) `[package.metadata]` field.
- Is this secure?
- Yes and also no? We're not (yet? #1) doing anything to verify the CI binaries are produced by the right person / organisation.
However, we're pulling data from crates.io and the cargo manifest, both of which are _already_ trusted entities, and this is
functionally a replacement for `curl ... | bash` or `wget`-ing the same files, so, things can be improved but it's also sorta moot
### Why use this?
Because `wget`-ing releases is frustrating, `cargo install` takes a not inconsequential portion of forever on constrained devices, and often putting together actual _packages_ is overkill.
### Why use the cargo manifest?
Crates already have these, and they already contain a significant portion of the required information.
Also, there's this great and woefully underused (IMO) `[package.metadata]` field.
### Is this secure?
Yes and also no?
We have [initial support](https://github.com/cargo-bins/cargo-binstall/blob/main/SIGNING.md) for verifying signatures, but not a lot of the ecosystem produces signatures at the moment.
See [#1](https://github.com/cargo-bins/cargo-binstall/issues/1) to discuss more on this.
We always pull the metadata from crates.io over HTTPS, and verify the checksum of the crate tar.
We also enforce using HTTPS with TLS >= 1.2 for the actual download of the package files.
Compared to something like a `curl ... | sh` script, we're not running arbitrary code, but of course the crate you're downloading a package for might itself be malicious!
### What do the error codes mean?
You can find a full description of errors including exit codes here: <https://docs.rs/binstalk/latest/binstalk/errors/enum.BinstallError.html>
### Are debug symbols available?
Yes!
Extra pre-built packages with a `.full` suffix are available and contain split debuginfo, documentation files, and extra binaries like the `detect-wasi` utility.
## Telemetry collection
Some crate installation strategies may collect anonymized usage statistics by default.
Currently, only the name of the crate to be installed, its version, the target platform triple, and the collecting user agent are sent to endpoints under the `https://warehouse-clerk-tmp.vercel.app/api/crate` URL when the `quickinstall` artifact host is used.
The maintainers of the `quickinstall` project use this data to determine which crate versions are most worthwhile to build and host.
The aggregated collected telemetry is publicly accessible at <https://warehouse-clerk-tmp.vercel.app/api/stats>.
Should you be interested on it, the backend code for these endpoints can be found at <https://github.com/alsuren/warehouse-clerk-tmp/tree/master/pages/api>.
If you prefer not to participate in this data collection, you can opt out by any of the following methods:
- Setting the `--disable-telemetry` flag in the command line interface.
- Setting the `BINSTALL_DISABLE_TELEMETRY` environment variable to `true`.
- Disabling the `quickinstall` strategy with `--disable-strategy quick-install`, or if specifying a list of strategies to use with `--strategy`, avoiding including `quickinstall` in that list.
- Adding `quick-install` to the `disabled-strategies` configuration key in the crate metadata (refer to [the related support documentation](SUPPORT.md#support-for-cargo-binstall) for more details).
---
If you have ideas / contributions or anything is not working the way you expect (in which case, please include an output with `--log-level debug`) and feel free to open an issue or PR.
If you have ideas/contributions or anything is not working the way you expect (in which case, please include an output with `--log-level debug`) and feel free to open an issue or PR.

112
SIGNING.md Normal file
View file

@ -0,0 +1,112 @@
# Signature support
Binstall supports verifying signatures of downloaded files.
At the moment, only one algorithm is supported, but this is expected to improve as time goes.
This feature requires adding to the Cargo.toml metadata: no autodiscovery here!
## Minimal example
Generate a [minisign](https://jedisct1.github.io/minisign/) keypair:
```console
minisign -G -W -p signing.pub -s signing.key
# or with rsign2:
rsign generate -W -p signing.pub -s signing.key
```
In your Cargo.toml, put:
```toml
[package.metadata.binstall.signing]
algorithm = "minisign"
pubkey = "RWRnmBcLmQbXVcEPWo2OOKMI36kki4GiI7gcBgIaPLwvxe14Wtxm9acX"
```
Replace the value of `pubkey` with the public key in your `signing.pub`.
Save the `signing.key` as a secret in your CI, then use it when building packages:
```console
tar cvf package-name.tar.zst your-files # or however
minisign -S -W -s signing.key -x package-name.tar.zst.sig -m package-name.tar.zst
# or with rsign2:
rsign sign -W -s signing.key -x package-name.tar.zst.sig package-name.tar.zst
```
Upload both your package and the matching `.sig`.
Now when binstall downloads your packages, it will also download the `.sig` file and use the `pubkey` in the Cargo.toml to verify the signature.
If the signature has a trusted comment, it will print it at install time.
By default, `minisign` and `rsign2` prompt for a password; above we disable this with `-W`.
While you _can_ set a password, we recommend instead using [age](https://github.com/FiloSottile/age) (or the Rust version [rage](https://github.com/str4d/rage)) to separately encrypt the key, which we find is much better for automation.
```console
rage-keygen -o age.key
Public key: age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p
rage -r age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p -o signing.key.age signing.key
rage -d -i age.key -o signing.key signing.key.age
```
For just-in-time or "keyless" schemes, securely generating and passing the ephemeral key to other jobs or workflows presents subtle issues.
`cargo-binstall` has an implementation in [its own release process][`release.yml`] that you can use as example.
[`expect`]: https://linux.die.net/man/1/expect
[`release.yml`]: https://github.com/cargo-bins/cargo-binstall/blob/main/.github/workflows/release.yml
## Reference
- `algorithm`: required, see below.
- `pubkey`: required, must be the public key.
- `file`: optional, a template to specify the URL of the signature file. Defaults to `{ url }.sig` where `{ url }` is the download URL of the package.
### Minisign
`algorithm` must be `"minisign"`.
The legacy signature format is not supported.
The `pubkey` must be in the same format as minisign generates.
It may or may not include the untrusted comment; it's ignored by Binstall so we recommend not.
## Just-in-time signing
To reduce the risk of a key being stolen, this scheme supports just-in-time or "keyless" signing.
The idea is to generate a keypair when releasing, use it for signing the packages, save the key in the Cargo.toml before publishing to a registry, and then discard the private key when it's done.
That way, there's no key to steal nor to store securely, and every release is signed by a different key.
And because crates.io is immutable, it's impossible to overwrite the key.
There is one caveat to keep in mind: with the scheme as described above, Binstalling with `--git` may not work:
- If the Cargo.toml in the source contains a partially-filled `[...signing]` section, Binstall will fail.
- If the section contains a different key than the ephemeral one used to sign the packages, Binstall will refuse to install what it sees as corrupt packages.
- If the section is missing entirely, Binstall will work, but of course signatures won't be checked.
The solution here is either:
- Commit the Cargo.toml with the ephemeral public key to the repo when publishing.
- Omit the `[...signing]` section in the source, and write the entire section on publish instead of just filling in the `pubkey`; signatures won't be checked for `--git` installs. Binstall uses this approach.
- Instruct your users to use `--skip-signatures` if they want to install with `--git`.
## Why not X? (Sigstore, GPG, signify, with SSH keys, ...)
We're open to pull requests adding algorithms!
We're especially interested in Sigstore for a better implementation of "just-in-time" signing (which it calls "keyless").
We chose minisign as the first supported algorithm as it's lightweight, fairly popular, and has zero options to choose from.
## There's a competing project that does package signature verification differently!
[Tell us about it](https://github.com/cargo-bins/cargo-binstall/issues/1)!
We're not looking to fracture the ecosystem here, and will gladly implement support if something exists already.
We'll also work with others in the space to eventually formalise this beyond Binstall, for example around the [`dist-manifest.json`](https://crates.io/crates/cargo-dist-schema) metadata format.
## What's the relationship to crate/registry signing?
There isn't one.
Crate signing is something we're also interested in, and if/when it materialises we'll add support in Binstall for the bits that concern us, but by nature package signing is not related to (source) crate signing.

181
SUPPORT.md Normal file
View file

@ -0,0 +1,181 @@
# Support for `cargo binstall`
`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.
To get started, check the [default](#Defaults) first, only add a `[package.metadata.binstall]` section
to your `Cargo.toml` if the default does not work for you.
As an example, the configuration would be like this:
```toml
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }-v{ version }{ archive-suffix }"
bin-dir = "{ name }-{ target }-v{ version }/{ bin }{ binary-ext }"
pkg-fmt = "tgz"
disabled-strategies = ["quick-install", "compile"]
```
With the following configuration keys:
- `pkg-url` specifies the package download URL for a given target/version, templated
- `bin-dir` specifies the binary path within the package, templated (with an `.exe` suffix on windows)
- `pkg-fmt` overrides the package format for download/extraction (defaults to: `tgz`), check [the documentation](https://docs.rs/binstalk-types/latest/binstalk_types/cargo_toml_binstall/enum.PkgFmt.html) for all supported formats.
- `disabled-strategies` to disable specific strategies (e.g. `crate-meta-data` for trying to find pre-built on your repository,
`quick-install` for pre-built from third-party cargo-bins/cargo-quickinstall, `compile` for falling back to `cargo-install`)
for your crate (defaults to empty array).
If `--strategies` is passed on the command line, then the `disabled-strategies` in `package.metadata` will be ignored.
Otherwise, the `disabled-strategies` in `package.metadata` and `--disable-strategies` will be merged.
`pkg-url` and `bin-dir` are templated to support different names for different versions / architectures / etc.
Template variables use the format `{ VAR }` where `VAR` is the name of the variable,
`\{` for literal `{`, `\}` for literal `}` and `\\` for literal `\`,
with the following variables available:
- `name` is the name of the crate/package
- `version` is the crate version (per `--version` and the crate manifest)
- `repo` is the repository linked in `Cargo.toml`
- `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()
- `archive-suffix` is the filename extension of the package archive format that includes the prefix `.`, e.g. `.tgz` for tgz or `.exe`/`""` for bin.
- `archive-format` is the soft-deprecated filename extension of the package archive format that does not include the prefix `.`, e.g. `tgz` for tgz or `exe`/`""` for bin.
- `binary-ext` is the string `.exe` if the `target` is for Windows, or the empty string otherwise
- `format` is a soft-deprecated alias for `archive-format` in `pkg-url`, and alias for `binary-ext` in `bin-dir`; in the future, this may warn at install time.
- `target-family`: Operating system of the target from [`target_lexicon::OperatingSystem`]
- `target-arch`: Architecture of the target, `universal` on `{universal, universal2}-apple-darwin`,
otherwise from [`target_lexicon::Architecture`]
- `target-libc`: ABI environment of the target from [`target_lexicon::Environment`]
- `target-vendor`: Vendor of the target from [`target_lexicon::Vendor`]
[`target_lexicon::OperatingSystem`]: https://docs.rs/target-lexicon/latest/target_lexicon/enum.OperatingSystem.html
[`target_lexicon::Architecture`]: https://docs.rs/target-lexicon/latest/target_lexicon/enum.Architecture.html
[`target_lexicon::Environment`]: https://docs.rs/target-lexicon/latest/target_lexicon/enum.Environment.html
[`target_lexicon::Vendor`]: https://docs.rs/target-lexicon/latest/target_lexicon/enum.Vendor.html
`pkg-url`, `pkg-fmt` and `bin-dir` 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]
pkg-fmt = "zip"
```
### Defaults
By default, `binstall` will try all supported package formats and would do the same for `bin-dir`.
It will first extract the archives, then iterate over the following list, finding the first dir
that exists:
- `{ name }-{ target }-v{ version }`
- `{ name }-{ target }-{ version }`
- `{ name }-{ version }-{ target }`
- `{ name }-v{ version }-{ target }`
- `{ name }-{ target }`
- `{ name }-{ version }`
- `{ name }-v{ version }`
- `{ name }`
Then it will concat the dir with `"{ bin }{ binary-ext }"` and use that as the final `bin-dir`.
`name` here is name of the crate, `bin` is the cargo binary name and `binary-ext` is `.exe`
on windows and empty on other platforms).
The default value for `pkg-url` will depend on the repository of the package.
It is set up to work with GitHub releases, GitLab releases, bitbucket downloads
and source forge downloads.
If your package already uses any of these URLs, you shouldn't need to set anything.
The URLs are derived from a set of filenames and a set of paths, which are
"multiplied together": every filename appended to every path. The filenames
are:
- `{ name }-{ target }-{ version }{ archive-suffix }`
- `{ name }-{ target }-v{ version }{ archive-suffix }`
- `{ name }-{ version }-{ target }{ archive-suffix }`
- `{ name }-v{ version }-{ target }{ archive-suffix }`
- `{ name }_{ target }_{ version }{ archive-suffix }`
- `{ name }_{ target }_v{ version }{ archive-suffix }`
- `{ name }_{ version }_{ target }{ archive-suffix }`
- `{ name }_v{ version }_{ target }{ archive-suffix }`
- `{ name }-{ target }{ archive-suffix }` ("versionless")
- `{ name }_{ target }{ archive-suffix }` ("versionless")
The paths are:
#### for GitHub
- `{ repo }/releases/download/{ version }/`
- `{ repo }/releases/download/v{ version }/`
#### for GitLab
- `{ repo }/-/releases/{ version }/downloads/binaries/`
- `{ repo }/-/releases/v{ version }/downloads/binaries/`
Note that this uses the [Permanent links to release assets][gitlab-permalinks]
feature of GitLab EE: it requires you to create an asset as a link with a
`filepath`, which, as of writing, can only be set using GitLab's API.
[gitlab-permalinks]: https://docs.gitlab.com/ee/user/project/releases/index.html#permanent-links-to-latest-release-assets
#### for BitBucket
- `{ repo }/downloads/`
Binaries must be uploaded to the project's "Downloads" page on BitBucket.
Also note that as there are no per-release downloads, the "versionless"
filename is not considered here.
#### for SourceForge
- `{ repo }/files/binaries/{ version }`
- `{ repo }/files/binaries/v{ version }`
The URLs also have `/download` appended as per SourceForge's schema.
Binary must be uploaded to the "File" page of your project, under the directory
`binaries/v{ version }`.
#### Others
For all other situations, `binstall` does not provide a default `pkg-url` and
you need to manually specify it.
### QuickInstall
[QuickInstall](https://github.com/alsuren/cargo-quickinstall) is an unofficial repository of prebuilt binaries for Crates, and `binstall` has built-in support for it! If your crate is built by QuickInstall, it will already work with `binstall`. However, binaries as configured above take precedence when they exist.
### Examples
For example, the default configuration (as shown above) for a crate called `radio-sx128x` (version: `v0.14.1-alpha.5` on x86\_64 linux) would be interpolated to:
- A download URL of `https://github.com/rust-iot/rust-radio-sx128x/releases/download/v0.14.1-alpha.5/rust-radio-sx128x-x86_64-unknown-linux-gnu-v0.14.1-alpha.5.tgz`
- Containing a single binary file `rust-radio-sx128x-x86_64-unknown-linux-gnu-v0.14.1-alpha.5/rust-radio-x86_64-unknown-linux-gnu`
- Installed to`$HOME/.cargo/bin/rust-radio-sx128x-v0.14.1-alpha.5`
- With a symlink from `$HOME/.cargo/bin/rust-radio-sx128x`
#### If the package name does not match the crate name
As is common with libraries/utilities (and the `radio-sx128x` example), this can be overridden by specifying the `pkg-url`:
```toml
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/sx128x-util-{ target }-v{ version }{ archive-suffix }"
```
Which provides a download URL of `https://github.com/rust-iot/rust-radio-sx128x/releases/download/v0.14.1-alpha.5/sx128x-util-x86_64-unknown-linux-gnu-v0.14.1-alpha.5.tgz`
#### If the package structure differs from the default
Were the package to contain binaries in the form `name-target[.exe]`, this could be overridden using the `bin-dir` key:
```toml
[package.metadata.binstall]
bin-dir = "{ bin }-{ target }{ binary-ext }"
```
Which provides a binary path of: `sx128x-util-x86_64-unknown-linux-gnu[.exe]`. It is worth noting that binary names are inferred from the crate, so long as cargo builds them this _should_ just work.

14
action.yml Normal file
View file

@ -0,0 +1,14 @@
name: 'Install cargo-binstall'
description: 'Install the latest version of cargo-binstall tool'
runs:
using: composite
steps:
- name: Install cargo-binstall
if: runner.os != 'Windows'
shell: sh
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- name: Install cargo-binstall
if: runner.os == 'Windows'
run: Set-ExecutionPolicy Unrestricted -Scope Process; iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content
shell: powershell

23
cleanup-cache.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
set -uxo pipefail
REPO="${REPO?}"
BRANCH="${BRANCH?}"
while true; do
echo "Fetching list of cache key for $BRANCH"
cacheKeysForPR="$(gh actions-cache list -R "$REPO" -B "$BRANCH" -L 100 | cut -f 1)"
if [ -z "$cacheKeysForPR" ]; then
break
fi
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
echo Removing "$cacheKey"
gh actions-cache delete "$cacheKey" -R "$REPO" -B "$BRANCH" --confirm
done
done
echo "Done cleaning up $BRANCH"

View file

@ -0,0 +1,44 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [1.0.11](https://github.com/cargo-bins/cargo-binstall/compare/atomic-file-install-v1.0.10...atomic-file-install-v1.0.11) - 2025-03-19
### Other
- *(deps)* bump windows from 0.60.0 to 0.61.1 in the deps group across 1 directory ([#2097](https://github.com/cargo-bins/cargo-binstall/pull/2097))
## [1.0.10](https://github.com/cargo-bins/cargo-binstall/compare/atomic-file-install-v1.0.9...atomic-file-install-v1.0.10) - 2025-02-22
### Other
- *(deps)* bump windows from 0.59.0 to 0.60.0 in the deps group across 1 directory (#2063)
## [1.0.9](https://github.com/cargo-bins/cargo-binstall/compare/atomic-file-install-v1.0.8...atomic-file-install-v1.0.9) - 2025-01-19
### Other
- update Cargo.lock dependencies
## [1.0.8](https://github.com/cargo-bins/cargo-binstall/compare/atomic-file-install-v1.0.7...atomic-file-install-v1.0.8) - 2025-01-13
### Other
- update Cargo.lock dependencies
## [1.0.7](https://github.com/cargo-bins/cargo-binstall/compare/atomic-file-install-v1.0.6...atomic-file-install-v1.0.7) - 2025-01-11
### Other
- *(deps)* bump the deps group with 3 updates (#2015)
## [1.0.6](https://github.com/cargo-bins/cargo-binstall/compare/atomic-file-install-v1.0.5...atomic-file-install-v1.0.6) - 2024-11-18
### Other
- Upgrade transitive dependencies ([#1969](https://github.com/cargo-bins/cargo-binstall/pull/1969))

View file

@ -0,0 +1,18 @@
[package]
name = "atomic-file-install"
version = "1.0.11"
edition = "2021"
description = "For atomically installing a file or a symlink."
repository = "https://github.com/cargo-bins/cargo-binstall"
documentation = "https://docs.rs/atomic-install"
authors = ["Jiahao XU <Jiahao_XU@outlook.com>"]
license = "Apache-2.0 OR MIT"
rust-version = "1.65.0"
[dependencies]
reflink-copy = "0.1.15"
tempfile = "3.5.0"
tracing = "0.1.39"
[target.'cfg(windows)'.dependencies]
windows = { version = "0.61.1", features = ["Win32_Storage_FileSystem", "Win32_Foundation"] }

View file

@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

View file

@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,219 @@
//! Atomically install a regular file or a symlink to destination,
//! can be either noclobber (fail if destination already exists) or
//! replacing it atomically if it exists.
use std::{fs, io, path::Path};
use reflink_copy::reflink_or_copy;
use tempfile::{NamedTempFile, TempPath};
use tracing::{debug, warn};
#[cfg(unix)]
use std::os::unix::fs::symlink as symlink_file_inner;
#[cfg(windows)]
use std::os::windows::fs::symlink_file as symlink_file_inner;
fn parent(p: &Path) -> io::Result<&Path> {
p.parent().ok_or_else(|| {
io::Error::new(
io::ErrorKind::InvalidData,
format!("`{}` does not have a parent", p.display()),
)
})
}
fn copy_to_tempfile(src: &Path, dst: &Path) -> io::Result<NamedTempFile> {
let parent = parent(dst)?;
debug!("Creating named tempfile at '{}'", parent.display());
let tempfile = NamedTempFile::new_in(parent)?;
debug!(
"Copying from '{}' to '{}'",
src.display(),
tempfile.path().display()
);
fs::remove_file(tempfile.path())?;
// src and dst is likely to be on the same filesystem.
// Uses reflink if the fs support it, or fallback to
// `fs::copy` if it doesn't support it or it is not on the
// same filesystem.
reflink_or_copy(src, tempfile.path())?;
debug!("Retrieving permissions of '{}'", src.display());
let permissions = src.metadata()?.permissions();
debug!(
"Setting permissions of '{}' to '{permissions:#?}'",
tempfile.path().display()
);
tempfile.as_file().set_permissions(permissions)?;
Ok(tempfile)
}
/// Install a file, this fails if the `dst` already exists.
///
/// This is a blocking function, must be called in `block_in_place` mode.
pub fn atomic_install_noclobber(src: &Path, dst: &Path) -> io::Result<()> {
debug!(
"Attempting to rename from '{}' to '{}'.",
src.display(),
dst.display()
);
let tempfile = copy_to_tempfile(src, dst)?;
debug!(
"Persisting '{}' to '{}', fail if dst already exists",
tempfile.path().display(),
dst.display()
);
tempfile.persist_noclobber(dst)?;
Ok(())
}
/// Atomically install a file, this atomically replace `dst` if it exists.
///
/// This is a blocking function, must be called in `block_in_place` mode.
pub fn atomic_install(src: &Path, dst: &Path) -> io::Result<()> {
debug!(
"Attempting to atomically rename from '{}' to '{}'",
src.display(),
dst.display()
);
if let Err(err) = fs::rename(src, dst) {
warn!("Attempting at atomic rename failed: {err}, fallback to other methods.");
#[cfg(windows)]
{
match win::replace_file(src, dst) {
Ok(()) => {
debug!("ReplaceFileW succeeded.");
return Ok(());
}
Err(err) => {
warn!("ReplaceFileW failed: {err}, fallback to using tempfile plus rename")
}
}
}
// src and dst is not on the same filesystem/mountpoint.
// Fallback to creating NamedTempFile on the parent dir of
// dst.
persist(copy_to_tempfile(src, dst)?.into_temp_path(), dst)?;
} else {
debug!("Attempting at atomically succeeded.");
}
Ok(())
}
/// Create a symlink at `link` to `dest`, this fails if the `link`
/// already exists.
///
/// This is a blocking function, must be called in `block_in_place` mode.
pub fn atomic_symlink_file_noclobber(dest: &Path, link: &Path) -> io::Result<()> {
match symlink_file_inner(dest, link) {
Ok(_) => Ok(()),
#[cfg(windows)]
// Symlinks on Windows are disabled in some editions, so creating one is unreliable.
// Fallback to copy if it fails.
Err(_) => atomic_install_noclobber(dest, link),
#[cfg(not(windows))]
Err(err) => Err(err),
}
}
/// Atomically create a symlink at `link` to `dest`, this atomically replace
/// `link` if it already exists.
///
/// This is a blocking function, must be called in `block_in_place` mode.
pub fn atomic_symlink_file(dest: &Path, link: &Path) -> io::Result<()> {
let parent = parent(link)?;
debug!("Creating tempPath at '{}'", parent.display());
let temp_path = NamedTempFile::new_in(parent)?.into_temp_path();
// Remove this file so that we can create a symlink
// with the name.
fs::remove_file(&temp_path)?;
debug!(
"Creating symlink '{}' to file '{}'",
temp_path.display(),
dest.display()
);
match symlink_file_inner(dest, &temp_path) {
Ok(_) => persist(temp_path, link),
#[cfg(windows)]
// Symlinks on Windows are disabled in some editions, so creating one is unreliable.
// Fallback to copy if it fails.
Err(_) => atomic_install(dest, link),
#[cfg(not(windows))]
Err(err) => Err(err),
}
}
fn persist(temp_path: TempPath, to: &Path) -> io::Result<()> {
debug!("Persisting '{}' to '{}'", temp_path.display(), to.display());
match temp_path.persist(to) {
Ok(()) => Ok(()),
#[cfg(windows)]
Err(tempfile::PathPersistError {
error,
path: temp_path,
}) => {
warn!(
"Failed to persist symlink '{}' to '{}': {error}, fallback to ReplaceFileW",
temp_path.display(),
to.display(),
);
win::replace_file(&temp_path, to).map_err(io::Error::from)
}
#[cfg(not(windows))]
Err(err) => Err(err.into()),
}
}
#[cfg(windows)]
mod win {
use std::{os::windows::ffi::OsStrExt, path::Path};
use windows::{
core::{Error, PCWSTR},
Win32::Storage::FileSystem::{ReplaceFileW, REPLACE_FILE_FLAGS},
};
pub(super) fn replace_file(src: &Path, dst: &Path) -> Result<(), Error> {
let mut src: Vec<_> = src.as_os_str().encode_wide().collect();
let mut dst: Vec<_> = dst.as_os_str().encode_wide().collect();
// Ensure it is terminated with 0
src.push(0);
dst.push(0);
// SAFETY: We use it according its doc
// https://learn.microsoft.com/en-nz/windows/win32/api/winbase/nf-winbase-replacefilew
//
// NOTE that this function is available since windows XP, so we don't need to
// lazily load this function.
unsafe {
ReplaceFileW(
PCWSTR::from_raw(dst.as_ptr()), // lpreplacedfilename
PCWSTR::from_raw(src.as_ptr()), // lpreplacementfilename
PCWSTR::null(), // lpbackupfilename, null for no backup file
REPLACE_FILE_FLAGS(0), // dwreplaceflags
None, // lpexclude, unused
None, // lpreserved, unused
)
}
}
}

90
crates/bin/Cargo.toml Normal file
View file

@ -0,0 +1,90 @@
[package]
name = "cargo-binstall"
description = "Binary installation for rust projects"
repository = "https://github.com/cargo-bins/cargo-binstall"
documentation = "https://docs.rs/cargo-binstall"
version = "1.12.3"
rust-version = "1.79.0"
authors = ["ryan <ryan@kurte.nz>"]
edition = "2021"
license = "GPL-3.0-only"
readme = "../../README.md"
# These MUST remain even if they're not needed in recent versions because
# OLD versions use them to upgrade
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }.{ archive-format }"
bin-dir = "{ bin }{ binary-ext }"
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-fmt = "zip"
[package.metadata.binstall.overrides.x86_64-apple-darwin]
pkg-fmt = "zip"
[dependencies]
atomic-file-install = { version = "1.0.11", path = "../atomic-file-install" }
binstalk = { path = "../binstalk", version = "0.28.31", default-features = false }
binstalk-manifests = { path = "../binstalk-manifests", version = "0.15.28" }
clap = { version = "4.5.3", features = ["derive", "env", "wrap_help"] }
clap-cargo = "0.15.2"
compact_str = "0.9.0"
dirs = "6.0.0"
file-format = { version = "0.26.0", default-features = false }
home = "0.5.9"
log = { version = "0.4.22", features = ["std"] }
miette = "7.0.0"
mimalloc = { version = "0.1.39", default-features = false, optional = true }
once_cell = "1.18.0"
semver = "1.0.17"
strum = "0.27.0"
strum_macros = "0.27.0"
supports-color = "3.0.0"
tempfile = "3.5.0"
tokio = { version = "1.44.0", features = ["rt-multi-thread", "signal"], default-features = false }
tracing = { version = "0.1.39", default-features = false }
tracing-core = "0.1.32"
tracing-log = { version = "0.2.0", default-features = false }
tracing-subscriber = { version = "0.3.17", features = ["fmt", "json", "ansi"], default-features = false }
zeroize = "1.8.1"
[build-dependencies]
embed-resource = "3.0.1"
vergen = { version = "8.2.7", features = ["build", "cargo", "git", "gitcl", "rustc"] }
[features]
default = ["static", "rustls", "trust-dns", "fancy-no-backtrace", "zstd-thin", "git"]
git = ["binstalk/git"]
git-max-perf = ["binstalk/git-max-perf"]
mimalloc = ["dep:mimalloc"]
static = ["binstalk/static"]
pkg-config = ["binstalk/pkg-config"]
zlib-ng = ["binstalk/zlib-ng"]
zlib-rs = ["binstalk/zlib-rs"]
rustls = ["binstalk/rustls"]
native-tls = ["binstalk/native-tls"]
trust-dns = ["binstalk/trust-dns"]
# Experimental HTTP/3 client, this would require `--cfg reqwest_unstable`
# to be passed to `rustc`.
http3 = ["binstalk/http3"]
zstd-thin = ["binstalk/zstd-thin"]
cross-lang-fat-lto = ["binstalk/cross-lang-fat-lto"]
fancy-no-backtrace = ["miette/fancy-no-backtrace"]
fancy-with-backtrace = ["fancy-no-backtrace", "miette/fancy"]
log_max_level_info = ["log/max_level_info", "tracing/max_level_info", "log_release_max_level_info"]
log_max_level_debug = ["log/max_level_debug", "tracing/max_level_debug", "log_release_max_level_debug"]
log_release_max_level_info = ["log/release_max_level_info", "tracing/release_max_level_info"]
log_release_max_level_debug = ["log/release_max_level_debug", "tracing/release_max_level_debug"]
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]

46
crates/bin/build.rs Normal file
View file

@ -0,0 +1,46 @@
use std::{
io,
path::Path,
process::{Child, Command},
thread,
};
fn succeeds(res: io::Result<Child>) -> bool {
res.and_then(|mut child| child.wait())
.map(|status| status.success())
.unwrap_or(false)
}
fn main() {
let handle = thread::spawn(|| {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=manifest.rc");
println!("cargo:rerun-if-changed=windows.manifest");
embed_resource::compile("manifest.rc", embed_resource::NONE)
.manifest_required()
.unwrap();
});
let git = Command::new("git").arg("--version").spawn();
// .git is usually a dir, but it also can be a file containing
// path to another .git if it is a submodule.
//
// If build.rs is run on a git repository, then ../../.git
// should exists.
let is_git_repo = Path::new("../../.git").exists();
let mut builder = vergen::EmitBuilder::builder();
builder.all_build().all_cargo().all_rustc();
if is_git_repo && succeeds(git) {
builder.all_git();
} else {
builder.disable_git();
}
builder.emit().unwrap();
handle.join().unwrap();
}

2
crates/bin/manifest.rc Normal file
View file

@ -0,0 +1,2 @@
#define RT_MANIFEST 24
1 RT_MANIFEST "windows.manifest"

15
crates/bin/release.toml Normal file
View file

@ -0,0 +1,15 @@
pre-release-commit-message = "release: cargo-binstall v{{version}}"
tag-prefix = ""
tag-message = "cargo-binstall {{version}}"
# We wait until the release CI is done before publishing,
# because publishing is irreversible, but a release can be
# reverted a lot more easily.
publish = false
[[pre-release-replacements]]
file = "windows.manifest"
search = "^ version=\"[\\d.]+[.]0\""
replace = " version=\"{{version}}.0\""
prerelease = false
max = 1

724
crates/bin/src/args.rs Normal file
View file

@ -0,0 +1,724 @@
use std::{
env,
ffi::OsString,
fmt, mem,
num::{NonZeroU16, NonZeroU64, ParseIntError},
path::PathBuf,
str::FromStr,
};
use binstalk::{
helpers::remote,
manifests::cargo_toml_binstall::PkgFmt,
ops::resolve::{CrateName, VersionReqExt},
registry::Registry,
};
use binstalk_manifests::cargo_toml_binstall::{PkgOverride, Strategy};
use clap::{builder::PossibleValue, error::ErrorKind, CommandFactory, Parser, ValueEnum};
use compact_str::CompactString;
use log::LevelFilter;
use semver::VersionReq;
use strum::EnumCount;
use zeroize::Zeroizing;
#[derive(Debug, Parser)]
#[clap(
version,
about = "Install a Rust binary... from binaries!",
after_long_help =
"License: GPLv3. Source available at https://github.com/cargo-bins/cargo-binstall\n\n\
Some crate installation strategies may collect anonymized usage statistics by default. \
If you prefer not to participate on such data collection, you can opt out by using the \
`--disable-telemetry` flag or its associated environment variable. For more details \
about this data collection, please refer to the mentioned flag or the project's README \
file",
arg_required_else_help(true),
// Avoid conflict with version_req
disable_version_flag(true),
styles = clap_cargo::style::CLAP_STYLING,
)]
pub struct Args {
/// Packages to install.
///
/// Syntax: `crate[@version]`
///
/// Each value is either a crate name alone, or a crate name followed by @ and the version to
/// install. The version syntax is as with the --version option.
///
/// When multiple names are provided, the --version option and override option
/// `--manifest-path` and `--git` are unavailable due to ambiguity.
///
/// If duplicate names are provided, the last one (and their version requirement)
/// is kept.
#[clap(
help_heading = "Package selection",
value_name = "crate[@version]",
required_unless_present_any = ["version", "self_install", "help"],
)]
pub(crate) crate_names: Vec<CrateName>,
/// Package version to install.
///
/// Takes either an exact semver version or a semver version requirement expression, which will
/// be resolved to the highest matching version available.
///
/// Cannot be used when multiple packages are installed at once, use the attached version
/// syntax in that case.
#[clap(
help_heading = "Package selection",
long = "version",
value_parser(VersionReq::parse_from_cli),
value_name = "VERSION"
)]
pub(crate) version_req: Option<VersionReq>,
/// Override binary target set.
///
/// Binstall is able to look for binaries for several targets, installing the first one it finds
/// in the order the targets were given. For example, on a 64-bit glibc Linux distribution, the
/// default is to look first for a `x86_64-unknown-linux-gnu` binary, then for a
/// `x86_64-unknown-linux-musl` binary. However, on a musl system, the gnu version will not be
/// considered.
///
/// This option takes a comma-separated list of target triples, which will be tried in order.
/// They override the default list, which is detected automatically from the current platform.
///
/// If falling back to installing from source, the first target will be used.
#[clap(
help_heading = "Package selection",
alias = "target",
long,
value_name = "TRIPLE",
env = "CARGO_BUILD_TARGET"
)]
pub(crate) targets: Option<Vec<String>>,
/// Override Cargo.toml package manifest path.
///
/// This skips searching crates.io for a manifest and uses the specified path directly, useful
/// for debugging and when adding Binstall support. This may be either the path to the folder
/// containing a Cargo.toml file, or the Cargo.toml file itself.
///
/// This option cannot be used with `--git`.
#[clap(help_heading = "Overrides", long, value_name = "PATH")]
pub(crate) manifest_path: Option<PathBuf>,
#[cfg(feature = "git")]
/// Override how to fetch Cargo.toml package manifest.
///
/// This skip searching crates.io and instead clone the repository specified and
/// runs as if `--manifest-path $cloned_repo` is passed to binstall.
///
/// This option cannot be used with `--manifest-path`.
#[clap(
help_heading = "Overrides",
long,
conflicts_with("manifest_path"),
value_name = "URL"
)]
pub(crate) git: Option<binstalk::registry::GitUrl>,
/// Path template for binary files in packages
///
/// Overrides the Cargo.toml package manifest bin-dir.
#[clap(help_heading = "Overrides", long)]
pub(crate) bin_dir: Option<String>,
/// Format for package downloads
///
/// Overrides the Cargo.toml package manifest pkg-fmt.
///
/// The available package formats are:
///
/// - tar: download format is TAR (uncompressed)
///
/// - tbz2: Download format is TAR + Bzip2
///
/// - tgz: Download format is TGZ (TAR + GZip)
///
/// - txz: Download format is TAR + XZ
///
/// - tzstd: Download format is TAR + Zstd
///
/// - zip: Download format is Zip
///
/// - bin: Download format is raw / binary
#[clap(help_heading = "Overrides", long, value_name = "PKG_FMT")]
pub(crate) pkg_fmt: Option<PkgFmt>,
/// URL template for package downloads
///
/// Overrides the Cargo.toml package manifest pkg-url.
#[clap(help_heading = "Overrides", long, value_name = "TEMPLATE")]
pub(crate) pkg_url: Option<String>,
/// Override the rate limit duration.
///
/// By default, cargo-binstall allows one request per 10 ms.
///
/// Example:
///
/// - `6`: Set the duration to 6ms, allows one request per 6 ms.
///
/// - `6/2`: Set the duration to 6ms and request_count to 2,
/// allows 2 requests per 6ms.
///
/// Both duration and request count must not be 0.
#[clap(
help_heading = "Overrides",
long,
default_value_t = RateLimit::default(),
env = "BINSTALL_RATE_LIMIT",
value_name = "LIMIT",
)]
pub(crate) rate_limit: RateLimit,
/// Specify the strategies to be used,
/// binstall will run the strategies specified in order.
///
/// If this option is specified, then cargo-binstall will ignore
/// `disabled-strategies` in `package.metadata` in the cargo manifest
/// of the installed packages.
///
/// Default value is "crate-meta-data,quick-install,compile".
#[clap(
help_heading = "Overrides",
long,
value_delimiter(','),
env = "BINSTALL_STRATEGIES"
)]
pub(crate) strategies: Vec<StrategyWrapped>,
/// Disable the strategies specified.
/// If a strategy is specified in `--strategies` and `--disable-strategies`,
/// then it will be removed.
///
/// If `--strategies` is not specified, then the strategies specified in this
/// option will be merged with the disabled-strategies` in `package.metadata`
/// in the cargo manifest of the installed packages.
#[clap(
help_heading = "Overrides",
long,
value_delimiter(','),
env = "BINSTALL_DISABLE_STRATEGIES",
value_name = "STRATEGIES"
)]
pub(crate) disable_strategies: Vec<StrategyWrapped>,
/// If `--github-token` or environment variable `GITHUB_TOKEN`/`GH_TOKEN`
/// is not specified, then cargo-binstall will try to extract github token from
/// `$HOME/.git-credentials` or `$HOME/.config/gh/hosts.yml` by default.
///
/// This option can be used to disable that behavior.
#[clap(
help_heading = "Overrides",
long,
env = "BINSTALL_NO_DISCOVER_GITHUB_TOKEN"
)]
pub(crate) no_discover_github_token: bool,
/// Maximum time each resolution (one for each possible target and each strategy), in seconds.
#[clap(
help_heading = "Overrides",
long,
env = "BINSTALL_MAXIMUM_RESOLUTION_TIMEOUT",
default_value_t = NonZeroU16::new(15).unwrap(),
value_name = "TIMEOUT"
)]
pub(crate) maximum_resolution_timeout: NonZeroU16,
/// This flag is now enabled by default thus a no-op.
///
/// By default, Binstall will install a binary as-is in the install path.
#[clap(help_heading = "Options", long, default_value_t = true)]
pub(crate) no_symlinks: bool,
/// Dry run, fetch and show changes without installing binaries.
#[clap(help_heading = "Options", long)]
pub(crate) dry_run: bool,
/// Disable interactive mode / confirmation prompts.
#[clap(
help_heading = "Options",
short = 'y',
long,
env = "BINSTALL_NO_CONFIRM"
)]
pub(crate) no_confirm: bool,
/// Do not cleanup temporary files.
#[clap(help_heading = "Options", long)]
pub(crate) no_cleanup: bool,
/// Continue installing other crates even if one of the crate failed to install.
#[clap(help_heading = "Options", long)]
pub(crate) continue_on_failure: bool,
/// By default, binstall keeps track of the installed packages with metadata files
/// stored in the installation root directory.
///
/// This flag tells binstall not to use or create that file.
///
/// With this flag, binstall will refuse to overwrite any existing files unless the
/// `--force` flag is used.
///
/// This also disables binstalls ability to protect against multiple concurrent
/// invocations of binstall installing at the same time.
///
/// This flag will also be passed to `cargo-install` if it is invoked.
#[clap(help_heading = "Options", long)]
pub(crate) no_track: bool,
/// Disable statistics collection on popular crates.
///
/// Strategy quick-install (can be disabled via --disable-strategies) collects
/// statistics of popular crates by default, by sending the crate, version, target
/// and status to https://cargo-quickinstall-stats-server.fly.dev/record-install
#[clap(help_heading = "Options", long, env = "BINSTALL_DISABLE_TELEMETRY")]
pub(crate) disable_telemetry: bool,
/// Install binaries in a custom location.
///
/// By default, binaries are installed to the global location `$CARGO_HOME/bin`, and global
/// metadata files are updated with the package information. Specifying another path here
/// switches over to a "local" install, where binaries are installed at the path given, and the
/// global metadata files are not updated.
#[clap(help_heading = "Options", long, value_name = "PATH")]
pub(crate) install_path: Option<PathBuf>,
/// Install binaries with a custom cargo root.
///
/// By default, we use `$CARGO_INSTALL_ROOT` or `$CARGO_HOME` as the
/// cargo root and global metadata files are updated with the
/// package information.
///
/// Specifying another path here would install the binaries and update
/// the metadata files inside the path you specified.
///
/// NOTE that `--install-path` takes precedence over this option.
#[clap(help_heading = "Options", long, alias = "roots")]
pub(crate) root: Option<PathBuf>,
/// The URL of the registry index to use.
///
/// Cannot be used with `--registry`.
#[clap(help_heading = "Options", long)]
pub(crate) index: Option<Registry>,
/// Name of the registry to use. Registry names are defined in Cargo config
/// files <https://doc.rust-lang.org/cargo/reference/config.html>.
///
/// If not specified in cmdline or via environment variable, the default
/// registry is used, which is defined by the
/// `registry.default` config key in `.cargo/config.toml` which defaults
/// to crates-io.
///
/// If it is set, then it will try to read environment variable
/// `CARGO_REGISTRIES_{registry_name}_INDEX` for index url and fallback to
/// reading from `registries.<name>.index`.
///
/// Cannot be used with `--index`.
#[clap(
help_heading = "Options",
long,
env = "CARGO_REGISTRY_DEFAULT",
conflicts_with("index")
)]
pub(crate) registry: Option<CompactString>,
/// This option will be passed through to all `cargo-install` invocations.
///
/// It will require `Cargo.lock` to be up to date.
#[clap(help_heading = "Options", long)]
pub(crate) locked: bool,
/// Deprecated, here for back-compat only. Secure is now on by default.
#[clap(hide(true), long)]
pub(crate) secure: bool,
/// Force a crate to be installed even if it is already installed.
#[clap(help_heading = "Options", long)]
pub(crate) force: bool,
/// Require a minimum TLS version from remote endpoints.
///
/// The default is not to require any minimum TLS version, and use the negotiated highest
/// version available to both this client and the remote server.
#[clap(help_heading = "Options", long, value_enum, value_name = "VERSION")]
pub(crate) min_tls_version: Option<TLSVersion>,
/// Specify the root certificates to use for https connnections,
/// in addition to default system-wide ones.
#[clap(
help_heading = "Options",
long,
env = "BINSTALL_HTTPS_ROOT_CERTS",
value_name = "PATH"
)]
pub(crate) root_certificates: Vec<PathBuf>,
/// Print logs in json format to be parsable.
#[clap(help_heading = "Options", long)]
pub json_output: bool,
/// Provide the github token for accessing the restful API of api.github.com
///
/// Fallback to environment variable `GITHUB_TOKEN` if this option is not
/// specified (which is also shown by clap's auto generated doc below), or
/// try environment variable `GH_TOKEN`, which is also used by `gh` cli.
///
/// If none of them is present, then binstall will try to extract github
/// token from `$HOME/.git-credentials` or `$HOME/.config/gh/hosts.yml`
/// unless `--no-discover-github-token` is specified.
#[clap(
help_heading = "Options",
long,
env = "GITHUB_TOKEN",
value_name = "TOKEN"
)]
pub(crate) github_token: Option<GithubToken>,
/// Only install packages that are signed
///
/// The default is to verify signatures if they are available, but to allow
/// unsigned packages as well.
#[clap(help_heading = "Options", long)]
pub(crate) only_signed: bool,
/// Don't check any signatures
///
/// The default is to verify signatures if they are available. This option
/// disables that behaviour entirely, which will also stop downloading
/// signature files in the first place.
///
/// Note that this is insecure and not recommended outside of testing.
#[clap(help_heading = "Options", long, conflicts_with = "only_signed")]
pub(crate) skip_signatures: bool,
/// Print version information
#[clap(help_heading = "Meta", short = 'V')]
pub version: bool,
/// Utility log level
///
/// Set to `trace` to print very low priority, often extremely
/// verbose information.
///
/// Set to `debug` when submitting a bug report.
///
/// Set to `info` to only print useful information.
///
/// Set to `warn` to only print on hazardous situations.
///
/// Set to `error` to only print serious errors.
///
/// Set to `off` to disable logging completely, this will also
/// disable output from `cargo-install`.
///
/// If `--log-level` is not specified on cmdline, then cargo-binstall
/// will try to read environment variable `BINSTALL_LOG_LEVEL` and
/// interpret it as a log-level.
#[clap(help_heading = "Meta", long, value_name = "LEVEL")]
pub log_level: Option<LevelFilter>,
/// Implies `--log-level debug` and it can also be used with `--version`
/// to print out verbose information,
#[clap(help_heading = "Meta", short, long)]
pub verbose: bool,
/// Equivalent to setting `log_level` to `off`.
///
/// This would override the `log_level`.
#[clap(help_heading = "Meta", short, long, conflicts_with("verbose"))]
pub(crate) quiet: bool,
#[clap(long, hide(true))]
pub(crate) self_install: bool,
}
#[derive(Debug, Clone)]
pub(crate) struct GithubToken(pub(crate) Zeroizing<Box<str>>);
impl From<&str> for GithubToken {
fn from(s: &str) -> Self {
Self(Zeroizing::new(s.into()))
}
}
#[derive(Debug, Copy, Clone, ValueEnum)]
pub(crate) enum TLSVersion {
#[clap(name = "1.2")]
Tls1_2,
#[clap(name = "1.3")]
Tls1_3,
}
impl From<TLSVersion> for remote::TLSVersion {
fn from(ver: TLSVersion) -> Self {
match ver {
TLSVersion::Tls1_2 => remote::TLSVersion::TLS_1_2,
TLSVersion::Tls1_3 => remote::TLSVersion::TLS_1_3,
}
}
}
#[derive(Copy, Clone, Debug)]
pub(crate) struct RateLimit {
pub(crate) duration: NonZeroU16,
pub(crate) request_count: NonZeroU64,
}
impl fmt::Display for RateLimit {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}/{}", self.duration, self.request_count)
}
}
impl FromStr for RateLimit {
type Err = ParseIntError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(if let Some((first, second)) = s.split_once('/') {
Self {
duration: first.parse()?,
request_count: second.parse()?,
}
} else {
Self {
duration: s.parse()?,
..Default::default()
}
})
}
}
impl Default for RateLimit {
fn default() -> Self {
Self {
duration: NonZeroU16::new(10).unwrap(),
request_count: NonZeroU64::new(1).unwrap(),
}
}
}
/// Strategy for installing the package
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub(crate) struct StrategyWrapped(pub(crate) Strategy);
impl StrategyWrapped {
const VARIANTS: &'static [Self; 3] = &[
Self(Strategy::CrateMetaData),
Self(Strategy::QuickInstall),
Self(Strategy::Compile),
];
}
impl ValueEnum for StrategyWrapped {
fn value_variants<'a>() -> &'a [Self] {
Self::VARIANTS
}
fn to_possible_value(&self) -> Option<PossibleValue> {
Some(PossibleValue::new(self.0.to_str()))
}
}
pub fn parse() -> (Args, PkgOverride) {
// Filter extraneous arg when invoked by cargo
// `cargo run -- --help` gives ["target/debug/cargo-binstall", "--help"]
// `cargo binstall --help` gives ["/home/ryan/.cargo/bin/cargo-binstall", "binstall", "--help"]
let mut args: Vec<OsString> = env::args_os().collect();
let args = if args.get(1).map(|arg| arg == "binstall").unwrap_or_default() {
// Equivalent to
//
// args.remove(1);
//
// But is O(1)
args.swap(0, 1);
let mut args = args.into_iter();
drop(args.next().unwrap());
args
} else {
args.into_iter()
};
// Load options
let mut opts = Args::parse_from(args);
if opts.self_install {
return (opts, Default::default());
}
if opts.log_level.is_none() {
if let Some(log) = env::var("BINSTALL_LOG_LEVEL")
.ok()
.and_then(|s| s.parse().ok())
{
opts.log_level = Some(log);
} else if opts.quiet {
opts.log_level = Some(LevelFilter::Off);
} else if opts.verbose {
opts.log_level = Some(LevelFilter::Debug);
}
}
// Ensure no conflict
let mut command = Args::command();
if opts.crate_names.len() > 1 {
let option = if opts.version_req.is_some() {
"version"
} else if opts.manifest_path.is_some() {
"manifest-path"
} else {
#[cfg(not(feature = "git"))]
{
""
}
#[cfg(feature = "git")]
if opts.git.is_some() {
"git"
} else {
""
}
};
if !option.is_empty() {
command
.error(
ErrorKind::ArgumentConflict,
format_args!(
r#"override option used with multi package syntax.
You cannot use --{option} and specify multiple packages at the same time. Do one or the other."#
),
)
.exit();
}
}
// Check strategies for duplicates
let mut new_dup_strategy_err = || {
command.error(
ErrorKind::TooManyValues,
"--strategies should not contain duplicate strategy",
)
};
if opts.strategies.len() > Strategy::COUNT {
// If len of strategies is larger than number of variants of Strategy,
// then there must be duplicates by pigeon hole principle.
new_dup_strategy_err().exit()
}
// Whether specific variant of Strategy is present
let mut is_variant_present = [false; Strategy::COUNT];
for strategy in &opts.strategies {
let index = strategy.0 as u8 as usize;
if is_variant_present[index] {
new_dup_strategy_err().exit()
} else {
is_variant_present[index] = true;
}
}
let ignore_disabled_strategies = !opts.strategies.is_empty();
// Default strategies if empty
if opts.strategies.is_empty() {
opts.strategies = vec![
StrategyWrapped(Strategy::CrateMetaData),
StrategyWrapped(Strategy::QuickInstall),
StrategyWrapped(Strategy::Compile),
];
}
// Filter out all disabled strategies
if !opts.disable_strategies.is_empty() {
// Since order doesn't matter, we can sort it and remove all duplicates
// to speedup checking.
opts.disable_strategies.sort_unstable();
opts.disable_strategies.dedup();
// disable_strategies.len() <= Strategy::COUNT, of which is faster
// to just use [Strategy]::contains rather than
// [Strategy]::binary_search
opts.strategies
.retain(|strategy| !opts.disable_strategies.contains(strategy));
if opts.strategies.is_empty() {
command
.error(ErrorKind::TooFewValues, "You have disabled all strategies")
.exit()
}
}
// Ensure that Strategy::Compile is specified as the last strategy
if opts.strategies[..(opts.strategies.len() - 1)].contains(&StrategyWrapped(Strategy::Compile))
{
command
.error(
ErrorKind::InvalidValue,
"Compile strategy must be the last one",
)
.exit()
}
if opts.github_token.is_none() {
if let Ok(github_token) = env::var("GH_TOKEN") {
opts.github_token = Some(GithubToken(Zeroizing::new(github_token.into())));
}
}
match opts.github_token.as_ref() {
Some(token) if token.0.len() < 10 => opts.github_token = None,
_ => (),
}
let cli_overrides = PkgOverride {
pkg_url: opts.pkg_url.take(),
pkg_fmt: opts.pkg_fmt.take(),
bin_dir: opts.bin_dir.take(),
disabled_strategies: Some(
mem::take(&mut opts.disable_strategies)
.into_iter()
.map(|strategy| strategy.0)
.collect::<Vec<_>>()
.into_boxed_slice(),
),
ignore_disabled_strategies,
signing: None,
};
(opts, cli_overrides)
}
#[cfg(test)]
mod test {
use strum::VariantArray;
use super::*;
#[test]
fn verify_cli() {
Args::command().debug_assert()
}
#[test]
fn quickinstall_url_matches() {
let long_help = Args::command()
.get_opts()
.find(|opt| opt.get_long() == Some("disable-telemetry"))
.unwrap()
.get_long_help()
.unwrap()
.to_string();
assert!(
long_help.ends_with(binstalk::QUICKINSTALL_STATS_URL),
"{}",
long_help
);
}
const _: () = assert!(Strategy::VARIANTS.len() == StrategyWrapped::VARIANTS.len());
}

View file

@ -0,0 +1,64 @@
use std::{
process::{ExitCode, Termination},
time::Duration,
};
use binstalk::errors::BinstallError;
use binstalk::helpers::tasks::AutoAbortJoinHandle;
use miette::Result;
use tokio::runtime::Runtime;
use tracing::{error, info};
use crate::signal::cancel_on_user_sig_term;
pub enum MainExit {
Success(Option<Duration>),
Error(BinstallError),
Report(miette::Report),
}
impl Termination for MainExit {
fn report(self) -> ExitCode {
match self {
Self::Success(spent) => {
if let Some(spent) = spent {
info!("Done in {spent:?}");
}
ExitCode::SUCCESS
}
Self::Error(err) => err.report(),
Self::Report(err) => {
error!("Fatal error:\n{err:?}");
ExitCode::from(16)
}
}
}
}
impl MainExit {
pub fn new(res: Result<()>, done: Option<Duration>) -> Self {
res.map(|()| MainExit::Success(done)).unwrap_or_else(|err| {
err.downcast::<BinstallError>()
.map(MainExit::Error)
.unwrap_or_else(MainExit::Report)
})
}
}
/// This function would start a tokio multithreading runtime,
/// then `block_on` the task it returns.
///
/// It will cancel the future if user requested cancellation
/// via signal.
pub fn run_tokio_main(
f: impl FnOnce() -> Result<Option<AutoAbortJoinHandle<Result<()>>>>,
) -> Result<()> {
let rt = Runtime::new().map_err(BinstallError::from)?;
let _guard = rt.enter();
if let Some(handle) = f()? {
rt.block_on(cancel_on_user_sig_term(handle))?
} else {
Ok(())
}
}

630
crates/bin/src/entry.rs Normal file
View file

@ -0,0 +1,630 @@
use std::{
env, fs,
path::{Path, PathBuf},
sync::Arc,
time::Duration,
};
use atomic_file_install::atomic_install;
use binstalk::{
errors::{BinstallError, CrateContextError},
fetchers::{Fetcher, GhCrateMeta, QuickInstall, SignaturePolicy},
get_desired_targets,
helpers::{
jobserver_client::LazyJobserverClient,
lazy_gh_api_client::LazyGhApiClient,
remote::{Certificate, Client},
tasks::AutoAbortJoinHandle,
},
ops::{
self,
resolve::{CrateName, Resolution, ResolutionFetch, VersionReqExt},
CargoTomlFetchOverride, Options, Resolver,
},
TARGET,
};
use binstalk_manifests::{
cargo_config::Config,
cargo_toml_binstall::{PkgOverride, Strategy},
crate_info::{CrateInfo, CrateSource},
crates_manifests::Manifests,
};
use compact_str::CompactString;
use file_format::FileFormat;
use home::cargo_home;
use log::LevelFilter;
use miette::{miette, Report, Result, WrapErr};
use semver::Version;
use tokio::task::block_in_place;
use tracing::{debug, error, info, warn};
use crate::{args::Args, gh_token, git_credentials, install_path, ui::confirm};
pub fn install_crates(
args: Args,
cli_overrides: PkgOverride,
jobserver_client: LazyJobserverClient,
) -> Result<Option<AutoAbortJoinHandle<Result<()>>>> {
// Compute Resolvers
let mut cargo_install_fallback = false;
let resolvers: Vec<_> = args
.strategies
.into_iter()
.filter_map(|strategy| match strategy.0 {
Strategy::CrateMetaData => Some(GhCrateMeta::new as Resolver),
Strategy::QuickInstall => Some(QuickInstall::new as Resolver),
Strategy::Compile => {
cargo_install_fallback = true;
None
}
})
.collect();
// Load .cargo/config.toml
let cargo_home = cargo_home().map_err(BinstallError::from)?;
let mut config = Config::load_from_path(cargo_home.join("config.toml"))?;
// Compute paths
let cargo_root = args.root;
let (install_path, mut manifests, temp_dir) = compute_paths_and_load_manifests(
cargo_root.clone(),
args.install_path,
args.no_track,
cargo_home,
&mut config,
)?;
// Remove installed crates
let mut crate_names =
filter_out_installed_crates(args.crate_names, args.force, manifests.as_mut())?.peekable();
if crate_names.peek().is_none() {
debug!("Nothing to do");
return Ok(None);
}
// Launch target detection
let desired_targets = get_desired_targets(args.targets);
// Initialize reqwest client
let rate_limit = args.rate_limit;
let mut http = config.http.take();
let client = Client::new(
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")),
args.min_tls_version.map(|v| v.into()),
rate_limit.duration,
rate_limit.request_count,
read_root_certs(
args.root_certificates,
http.as_mut().and_then(|http| http.cainfo.take()),
),
)
.map_err(BinstallError::from)?;
let gh_api_client = args
.github_token
.map(|token| token.0)
.or_else(|| {
if args.no_discover_github_token {
None
} else {
git_credentials::try_from_home()
}
})
.map(|token| LazyGhApiClient::new(client.clone(), Some(token)))
.unwrap_or_else(|| {
if args.no_discover_github_token {
LazyGhApiClient::new(client.clone(), None)
} else {
LazyGhApiClient::with_get_gh_token_future(client.clone(), async {
match gh_token::get().await {
Ok(token) => Some(token),
Err(err) => {
debug!(?err, "Failed to retrieve token from `gh auth token`");
debug!("Failed to read git credential file");
None
}
}
})
}
});
// Create binstall_opts
let binstall_opts = Arc::new(Options {
no_symlinks: args.no_symlinks,
dry_run: args.dry_run,
force: args.force,
quiet: args.log_level == Some(LevelFilter::Off),
locked: args.locked,
no_track: args.no_track,
version_req: args.version_req,
#[cfg(feature = "git")]
cargo_toml_fetch_override: match (args.manifest_path, args.git) {
(Some(manifest_path), None) => Some(CargoTomlFetchOverride::Path(manifest_path)),
(None, Some(git_url)) => Some(CargoTomlFetchOverride::Git(git_url)),
(None, None) => None,
_ => unreachable!("manifest_path and git cannot be specified at the same time"),
},
#[cfg(not(feature = "git"))]
cargo_toml_fetch_override: args.manifest_path.map(CargoTomlFetchOverride::Path),
cli_overrides,
desired_targets,
resolvers,
cargo_install_fallback,
temp_dir: temp_dir.path().to_owned(),
install_path,
cargo_root,
client,
gh_api_client,
jobserver_client,
registry: if let Some(index) = args.index {
index
} else if let Some(registry_name) = args
.registry
.or_else(|| config.registry.and_then(|registry| registry.default))
{
let registry_name_lowercase = registry_name.to_lowercase();
let v = env::vars().find_map(|(k, v)| {
let name_lowercase = k
.strip_prefix("CARGO_REGISTRIES_")?
.strip_suffix("_INDEX")?
.to_lowercase();
(name_lowercase == registry_name_lowercase).then_some(v)
});
if let Some(v) = &v {
v
} else {
config
.registries
.as_ref()
.and_then(|registries| registries.get(&registry_name))
.and_then(|registry| registry.index.as_deref())
.ok_or_else(|| BinstallError::UnknownRegistryName(registry_name))?
}
.parse()
.map_err(BinstallError::from)?
} else {
Default::default()
},
signature_policy: if args.only_signed {
SignaturePolicy::Require
} else if args.skip_signatures {
SignaturePolicy::Ignore
} else {
SignaturePolicy::IfPresent
},
disable_telemetry: args.disable_telemetry,
maximum_resolution_timeout: Duration::from_secs(
args.maximum_resolution_timeout.get().into(),
),
});
// Destruct args before any async function to reduce size of the future
let dry_run = args.dry_run;
let no_confirm = args.no_confirm;
let no_cleanup = args.no_cleanup;
// Resolve crates
let tasks: Vec<_> = crate_names
.map(|(crate_name, current_version)| {
AutoAbortJoinHandle::spawn(ops::resolve::resolve(
binstall_opts.clone(),
crate_name,
current_version,
))
})
.collect();
Ok(Some(if args.continue_on_failure {
AutoAbortJoinHandle::spawn(async move {
// Collect results
let mut resolution_fetchs = Vec::new();
let mut resolution_sources = Vec::new();
let mut errors = Vec::new();
for task in tasks {
match task.flattened_join().await {
Ok(Resolution::AlreadyUpToDate) => {}
Ok(Resolution::Fetch(fetch)) => {
fetch.print(&binstall_opts);
resolution_fetchs.push(fetch)
}
Ok(Resolution::InstallFromSource(source)) => {
source.print();
resolution_sources.push(source)
}
Err(BinstallError::CrateContext(err)) => errors.push(err),
Err(e) => panic!("Expected BinstallError::CrateContext(_), got {}", e),
}
}
if resolution_fetchs.is_empty() && resolution_sources.is_empty() {
return if let Some(err) = BinstallError::crate_errors(errors) {
Err(err.into())
} else {
debug!("Nothing to do");
Ok(())
};
}
// Confirm
if !dry_run && !no_confirm {
if let Err(abort_err) = confirm().await {
return if let Some(err) = BinstallError::crate_errors(errors) {
Err(Report::new(abort_err).wrap_err(err))
} else {
Err(abort_err.into())
};
}
}
let manifest_update_res = do_install_fetches_continue_on_failure(
resolution_fetchs,
manifests,
&binstall_opts,
dry_run,
temp_dir,
no_cleanup,
&mut errors,
);
let tasks: Vec<_> = resolution_sources
.into_iter()
.map(|source| AutoAbortJoinHandle::spawn(source.install(binstall_opts.clone())))
.collect();
for task in tasks {
match task.flattened_join().await {
Ok(_) => (),
Err(BinstallError::CrateContext(err)) => errors.push(err),
Err(e) => panic!("Expected BinstallError::CrateContext(_), got {}", e),
}
}
match (BinstallError::crate_errors(errors), manifest_update_res) {
(None, Ok(())) => Ok(()),
(None, Err(err)) => Err(err),
(Some(err), Ok(())) => Err(err.into()),
(Some(err), Err(manifest_update_err)) => {
Err(Report::new(err).wrap_err(manifest_update_err))
}
}
})
} else {
AutoAbortJoinHandle::spawn(async move {
// Collect results
let mut resolution_fetchs = Vec::new();
let mut resolution_sources = Vec::new();
for task in tasks {
match task.await?? {
Resolution::AlreadyUpToDate => {}
Resolution::Fetch(fetch) => {
fetch.print(&binstall_opts);
resolution_fetchs.push(fetch)
}
Resolution::InstallFromSource(source) => {
source.print();
resolution_sources.push(source)
}
}
}
if resolution_fetchs.is_empty() && resolution_sources.is_empty() {
debug!("Nothing to do");
return Ok(());
}
// Confirm
if !dry_run && !no_confirm {
confirm().await?;
}
do_install_fetches(
resolution_fetchs,
manifests,
&binstall_opts,
dry_run,
temp_dir,
no_cleanup,
)?;
let tasks: Vec<_> = resolution_sources
.into_iter()
.map(|source| AutoAbortJoinHandle::spawn(source.install(binstall_opts.clone())))
.collect();
for task in tasks {
task.await??;
}
Ok(())
})
}))
}
fn do_read_root_cert(path: &Path) -> Result<Option<Certificate>, BinstallError> {
use std::io::{Read, Seek};
let mut file = fs::File::open(path)?;
let file_format = FileFormat::from_reader(&mut file)?;
let open_cert = match file_format {
FileFormat::PemCertificate => Certificate::from_pem,
FileFormat::DerCertificate => Certificate::from_der,
_ => {
warn!(
"Unable to load {}: Expected pem or der ceritificate but found {file_format}",
path.display()
);
return Ok(None);
}
};
// Move file back to its head
file.rewind()?;
let mut buffer = Vec::with_capacity(200);
file.read_to_end(&mut buffer)?;
open_cert(&buffer).map_err(From::from).map(Some)
}
fn read_root_certs(
root_certificate_paths: Vec<PathBuf>,
config_cainfo: Option<PathBuf>,
) -> impl Iterator<Item = Certificate> {
root_certificate_paths
.into_iter()
.chain(config_cainfo)
.filter_map(|path| match do_read_root_cert(&path) {
Ok(optional_cert) => optional_cert,
Err(err) => {
warn!(
"Failed to load root certificate at {}: {err}",
path.display()
);
None
}
})
}
/// Return (install_path, manifests, temp_dir)
fn compute_paths_and_load_manifests(
roots: Option<PathBuf>,
install_path: Option<PathBuf>,
no_track: bool,
cargo_home: PathBuf,
config: &mut Config,
) -> Result<(PathBuf, Option<Manifests>, tempfile::TempDir)> {
// Compute cargo_roots
let cargo_roots =
install_path::get_cargo_roots_path(roots, cargo_home, config).ok_or_else(|| {
error!("No viable cargo roots path found of specified, try `--roots`");
miette!("No cargo roots path found or specified")
})?;
// Compute install directory
let (install_path, custom_install_path) =
install_path::get_install_path(install_path, Some(&cargo_roots));
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")
})?;
fs::create_dir_all(&install_path).map_err(BinstallError::Io)?;
debug!("Using install path: {}", install_path.display());
let no_manifests = no_track || custom_install_path;
// Load manifests
let manifests = if !no_manifests {
Some(Manifests::open_exclusive(&cargo_roots)?)
} else {
None
};
// Create a temporary directory for downloads etc.
//
// Put all binaries to a temporary directory under `dst` first, catching
// some failure modes (e.g., out of space) before touching the existing
// binaries. This directory will get cleaned up via RAII.
let temp_dir = tempfile::Builder::new()
.prefix("cargo-binstall")
.tempdir_in(&install_path)
.map_err(BinstallError::from)
.wrap_err("Creating a temporary directory failed.")?;
Ok((install_path, manifests, temp_dir))
}
/// Return vec of (crate_name, current_version)
fn filter_out_installed_crates(
crate_names: Vec<CrateName>,
force: bool,
manifests: Option<&mut Manifests>,
) -> Result<impl Iterator<Item = (CrateName, Option<semver::Version>)> + '_> {
let mut installed_crates = manifests
.map(Manifests::load_installed_crates)
.transpose()?;
Ok(CrateName::dedup(crate_names)
.filter_map(move |crate_name| {
let name = &crate_name.name;
let curr_version = installed_crates
.as_mut()
// Since crate_name is deduped, every entry of installed_crates
// can be visited at most once.
//
// So here we take ownership of the version stored to avoid cloning.
.and_then(|crates| crates.remove(name));
match (
force,
curr_version,
&crate_name.version_req,
) {
(false, Some(curr_version), Some(version_req))
if version_req.is_latest_compatible(&curr_version) =>
{
debug!("Bailing out early because we can assume wanted is already installed from metafile");
info!("{name} v{curr_version} is already installed, use --force to override");
None
}
// The version req is "*" thus a remote upgraded version could exist
(false, Some(curr_version), None) => {
Some((crate_name, Some(curr_version)))
}
_ => Some((crate_name, None)),
}
}))
}
#[allow(clippy::vec_box)]
fn do_install_fetches(
resolution_fetchs: Vec<Box<ResolutionFetch>>,
// Take manifests by value to drop the `FileLock`.
manifests: Option<Manifests>,
binstall_opts: &Options,
dry_run: bool,
temp_dir: tempfile::TempDir,
no_cleanup: bool,
) -> Result<()> {
if resolution_fetchs.is_empty() {
return Ok(());
}
if dry_run {
info!("Dry-run: Not proceeding to install fetched binaries");
return Ok(());
}
block_in_place(|| {
let metadata_vec = resolution_fetchs
.into_iter()
.map(|fetch| fetch.install(binstall_opts))
.collect::<Result<Vec<_>, BinstallError>>()?;
if let Some(manifests) = manifests {
manifests.update(metadata_vec)?;
}
if no_cleanup {
// Consume temp_dir without removing it from fs.
let _ = temp_dir.into_path();
} else {
temp_dir.close().unwrap_or_else(|err| {
warn!("Failed to clean up some resources: {err}");
});
}
Ok(())
})
}
#[allow(clippy::vec_box)]
fn do_install_fetches_continue_on_failure(
resolution_fetchs: Vec<Box<ResolutionFetch>>,
// Take manifests by value to drop the `FileLock`.
manifests: Option<Manifests>,
binstall_opts: &Options,
dry_run: bool,
temp_dir: tempfile::TempDir,
no_cleanup: bool,
errors: &mut Vec<Box<CrateContextError>>,
) -> Result<()> {
if resolution_fetchs.is_empty() {
return Ok(());
}
if dry_run {
info!("Dry-run: Not proceeding to install fetched binaries");
return Ok(());
}
block_in_place(|| {
let metadata_vec = resolution_fetchs
.into_iter()
.filter_map(|fetch| match fetch.install(binstall_opts) {
Ok(crate_info) => Some(crate_info),
Err(BinstallError::CrateContext(err)) => {
errors.push(err);
None
}
Err(e) => panic!("Expected BinstallError::CrateContext(_), got {}", e),
})
.collect::<Vec<_>>();
if let Some(manifests) = manifests {
manifests.update(metadata_vec)?;
}
if no_cleanup {
// Consume temp_dir without removing it from fs.
let _ = temp_dir.into_path();
} else {
temp_dir.close().unwrap_or_else(|err| {
warn!("Failed to clean up some resources: {err}");
});
}
Ok(())
})
}
pub fn self_install(args: Args) -> Result<()> {
// Load .cargo/config.toml
let cargo_home = cargo_home().map_err(BinstallError::from)?;
let mut config = Config::load_from_path(cargo_home.join("config.toml"))?;
// Compute paths
let cargo_root = args.root;
let (install_path, manifests, _) = compute_paths_and_load_manifests(
cargo_root.clone(),
args.install_path,
args.no_track,
cargo_home,
&mut config,
)?;
let mut dest = install_path.join("cargo-binstall");
if cfg!(windows) {
assert!(dest.set_extension("exe"));
}
atomic_install(&env::current_exe().map_err(BinstallError::from)?, &dest)
.map_err(BinstallError::from)?;
if let Some(manifests) = manifests {
manifests.update(vec![CrateInfo {
name: CompactString::const_new("cargo-binstall"),
version_req: CompactString::const_new("*"),
current_version: Version::new(
env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap(),
env!("CARGO_PKG_VERSION_MINOR").parse().unwrap(),
env!("CARGO_PKG_VERSION_PATCH").parse().unwrap(),
),
source: CrateSource::cratesio_registry(),
target: CompactString::const_new(TARGET),
bins: vec![CompactString::const_new("cargo-binstall")],
}])?;
}
Ok(())
}

View file

@ -0,0 +1,99 @@
use std::{
io,
process::{Output, Stdio},
str,
};
use tokio::{io::AsyncWriteExt, process::Command};
use zeroize::{Zeroize, Zeroizing};
pub(super) async fn get() -> io::Result<Zeroizing<Box<str>>> {
let output = Command::new("gh")
.args(["auth", "token"])
.stdout_with_optional_input(None)
.await?;
if !output.is_empty() {
return Ok(output);
}
Command::new("git")
.args(["credential", "fill"])
.stdout_with_optional_input(Some("host=github.com\nprotocol=https".as_bytes()))
.await?
.lines()
.find_map(|line| {
line.trim()
.strip_prefix("password=")
.map(|token| Zeroizing::new(token.into()))
})
.ok_or_else(|| {
io::Error::new(
io::ErrorKind::Other,
"Password not found in `git credential fill` output",
)
})
}
trait CommandExt {
// Helper function to execute a command, optionally with input
async fn stdout_with_optional_input(
&mut self,
input: Option<&[u8]>,
) -> io::Result<Zeroizing<Box<str>>>;
}
impl CommandExt for Command {
async fn stdout_with_optional_input(
&mut self,
input: Option<&[u8]>,
) -> io::Result<Zeroizing<Box<str>>> {
self.stdout(Stdio::piped())
.stderr(Stdio::null())
.stdin(if input.is_some() {
Stdio::piped()
} else {
Stdio::null()
});
let mut child = self.spawn()?;
if let Some(input) = input {
child.stdin.take().unwrap().write_all(input).await?;
}
let Output { status, stdout, .. } = child.wait_with_output().await?;
if status.success() {
let s = String::from_utf8(stdout).map_err(|err| {
let msg = format!(
"Invalid output for `{:?}`, expected utf8: {err}",
self.as_std()
);
zeroize_and_drop(err.into_bytes());
io::Error::new(io::ErrorKind::InvalidData, msg)
})?;
let trimmed = s.trim();
Ok(if trimmed.len() == s.len() {
Zeroizing::new(s.into_boxed_str())
} else {
Zeroizing::new(trimmed.into())
})
} else {
zeroize_and_drop(stdout);
Err(io::Error::new(
io::ErrorKind::Other,
format!("`{:?}` process exited with `{status}`", self.as_std()),
))
}
}
}
fn zeroize_and_drop(mut bytes: Vec<u8>) {
bytes.zeroize();
}

View file

@ -0,0 +1,66 @@
use std::{env, fs, path::PathBuf};
use dirs::home_dir;
use zeroize::Zeroizing;
pub fn try_from_home() -> Option<Zeroizing<Box<str>>> {
if let Some(mut home) = home_dir() {
home.push(".git-credentials");
if let Some(cred) = from_file(home) {
return Some(cred);
}
}
if let Some(home) = env::var_os("XDG_CONFIG_HOME") {
let mut home = PathBuf::from(home);
home.push("git/credentials");
if let Some(cred) = from_file(home) {
return Some(cred);
}
}
None
}
fn from_file(path: PathBuf) -> Option<Zeroizing<Box<str>>> {
Zeroizing::new(fs::read_to_string(path).ok()?)
.lines()
.find_map(from_line)
.map(Box::<str>::from)
.map(Zeroizing::new)
}
fn from_line(line: &str) -> Option<&str> {
let cred = line
.trim()
.strip_prefix("https://")?
.strip_suffix("@github.com")?;
Some(cred.split_once(':')?.1)
}
#[cfg(test)]
mod test {
use super::*;
const GIT_CREDENTIALS_TEST_CASES: &[(&str, Option<&str>)] = &[
// Success
("https://NobodyXu:gho_asdc@github.com", Some("gho_asdc")),
(
"https://NobodyXu:gho_asdc12dz@github.com",
Some("gho_asdc12dz"),
),
// Failure
("http://NobodyXu:gho_asdc@github.com", None),
("https://NobodyXu:gho_asdc@gitlab.com", None),
("https://NobodyXugho_asdc@github.com", None),
];
#[test]
fn test_extract_from_line() {
GIT_CREDENTIALS_TEST_CASES.iter().for_each(|(line, res)| {
assert_eq!(from_line(line), *res);
})
}
}

View file

@ -0,0 +1,56 @@
use std::{
env::var_os,
path::{Path, PathBuf},
};
use binstalk_manifests::cargo_config::Config;
use tracing::debug;
pub fn get_cargo_roots_path(
cargo_roots: Option<PathBuf>,
cargo_home: PathBuf,
config: &mut Config,
) -> Option<PathBuf> {
if let Some(p) = cargo_roots {
Some(p)
} else if let Some(p) = var_os("CARGO_INSTALL_ROOT") {
// Environmental variables
let p = PathBuf::from(p);
debug!("using CARGO_INSTALL_ROOT ({})", p.display());
Some(p)
} else if let Some(root) = config.install.take().and_then(|install| install.root) {
debug!("using `install.root` {} from cargo config", root.display());
Some(root)
} else {
debug!("using ({}) as cargo home", cargo_home.display());
Some(cargo_home)
}
}
/// Fetch install path from environment
/// roughly follows <https://doc.rust-lang.org/cargo/commands/cargo-install.html#description>
///
/// Return (install_path, is_custom_install_path)
pub fn get_install_path(
install_path: Option<PathBuf>,
cargo_roots: Option<impl AsRef<Path>>,
) -> (Option<PathBuf>, bool) {
// Command line override first first
if let Some(p) = install_path {
return (Some(p), true);
}
// Then cargo_roots
if let Some(p) = cargo_roots {
return (Some(p.as_ref().join("bin")), false);
}
// Local executable dir if no cargo is found
let dir = dirs::executable_dir();
if let Some(d) = &dir {
debug!("Fallback to {}", d.display());
}
(dir, true)
}

14
crates/bin/src/lib.rs Normal file
View file

@ -0,0 +1,14 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
mod args;
mod bin_util;
mod entry;
mod gh_token;
mod git_credentials;
mod install_path;
mod logging;
mod main_impl;
mod signal;
mod ui;
pub use main_impl::do_main;

248
crates/bin/src/logging.rs Normal file
View file

@ -0,0 +1,248 @@
use std::{
cmp::min,
io::{self, Write},
iter::repeat,
};
use log::{LevelFilter, Log, STATIC_MAX_LEVEL};
use once_cell::sync::Lazy;
use supports_color::{on as supports_color_on_stream, Stream::Stdout};
use tracing::{
callsite::Callsite,
dispatcher, field,
subscriber::{self, set_global_default},
Event, Level, Metadata,
};
use tracing_core::{identify_callsite, metadata::Kind, subscriber::Subscriber};
use tracing_log::AsTrace;
use tracing_subscriber::{
filter::targets::Targets,
fmt::{fmt, MakeWriter},
layer::SubscriberExt,
};
// Shamelessly taken from tracing-log
struct Fields {
message: field::Field,
}
static FIELD_NAMES: &[&str] = &["message"];
impl Fields {
fn new(cs: &'static dyn Callsite) -> Self {
let fieldset = cs.metadata().fields();
let message = fieldset.field("message").unwrap();
Fields { message }
}
}
macro_rules! log_cs {
($level:expr, $cs:ident, $meta:ident, $fields:ident, $ty:ident) => {
struct $ty;
static $cs: $ty = $ty;
static $meta: Metadata<'static> = Metadata::new(
"log event",
"log",
$level,
None,
None,
None,
field::FieldSet::new(FIELD_NAMES, identify_callsite!(&$cs)),
Kind::EVENT,
);
static $fields: Lazy<Fields> = Lazy::new(|| Fields::new(&$cs));
impl Callsite for $ty {
fn set_interest(&self, _: subscriber::Interest) {}
fn metadata(&self) -> &'static Metadata<'static> {
&$meta
}
}
};
}
log_cs!(
Level::TRACE,
TRACE_CS,
TRACE_META,
TRACE_FIELDS,
TraceCallsite
);
log_cs!(
Level::DEBUG,
DEBUG_CS,
DEBUG_META,
DEBUG_FIELDS,
DebugCallsite
);
log_cs!(Level::INFO, INFO_CS, INFO_META, INFO_FIELDS, InfoCallsite);
log_cs!(Level::WARN, WARN_CS, WARN_META, WARN_FIELDS, WarnCallsite);
log_cs!(
Level::ERROR,
ERROR_CS,
ERROR_META,
ERROR_FIELDS,
ErrorCallsite
);
fn loglevel_to_cs(level: log::Level) -> (&'static Fields, &'static Metadata<'static>) {
match level {
log::Level::Trace => (&*TRACE_FIELDS, &TRACE_META),
log::Level::Debug => (&*DEBUG_FIELDS, &DEBUG_META),
log::Level::Info => (&*INFO_FIELDS, &INFO_META),
log::Level::Warn => (&*WARN_FIELDS, &WARN_META),
log::Level::Error => (&*ERROR_FIELDS, &ERROR_META),
}
}
struct Logger;
impl Logger {
fn init(log_level: LevelFilter) {
log::set_max_level(log_level);
log::set_logger(&Self).unwrap();
}
}
impl Log for Logger {
fn enabled(&self, metadata: &log::Metadata<'_>) -> bool {
if metadata.level() > log::max_level() {
// First, check the log record against the current max level enabled.
false
} else {
// Check if the current `tracing` dispatcher cares about this.
dispatcher::get_default(|dispatch| dispatch.enabled(&metadata.as_trace()))
}
}
fn log(&self, record: &log::Record<'_>) {
// Dispatch manually instead of using methods provided by tracing-log
// to avoid having fields "log.target = ..." in the log message,
// which makes the log really hard to read.
if self.enabled(record.metadata()) {
dispatcher::get_default(|dispatch| {
let (keys, meta) = loglevel_to_cs(record.level());
dispatch.event(&Event::new(
meta,
&meta
.fields()
.value_set(&[(&keys.message, Some(record.args() as &dyn field::Value))]),
));
});
}
}
fn flush(&self) {}
}
struct ErrorFreeWriter;
fn report_err(err: io::Error) {
writeln!(io::stderr(), "Failed to write to stdout: {err}").ok();
}
impl io::Write for &ErrorFreeWriter {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
io::stdout().write(buf).or_else(|err| {
report_err(err);
// Behave as if writing to /dev/null so that logging system
// would keep working.
Ok(buf.len())
})
}
fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
io::stdout().write_all(buf).or_else(|err| {
report_err(err);
// Behave as if writing to /dev/null so that logging system
// would keep working.
Ok(())
})
}
fn write_vectored(&mut self, bufs: &[io::IoSlice<'_>]) -> io::Result<usize> {
io::stdout().write_vectored(bufs).or_else(|err| {
report_err(err);
// Behave as if writing to /dev/null so that logging system
// would keep working.
Ok(bufs.iter().map(|io_slice| io_slice.len()).sum())
})
}
fn flush(&mut self) -> io::Result<()> {
io::stdout().flush().or_else(|err| {
report_err(err);
// Behave as if writing to /dev/null so that logging system
// would keep working.
Ok(())
})
}
}
impl<'a> MakeWriter<'a> for ErrorFreeWriter {
type Writer = &'a Self;
fn make_writer(&'a self) -> Self::Writer {
self
}
}
pub fn logging(log_level: LevelFilter, json_output: bool) {
// Calculate log_level
let log_level = min(log_level, STATIC_MAX_LEVEL);
let allowed_targets = (log_level != LevelFilter::Trace).then_some([
"atomic_file_install",
"binstalk",
"binstalk_bins",
"binstalk_downloader",
"binstalk_fetchers",
"binstalk_registry",
"cargo_binstall",
"cargo_toml_workspace",
"detect_targets",
"simple_git",
]);
// Forward log to tracing
Logger::init(log_level);
// Build fmt subscriber
let log_level = log_level.as_trace();
let subscriber_builder = fmt().with_max_level(log_level).with_writer(ErrorFreeWriter);
let subscriber: Box<dyn Subscriber + Send + Sync> = if json_output {
Box::new(subscriber_builder.json().finish())
} else {
// Disable time, target, file, line_num, thread name/ids to make the
// output more readable
let subscriber_builder = subscriber_builder
.without_time()
.with_target(false)
.with_file(false)
.with_line_number(false)
.with_thread_names(false)
.with_thread_ids(false);
// subscriber_builder defaults to write to io::stdout(),
// so tests whether it supports color.
let stdout_supports_color = supports_color_on_stream(Stdout)
.map(|color_level| color_level.has_basic)
.unwrap_or_default();
Box::new(subscriber_builder.with_ansi(stdout_supports_color).finish())
};
// Builder layer for filtering
let filter_layer = allowed_targets.map(|allowed_targets| {
Targets::new().with_targets(allowed_targets.into_iter().zip(repeat(log_level)))
});
// Builder final subscriber with filtering
let subscriber = subscriber.with(filter_layer);
// Setup global subscriber
set_global_default(subscriber).unwrap();
}

11
crates/bin/src/main.rs Normal file
View file

@ -0,0 +1,11 @@
use std::process::Termination;
use cargo_binstall::do_main;
#[cfg(feature = "mimalloc")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
fn main() -> impl Termination {
do_main()
}

View file

@ -0,0 +1,66 @@
use std::{process::Termination, time::Instant};
use binstalk::{helpers::jobserver_client::LazyJobserverClient, TARGET};
use log::LevelFilter;
use tracing::debug;
use crate::{
args,
bin_util::{run_tokio_main, MainExit},
entry,
logging::logging,
};
pub fn do_main() -> impl Termination {
let (args, cli_overrides) = args::parse();
if args.version {
let cargo_binstall_version = env!("CARGO_PKG_VERSION");
if args.verbose {
let build_date = env!("VERGEN_BUILD_DATE");
let features = env!("VERGEN_CARGO_FEATURES");
let git_sha = option_env!("VERGEN_GIT_SHA").unwrap_or("UNKNOWN");
let git_commit_date = option_env!("VERGEN_GIT_COMMIT_DATE").unwrap_or("UNKNOWN");
let rustc_semver = env!("VERGEN_RUSTC_SEMVER");
let rustc_commit_hash = env!("VERGEN_RUSTC_COMMIT_HASH");
let rustc_llvm_version = env!("VERGEN_RUSTC_LLVM_VERSION");
println!(
r#"cargo-binstall: {cargo_binstall_version}
build-date: {build_date}
build-target: {TARGET}
build-features: {features}
build-commit-hash: {git_sha}
build-commit-date: {git_commit_date}
rustc-version: {rustc_semver}
rustc-commit-hash: {rustc_commit_hash}
rustc-llvm-version: {rustc_llvm_version}"#
);
} else {
println!("{cargo_binstall_version}");
}
MainExit::Success(None)
} else if args.self_install {
MainExit::new(entry::self_install(args), None)
} else {
logging(
args.log_level.unwrap_or(LevelFilter::Info),
args.json_output,
);
let start = Instant::now();
let jobserver_client = LazyJobserverClient::new();
let result =
run_tokio_main(|| entry::install_crates(args, cli_overrides, jobserver_client));
let done = start.elapsed();
debug!("run time: {done:?}");
MainExit::new(result, Some(done))
}
}

84
crates/bin/src/signal.rs Normal file
View file

@ -0,0 +1,84 @@
use std::io;
use binstalk::{errors::BinstallError, helpers::tasks::AutoAbortJoinHandle};
use tokio::signal;
/// This function will poll the handle while listening for ctrl_c,
/// `SIGINT`, `SIGHUP`, `SIGTERM` and `SIGQUIT`.
///
/// When signal is received, [`BinstallError::UserAbort`] will be returned.
///
/// It would also ignore `SIGUSER1` and `SIGUSER2` on unix.
///
/// This function uses [`tokio::signal`] and once exit, does not reset the default
/// signal handler, so be careful when using it.
pub async fn cancel_on_user_sig_term<T>(
handle: AutoAbortJoinHandle<T>,
) -> Result<T, BinstallError> {
ignore_signals()?;
tokio::select! {
biased;
res = wait_on_cancellation_signal() => {
res.map_err(BinstallError::Io)
.and(Err(BinstallError::UserAbort))
}
res = handle => res,
}
}
fn ignore_signals() -> io::Result<()> {
#[cfg(unix)]
unix::ignore_signals_on_unix()?;
Ok(())
}
/// If call to it returns `Ok(())`, then all calls to this function after
/// that also returns `Ok(())`.
async fn wait_on_cancellation_signal() -> Result<(), io::Error> {
#[cfg(unix)]
unix::wait_on_cancellation_signal_unix().await?;
#[cfg(not(unix))]
signal::ctrl_c().await?;
Ok(())
}
#[cfg(unix)]
mod unix {
use super::*;
use signal::unix::{signal, SignalKind};
/// Same as [`wait_on_cancellation_signal`] but is only available on unix.
pub async fn wait_on_cancellation_signal_unix() -> Result<(), io::Error> {
tokio::select! {
biased;
res = wait_for_signal_unix(SignalKind::interrupt()) => res,
res = wait_for_signal_unix(SignalKind::hangup()) => res,
res = wait_for_signal_unix(SignalKind::terminate()) => res,
res = wait_for_signal_unix(SignalKind::quit()) => res,
}
}
/// Wait for first arrival of signal.
pub async fn wait_for_signal_unix(kind: signal::unix::SignalKind) -> Result<(), io::Error> {
let mut sig_listener = signal::unix::signal(kind)?;
if sig_listener.recv().await.is_some() {
Ok(())
} else {
// Use pending() here for the same reason as above.
std::future::pending().await
}
}
pub fn ignore_signals_on_unix() -> Result<(), io::Error> {
drop(signal(SignalKind::user_defined1())?);
drop(signal(SignalKind::user_defined2())?);
Ok(())
}
}

56
crates/bin/src/ui.rs Normal file
View file

@ -0,0 +1,56 @@
use std::{
io::{self, BufRead, StdinLock, Write},
thread,
};
use binstalk::errors::BinstallError;
use tokio::sync::oneshot;
fn ask_for_confirm(stdin: &mut StdinLock, input: &mut String) -> io::Result<()> {
{
let mut stdout = io::stdout().lock();
write!(&mut stdout, "Do you wish to continue? [yes]/no\n? ")?;
stdout.flush()?;
}
stdin.read_line(input)?;
Ok(())
}
pub async fn confirm() -> Result<(), BinstallError> {
let (tx, rx) = oneshot::channel();
thread::spawn(move || {
// This task should be the only one able to
// access stdin
let mut stdin = io::stdin().lock();
let mut input = String::with_capacity(16);
let res = loop {
if ask_for_confirm(&mut stdin, &mut input).is_err() {
break false;
}
match input.as_str().trim() {
"yes" | "y" | "YES" | "Y" | "" => break true,
"no" | "n" | "NO" | "N" => break false,
_ => {
input.clear();
continue;
}
}
};
// The main thread might be terminated by signal and thus cancelled
// the confirmation.
tx.send(res).ok();
});
if rx.await.unwrap() {
Ok(())
} else {
Err(BinstallError::UserAbort)
}
}

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
type="win32"
name="Binstall.Cli.binstall"
version="1.12.3.0"
/>
<trustInfo>
<security>
<!--
UAC settings:
- app should run at same integrity level as calling process
- app does not need to manipulate windows belonging to
higher-integrity-level processes
-->
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10, 11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws="http://schemas.microsoft.com/SMI/2020/WindowsSettings">
<ws:longPathAware xmlns:ws="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</ws:longPathAware>
<ws:activeCodePage xmlns:ws="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</ws:activeCodePage>
<ws:heapType xmlns:ws="http://schemas.microsoft.com/SMI/2020/WindowsSettings">SegmentHeap</ws:heapType>
</windowsSettings>
</application>
</assembly>

View file

@ -0,0 +1,90 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.6.13](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.12...binstalk-bins-v0.6.13) - 2025-03-19
### Other
- updated the following local packages: atomic-file-install
## [0.6.12](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.11...binstalk-bins-v0.6.12) - 2025-03-07
### Other
- *(deps)* bump the deps group with 3 updates ([#2072](https://github.com/cargo-bins/cargo-binstall/pull/2072))
## [0.6.11](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.10...binstalk-bins-v0.6.11) - 2025-02-22
### Other
- updated the following local packages: atomic-file-install
## [0.6.10](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.9...binstalk-bins-v0.6.10) - 2025-02-11
### Other
- updated the following local packages: binstalk-types
## [0.6.9](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.8...binstalk-bins-v0.6.9) - 2025-01-19
### Other
- update Cargo.lock dependencies
## [0.6.8](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.7...binstalk-bins-v0.6.8) - 2025-01-13
### Other
- update Cargo.lock dependencies
## [0.6.7](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.6...binstalk-bins-v0.6.7) - 2025-01-11
### Other
- *(deps)* bump the deps group with 3 updates (#2015)
## [0.6.6](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.5...binstalk-bins-v0.6.6) - 2024-12-14
### Other
- *(deps)* bump the deps group with 2 updates (#1997)
## [0.6.5](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.4...binstalk-bins-v0.6.5) - 2024-11-23
### Other
- updated the following local packages: binstalk-types
## [0.6.4](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.3...binstalk-bins-v0.6.4) - 2024-11-18
### Other
- updated the following local packages: atomic-file-install
## [0.6.3](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.2...binstalk-bins-v0.6.3) - 2024-11-09
### Other
- *(deps)* bump the deps group with 3 updates ([#1966](https://github.com/cargo-bins/cargo-binstall/pull/1966))
## [0.6.2](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.1...binstalk-bins-v0.6.2) - 2024-11-05
### Other
- *(deps)* bump the deps group with 3 updates ([#1954](https://github.com/cargo-bins/cargo-binstall/pull/1954))
## [0.6.1](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.6.0...binstalk-bins-v0.6.1) - 2024-11-02
### Other
- Improve UI orompt for installation ([#1950](https://github.com/cargo-bins/cargo-binstall/pull/1950))
## [0.6.0](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-bins-v0.5.0...binstalk-bins-v0.6.0) - 2024-08-10
### Other
- updated the following local packages: binstalk-types

View file

@ -0,0 +1,21 @@
[package]
name = "binstalk-bins"
version = "0.6.13"
edition = "2021"
description = "The binstall binaries discovery and installation crate."
repository = "https://github.com/cargo-bins/cargo-binstall"
documentation = "https://docs.rs/binstalk-bins"
rust-version = "1.65.0"
authors = ["Jiahao XU <Jiahao_XU@outlook.com>"]
license = "GPL-3.0-only"
[dependencies]
atomic-file-install = { version = "1.0.11", path = "../atomic-file-install" }
binstalk-types = { version = "0.9.4", path = "../binstalk-types" }
compact_str = { version = "0.9.0", features = ["serde"] }
leon = "3.0.0"
miette = "7.0.0"
normalize-path = { version = "0.2.1", path = "../normalize-path" }
thiserror = "2.0.11"
tracing = "0.1.39"

View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View file

@ -0,0 +1,369 @@
use std::{
borrow::Cow,
fmt, io,
path::{self, Component, Path, PathBuf},
};
use atomic_file_install::{
atomic_install, atomic_install_noclobber, atomic_symlink_file, atomic_symlink_file_noclobber,
};
use binstalk_types::cargo_toml_binstall::{PkgFmt, PkgMeta};
use compact_str::{format_compact, CompactString};
use leon::Template;
use miette::Diagnostic;
use normalize_path::NormalizePath;
use thiserror::Error as ThisError;
use tracing::debug;
#[derive(Debug, ThisError, Diagnostic)]
pub enum Error {
/// bin-dir configuration provided generates source path outside
/// of the temporary dir.
#[error(
"bin-dir configuration provided generates source path outside of the temporary dir: {}", .0.display()
)]
InvalidSourceFilePath(Box<Path>),
/// bin-dir configuration provided generates empty source path.
#[error("bin-dir configuration provided generates empty source path")]
EmptySourceFilePath,
/// Bin file is not found.
#[error("bin file {} not found", .0.display())]
BinFileNotFound(Box<Path>),
#[error(transparent)]
Io(#[from] io::Error),
#[error("Failed to render template: {0}")]
#[diagnostic(transparent)]
TemplateRender(#[from] leon::RenderError),
}
/// Return true if the path does not look outside of current dir
///
/// * `path` - must be normalized before passing to this function
fn is_valid_path(path: &Path) -> bool {
!matches!(
path.components().next(),
// normalized path cannot have curdir or parentdir,
// so checking prefix/rootdir is enough.
Some(Component::Prefix(..) | Component::RootDir)
)
}
/// Must be called after the archive is downloaded and extracted.
/// This function might uses blocking I/O.
pub fn infer_bin_dir_template(
data: &Data,
has_dir: &mut dyn FnMut(&Path) -> bool,
) -> Cow<'static, str> {
let name = data.name;
let target = data.target;
let version = data.version;
// Make sure to update
// fetchers::gh_crate_meta::hosting::{FULL_FILENAMES,
// NOVERSION_FILENAMES} if you update this array.
let gen_possible_dirs: [for<'r> fn(&'r str, &'r str, &'r str) -> String; 8] = [
|name, target, version| format!("{name}-{target}-v{version}"),
|name, target, version| format!("{name}-{target}-{version}"),
|name, target, version| format!("{name}-{version}-{target}"),
|name, target, version| format!("{name}-v{version}-{target}"),
|name, target, _version| format!("{name}-{target}"),
// Ignore the following when updating hosting::{FULL_FILENAMES, NOVERSION_FILENAMES}
|name, _target, version| format!("{name}-{version}"),
|name, _target, version| format!("{name}-v{version}"),
|name, _target, _version| name.to_string(),
];
let default_bin_dir_template = Cow::Borrowed("{ bin }{ binary-ext }");
gen_possible_dirs
.into_iter()
.map(|gen_possible_dir| gen_possible_dir(name, target, version))
.find(|dirname| has_dir(Path::new(&dirname)))
.map(|mut dir| {
dir.reserve_exact(1 + default_bin_dir_template.len());
dir += "/";
dir += &default_bin_dir_template;
Cow::Owned(dir)
})
// Fallback to no dir
.unwrap_or(default_bin_dir_template)
}
pub struct BinFile {
pub base_name: CompactString,
pub source: PathBuf,
pub archive_source_path: PathBuf,
pub dest: PathBuf,
pub link: Option<PathBuf>,
}
impl BinFile {
/// * `tt` - must have a template with name "bin_dir"
pub fn new(
data: &Data<'_>,
base_name: &str,
tt: &Template<'_>,
no_symlinks: bool,
) -> Result<Self, Error> {
let binary_ext = if data.target.contains("windows") {
".exe"
} else {
""
};
let ctx = Context {
name: data.name,
repo: data.repo,
target: data.target,
version: data.version,
bin: base_name,
binary_ext,
target_related_info: data.target_related_info,
};
let (source, archive_source_path) = if data.meta.pkg_fmt == Some(PkgFmt::Bin) {
(
data.bin_path.to_path_buf(),
data.bin_path.file_name().unwrap().into(),
)
} else {
// Generate install paths
// Source path is the download dir + the generated binary path
let path = tt.render(&ctx)?;
let path_normalized = Path::new(&path).normalize();
if path_normalized.components().next().is_none() {
return Err(Error::EmptySourceFilePath);
}
if !is_valid_path(&path_normalized) {
return Err(Error::InvalidSourceFilePath(path_normalized.into()));
}
(data.bin_path.join(&path_normalized), path_normalized)
};
// Destination at install dir + base-name{.extension}
let mut dest = data.install_path.join(ctx.bin);
if !binary_ext.is_empty() {
let binary_ext = binary_ext.strip_prefix('.').unwrap();
// PathBuf::set_extension returns false if Path::file_name
// is None, but we know that the file name must be Some,
// thus we assert! the return value here.
assert!(dest.set_extension(binary_ext));
}
let (dest, link) = if no_symlinks {
(dest, None)
} else {
// Destination path is the install dir + base-name-version{.extension}
let dest_file_path_with_ver = format!("{}-v{}{}", ctx.bin, ctx.version, ctx.binary_ext);
let dest_with_ver = data.install_path.join(dest_file_path_with_ver);
(dest_with_ver, Some(dest))
};
Ok(Self {
base_name: format_compact!("{base_name}{binary_ext}"),
source,
archive_source_path,
dest,
link,
})
}
pub fn preview_bin(&self) -> impl fmt::Display + '_ {
struct PreviewBin<'a> {
base_name: &'a str,
dest: path::Display<'a>,
}
impl fmt::Display for PreviewBin<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{} => {}", self.base_name, self.dest)
}
}
PreviewBin {
base_name: &self.base_name,
dest: self.dest.display(),
}
}
pub fn preview_link(&self) -> impl fmt::Display + '_ {
OptionalLazyFormat(self.link.as_ref().map(|link| LazyFormat {
base_name: &self.base_name,
source: link.display(),
dest: self.link_dest().display(),
}))
}
/// Return `Ok` if the source exists, otherwise `Err`.
pub fn check_source_exists(
&self,
has_file: &mut dyn FnMut(&Path) -> bool,
) -> Result<(), Error> {
if has_file(&self.archive_source_path) {
Ok(())
} else {
Err(Error::BinFileNotFound((&*self.source).into()))
}
}
fn pre_install_bin(&self) -> Result<(), Error> {
if !self.source.try_exists()? {
return Err(Error::BinFileNotFound((&*self.source).into()));
}
#[cfg(unix)]
std::fs::set_permissions(
&self.source,
std::os::unix::fs::PermissionsExt::from_mode(0o755),
)?;
Ok(())
}
pub fn install_bin(&self) -> Result<(), Error> {
self.pre_install_bin()?;
debug!(
"Atomically install file from '{}' to '{}'",
self.source.display(),
self.dest.display()
);
atomic_install(&self.source, &self.dest)?;
Ok(())
}
pub fn install_bin_noclobber(&self) -> Result<(), Error> {
self.pre_install_bin()?;
debug!(
"Installing file from '{}' to '{}' only if dst not exists",
self.source.display(),
self.dest.display()
);
atomic_install_noclobber(&self.source, &self.dest)?;
Ok(())
}
pub fn install_link(&self) -> Result<(), Error> {
if let Some(link) = &self.link {
let dest = self.link_dest();
debug!(
"Create link '{}' pointing to '{}'",
link.display(),
dest.display()
);
atomic_symlink_file(dest, link)?;
}
Ok(())
}
pub fn install_link_noclobber(&self) -> Result<(), Error> {
if let Some(link) = &self.link {
let dest = self.link_dest();
debug!(
"Create link '{}' pointing to '{}' only if dst not exists",
link.display(),
dest.display()
);
atomic_symlink_file_noclobber(dest, link)?;
}
Ok(())
}
fn link_dest(&self) -> &Path {
if cfg!(target_family = "unix") {
Path::new(self.dest.file_name().unwrap())
} else {
&self.dest
}
}
}
/// Data required to get bin paths
pub struct Data<'a> {
pub name: &'a str,
pub target: &'a str,
pub version: &'a str,
pub repo: Option<&'a str>,
pub meta: PkgMeta,
pub bin_path: &'a Path,
pub install_path: &'a Path,
/// More target related info, it's recommend to provide the following keys:
/// - target_family,
/// - target_arch
/// - target_libc
/// - target_vendor
pub target_related_info: &'a dyn leon::Values,
}
#[derive(Clone)]
struct Context<'c> {
name: &'c str,
repo: Option<&'c str>,
target: &'c str,
version: &'c str,
bin: &'c str,
/// Filename extension on the binary, i.e. .exe on Windows, nothing otherwise
binary_ext: &'c str,
target_related_info: &'c dyn leon::Values,
}
impl leon::Values for Context<'_> {
fn get_value<'s>(&'s self, key: &str) -> Option<Cow<'s, str>> {
match key {
"name" => Some(Cow::Borrowed(self.name)),
"repo" => self.repo.map(Cow::Borrowed),
"target" => Some(Cow::Borrowed(self.target)),
"version" => Some(Cow::Borrowed(self.version)),
"bin" => Some(Cow::Borrowed(self.bin)),
"binary-ext" => Some(Cow::Borrowed(self.binary_ext)),
// Soft-deprecated alias for binary-ext
"format" => Some(Cow::Borrowed(self.binary_ext)),
key => self.target_related_info.get_value(key),
}
}
}
struct LazyFormat<'a> {
base_name: &'a str,
source: path::Display<'a>,
dest: path::Display<'a>,
}
impl fmt::Display for LazyFormat<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{} ({} -> {})", self.base_name, self.source, self.dest)
}
}
struct OptionalLazyFormat<'a>(Option<LazyFormat<'a>>);
impl fmt::Display for OptionalLazyFormat<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(lazy_format) = self.0.as_ref() {
fmt::Display::fmt(lazy_format, f)
} else {
Ok(())
}
}
}

View file

@ -0,0 +1,116 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.13.17](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.16...binstalk-downloader-v0.13.17) - 2025-04-05
### Other
- Fix clippy lints ([#2111](https://github.com/cargo-bins/cargo-binstall/pull/2111))
## [0.13.16](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.15...binstalk-downloader-v0.13.16) - 2025-03-19
### Other
- Fix clippy warnings for detect-targets and binstalk-downloader ([#2098](https://github.com/cargo-bins/cargo-binstall/pull/2098))
- Bump hickory-resolver to 0.25.1 ([#2096](https://github.com/cargo-bins/cargo-binstall/pull/2096))
## [0.13.15](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.14...binstalk-downloader-v0.13.15) - 2025-03-15
### Other
- *(deps)* bump the deps group with 2 updates ([#2084](https://github.com/cargo-bins/cargo-binstall/pull/2084))
- *(deps)* bump tokio from 1.43.0 to 1.44.0 in the deps group ([#2079](https://github.com/cargo-bins/cargo-binstall/pull/2079))
## [0.13.14](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.13...binstalk-downloader-v0.13.14) - 2025-03-07
### Other
- Use bzip2/libbz2-rs-sys ([#2071](https://github.com/cargo-bins/cargo-binstall/pull/2071))
- *(deps)* bump the deps group with 3 updates ([#2072](https://github.com/cargo-bins/cargo-binstall/pull/2072))
## [0.13.13](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.12...binstalk-downloader-v0.13.13) - 2025-02-28
### Other
- Use flate2/zlib-rs for dev/release build ([#2068](https://github.com/cargo-bins/cargo-binstall/pull/2068))
## [0.13.12](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.11...binstalk-downloader-v0.13.12) - 2025-02-11
### Other
- Upgrade hickory-resolver to 0.25.0-alpha.5 ([#2038](https://github.com/cargo-bins/cargo-binstall/pull/2038))
## [0.13.11](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.10...binstalk-downloader-v0.13.11) - 2025-02-04
### Added
- *(downloader)* allow remote::Client to be customised (#2035)
## [0.13.10](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.9...binstalk-downloader-v0.13.10) - 2025-01-19
### Other
- update Cargo.lock dependencies
## [0.13.9](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.8...binstalk-downloader-v0.13.9) - 2025-01-13
### Other
- update Cargo.lock dependencies
## [0.13.8](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.7...binstalk-downloader-v0.13.8) - 2025-01-11
### Other
- *(deps)* bump the deps group with 3 updates (#2015)
## [0.13.7](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.6...binstalk-downloader-v0.13.7) - 2025-01-04
### Other
- *(deps)* bump the deps group with 2 updates (#2010)
## [0.13.6](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.5...binstalk-downloader-v0.13.6) - 2024-12-14
### Other
- *(deps)* bump the deps group with 2 updates (#1997)
## [0.13.5](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.4...binstalk-downloader-v0.13.5) - 2024-11-23
### Other
- *(deps)* bump the deps group with 2 updates ([#1981](https://github.com/cargo-bins/cargo-binstall/pull/1981))
## [0.13.4](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.3...binstalk-downloader-v0.13.4) - 2024-11-09
### Other
- *(deps)* bump the deps group with 3 updates ([#1966](https://github.com/cargo-bins/cargo-binstall/pull/1966))
## [0.13.3](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.2...binstalk-downloader-v0.13.3) - 2024-11-05
### Other
- *(deps)* bump the deps group with 3 updates ([#1954](https://github.com/cargo-bins/cargo-binstall/pull/1954))
## [0.13.2](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.1...binstalk-downloader-v0.13.2) - 2024-11-02
### Other
- Use rc-zip-sync for zip extraction ([#1942](https://github.com/cargo-bins/cargo-binstall/pull/1942))
## [0.13.1](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.13.0...binstalk-downloader-v0.13.1) - 2024-08-12
### Other
- Enable happy eyeballs when using hickory-dns ([#1877](https://github.com/cargo-bins/cargo-binstall/pull/1877))
## [0.13.0](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-downloader-v0.12.0...binstalk-downloader-v0.13.0) - 2024-08-10
### Other
- Bump hickory-resolver to 0.25.0-alpha.2 ([#1869](https://github.com/cargo-bins/cargo-binstall/pull/1869))

View file

@ -0,0 +1,138 @@
[package]
name = "binstalk-downloader"
description = "The binstall toolkit for downloading and extracting file"
repository = "https://github.com/cargo-bins/cargo-binstall"
documentation = "https://docs.rs/binstalk-downloader"
version = "0.13.17"
rust-version = "1.79.0"
authors = ["ryan <ryan@kurte.nz>"]
edition = "2021"
license = "Apache-2.0 OR MIT"
[dependencies]
async-trait = "0.1.88"
async-compression = { version = "0.4.4", features = [
"gzip",
"zstd",
"xz",
"bzip2",
"tokio",
] }
binstalk-types = { version = "0.9.4", path = "../binstalk-types" }
bytes = "1.4.0"
bzip2 = { version = "0.5.2", default-features = false, features = [
"libbz2-rs-sys",
] }
cfg-if = "1"
compact_str = "0.9.0"
flate2 = { version = "1.0.28", default-features = false }
futures-util = "0.3.30"
futures-io = "0.3.30"
httpdate = "1.0.2"
rc-zip-sync = { version = "4.2.6", features = [
"deflate",
"bzip2",
"deflate64",
"lzma",
"zstd",
] }
reqwest = { version = "0.12.5", features = [
"http2",
"stream",
"zstd",
"gzip",
"brotli",
"deflate",
], default-features = false }
serde = { version = "1.0.163", features = ["derive"], optional = true }
serde_json = { version = "1.0.107", optional = true }
# Use a fork here since we need PAX support, but the upstream
# does not hav the PR merged yet.
#
#tar = "0.4.38"
tar = { package = "binstall-tar", version = "0.4.39" }
tempfile = "3.5.0"
thiserror = "2.0.11"
tokio = { version = "1.44.0", features = [
"macros",
"rt-multi-thread",
"sync",
"time",
"fs",
], default-features = false }
tokio-tar = "0.3.0"
tokio-util = { version = "0.7.8", features = ["io"] }
tracing = "0.1.39"
hickory-resolver = { version = "0.25.1", optional = true, features = [
"dnssec-ring",
] }
once_cell = { version = "1.18.0", optional = true }
url = "2.5.4"
xz2 = "0.1.7"
# zstd is also depended by zip.
# Since zip 0.6.3 depends on zstd 0.11, we can use 0.12.0 here
# because it uses the same zstd-sys version.
# Otherwise there will be a link conflict.
zstd = { version = "0.13.2", default-features = false }
[target."cfg(not(target_arch = \"wasm32\"))".dependencies.native-tls-crate]
optional = true
package = "native-tls"
# The version must be kept in sync of reqwest
version = "0.2.10"
[features]
default = ["static", "rustls"]
static = ["bzip2/static", "xz2/static", "native-tls-crate?/vendored"]
pkg-config = ["zstd/pkg-config"]
zlib-ng = ["flate2/zlib-ng"]
zlib-rs = ["flate2/zlib-rs"]
# Dummy feature, enabled if rustls or native-tls is enabled.
# Used to avoid compilation error when no feature is enabled.
__tls = []
rustls = [
"__tls",
"reqwest/rustls-tls",
"reqwest/rustls-tls-webpki-roots",
"reqwest/rustls-tls-native-roots",
# Enable the following features only if hickory-resolver is enabled.
"hickory-resolver?/tls-ring",
# hickory-resolver currently supports https with rustls
"hickory-resolver?/https-ring",
"hickory-resolver?/quic-ring",
"hickory-resolver?/h3-ring",
]
native-tls = ["__tls", "native-tls-crate", "reqwest/native-tls"]
# Enable hickory-resolver so that features on it will also be enabled.
hickory-dns = ["hickory-resolver", "default-net", "ipconfig", "once_cell"]
# Deprecated alias for hickory-dns, since trust-dns is renamed to hickory-dns
trust-dns = ["hickory-dns"]
# HTTP3 is temporarily disabled by reqwest.
#
# Experimental HTTP/3 client, this would require `--cfg reqwest_unstable`
# to be passed to `rustc`.
http3 = ["reqwest/http3"]
zstd-thin = ["zstd/thin"]
cross-lang-fat-lto = ["zstd/fat-lto"]
json = ["serde", "serde_json"]
[target."cfg(windows)".dependencies]
default-net = { version = "0.22.0", optional = true }
ipconfig = { version = "0.3.2", optional = true, default-features = false }
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]

View file

@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

View file

@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,408 @@
use std::{fmt, io, path::Path};
use binstalk_types::cargo_toml_binstall::PkgFmtDecomposed;
use bytes::Bytes;
use futures_util::{stream::FusedStream, Stream, StreamExt};
use thiserror::Error as ThisError;
use tracing::{debug, error, instrument};
pub use binstalk_types::cargo_toml_binstall::{PkgFmt, TarBasedFmt};
pub use rc_zip_sync::rc_zip::error::Error as ZipError;
use crate::remote::{Client, Error as RemoteError, Response, Url};
mod async_extracter;
use async_extracter::*;
mod async_tar_visitor;
use async_tar_visitor::extract_tar_based_stream_and_visit;
pub use async_tar_visitor::{TarEntriesVisitor, TarEntry, TarEntryType};
mod extracter;
mod extracted_files;
pub use extracted_files::{ExtractedFiles, ExtractedFilesEntry};
mod zip_extraction;
#[derive(Debug, ThisError)]
#[non_exhaustive]
pub enum DownloadError {
#[error("Failed to extract zipfile: {0}")]
Unzip(#[from] ZipError),
#[error("Failed to download from remote: {0}")]
Remote(#[from] RemoteError),
/// A generic I/O error.
///
/// - Code: `binstall::io`
/// - Exit: 74
#[error("I/O Error: {0}")]
Io(io::Error),
}
impl From<io::Error> for DownloadError {
fn from(err: io::Error) -> Self {
err.downcast::<DownloadError>()
.unwrap_or_else(DownloadError::Io)
}
}
impl From<DownloadError> for io::Error {
fn from(e: DownloadError) -> io::Error {
match e {
DownloadError::Io(io_error) => io_error,
e => io::Error::new(io::ErrorKind::Other, e),
}
}
}
pub trait DataVerifier: Send + Sync {
/// Digest input data.
///
/// This method can be called repeatedly for use with streaming messages,
/// it will be called in the order of the message received.
fn update(&mut self, data: &Bytes);
/// Finalise the data verification.
///
/// Return false if the data is invalid.
fn validate(&mut self) -> bool;
}
impl DataVerifier for () {
fn update(&mut self, _: &Bytes) {}
fn validate(&mut self) -> bool {
true
}
}
#[derive(Debug)]
enum DownloadContent {
ToIssue { client: Client, url: Url },
Response(Response),
}
impl DownloadContent {
async fn into_response(self) -> Result<Response, DownloadError> {
Ok(match self {
DownloadContent::ToIssue { client, url } => client.get(url).send(true).await?,
DownloadContent::Response(response) => response,
})
}
}
pub struct Download<'a> {
content: DownloadContent,
data_verifier: Option<&'a mut dyn DataVerifier>,
}
impl fmt::Debug for Download<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.content, f)
}
}
impl Download<'static> {
pub fn new(client: Client, url: Url) -> Self {
Self {
content: DownloadContent::ToIssue { client, url },
data_verifier: None,
}
}
pub fn from_response(response: Response) -> Self {
Self {
content: DownloadContent::Response(response),
data_verifier: None,
}
}
}
impl<'a> Download<'a> {
pub fn new_with_data_verifier(
client: Client,
url: Url,
data_verifier: &'a mut dyn DataVerifier,
) -> Self {
Self {
content: DownloadContent::ToIssue { client, url },
data_verifier: Some(data_verifier),
}
}
pub fn from_response_with_data_verifier(
response: Response,
data_verifier: &'a mut dyn DataVerifier,
) -> Self {
Self {
content: DownloadContent::Response(response),
data_verifier: Some(data_verifier),
}
}
pub fn with_data_verifier(self, data_verifier: &mut dyn DataVerifier) -> Download<'_> {
Download {
content: self.content,
data_verifier: Some(data_verifier),
}
}
async fn get_stream(
self,
) -> Result<
impl FusedStream<Item = Result<Bytes, DownloadError>> + Send + Sync + Unpin + 'a,
DownloadError,
> {
let mut data_verifier = self.data_verifier;
Ok(self
.content
.into_response()
.await?
.bytes_stream()
.map(move |res| {
let bytes = res?;
if let Some(data_verifier) = &mut data_verifier {
data_verifier.update(&bytes);
}
Ok(bytes)
})
// Call `fuse` at the end to make sure `data_verifier` is only
// called when the stream still has elements left.
.fuse())
}
}
/// Make sure `stream` is an alias instead of taking the value to avoid
/// exploding size of the future generated.
///
/// Accept `FusedStream` only since the `stream` could be already consumed.
async fn consume_stream<S>(stream: &mut S)
where
S: Stream<Item = Result<Bytes, DownloadError>> + FusedStream + Unpin,
{
while let Some(res) = stream.next().await {
if let Err(err) = res {
error!(?err, "failed to consume stream");
break;
}
}
}
impl Download<'_> {
/// Download a file from the provided URL and process it in memory.
///
/// This does not support verifying a checksum due to the partial extraction
/// and will ignore one if specified.
///
/// NOTE that this API does not support gnu extension sparse file unlike
/// [`Download::and_extract`].
#[instrument(skip(self, visitor))]
pub async fn and_visit_tar(
self,
fmt: TarBasedFmt,
visitor: &mut dyn TarEntriesVisitor,
) -> Result<(), DownloadError> {
let has_data_verifier = self.data_verifier.is_some();
let mut stream = self.get_stream().await?;
debug!("Downloading and extracting then in-memory processing");
let res = extract_tar_based_stream_and_visit(&mut stream, fmt, visitor).await;
if has_data_verifier {
consume_stream(&mut stream).await;
}
if res.is_ok() {
debug!("Download, extraction and in-memory procession OK");
}
res
}
/// Download a file from the provided URL and extract it to the provided path.
///
/// NOTE that this will only extract directory and regular files.
#[instrument(
skip(self, path),
fields(path = format_args!("{}", path.as_ref().display()))
)]
pub async fn and_extract(
self,
fmt: PkgFmt,
path: impl AsRef<Path>,
) -> Result<ExtractedFiles, DownloadError> {
async fn inner(
this: Download<'_>,
fmt: PkgFmt,
path: &Path,
) -> Result<ExtractedFiles, DownloadError> {
let has_data_verifier = this.data_verifier.is_some();
let mut stream = this.get_stream().await?;
debug!("Downloading and extracting to: '{}'", path.display());
let res = match fmt.decompose() {
PkgFmtDecomposed::Tar(fmt) => {
extract_tar_based_stream(&mut stream, path, fmt).await
}
PkgFmtDecomposed::Bin => extract_bin(&mut stream, path).await,
PkgFmtDecomposed::Zip => extract_zip(&mut stream, path).await,
};
if has_data_verifier {
consume_stream(&mut stream).await;
}
if res.is_ok() {
debug!("Download OK, extracted to: '{}'", path.display());
}
res
}
inner(self, fmt, path.as_ref()).await
}
#[instrument(skip(self))]
pub async fn into_bytes(self) -> Result<Bytes, DownloadError> {
let bytes = self.content.into_response().await?.bytes().await?;
if let Some(verifier) = self.data_verifier {
verifier.update(&bytes);
}
Ok(bytes)
}
}
#[cfg(test)]
mod test {
use super::*;
use std::{
collections::{HashMap, HashSet},
ffi::OsStr,
num::NonZeroU16,
};
use tempfile::tempdir;
#[tokio::test]
async fn test_and_extract() {
let client = crate::remote::Client::new(
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")),
None,
NonZeroU16::new(10).unwrap(),
1.try_into().unwrap(),
[],
)
.unwrap();
// cargo-binstall
let cargo_binstall_url = "https://github.com/cargo-bins/cargo-binstall/releases/download/v0.20.1/cargo-binstall-aarch64-unknown-linux-musl.tgz";
let extracted_files =
Download::new(client.clone(), Url::parse(cargo_binstall_url).unwrap())
.and_extract(PkgFmt::Tgz, tempdir().unwrap())
.await
.unwrap();
assert!(extracted_files.has_file(Path::new("cargo-binstall")));
assert!(!extracted_files.has_file(Path::new("1234")));
let files = HashSet::from([OsStr::new("cargo-binstall").into()]);
assert_eq!(extracted_files.get_dir(Path::new(".")).unwrap(), &files);
assert_eq!(
extracted_files.0,
HashMap::from([
(
Path::new("cargo-binstall").into(),
ExtractedFilesEntry::File
),
(
Path::new(".").into(),
ExtractedFilesEntry::Dir(Box::new(files))
)
])
);
// cargo-watch
let cargo_watch_url = "https://github.com/watchexec/cargo-watch/releases/download/v8.4.0/cargo-watch-v8.4.0-aarch64-unknown-linux-gnu.tar.xz";
let extracted_files = Download::new(client.clone(), Url::parse(cargo_watch_url).unwrap())
.and_extract(PkgFmt::Txz, tempdir().unwrap())
.await
.unwrap();
let dir = Path::new("cargo-watch-v8.4.0-aarch64-unknown-linux-gnu");
assert_eq!(
extracted_files.get_dir(Path::new(".")).unwrap(),
&HashSet::from([dir.as_os_str().into()])
);
assert_eq!(
extracted_files.get_dir(dir).unwrap(),
&HashSet::from_iter(
[
"README.md",
"LICENSE",
"completions",
"cargo-watch",
"cargo-watch.1"
]
.iter()
.map(OsStr::new)
.map(Box::<OsStr>::from)
),
);
assert_eq!(
extracted_files.get_dir(&dir.join("completions")).unwrap(),
&HashSet::from([OsStr::new("zsh").into()]),
);
assert!(extracted_files.has_file(&dir.join("cargo-watch")));
assert!(extracted_files.has_file(&dir.join("cargo-watch.1")));
assert!(extracted_files.has_file(&dir.join("LICENSE")));
assert!(extracted_files.has_file(&dir.join("README.md")));
assert!(!extracted_files.has_file(&dir.join("completions")));
assert!(!extracted_files.has_file(&dir.join("asdfcqwe")));
assert!(extracted_files.has_file(&dir.join("completions/zsh")));
// sccache, tgz and zip
let sccache_config = [
("https://github.com/mozilla/sccache/releases/download/v0.3.3/sccache-v0.3.3-x86_64-pc-windows-msvc.tar.gz", PkgFmt::Tgz),
("https://github.com/mozilla/sccache/releases/download/v0.3.3/sccache-v0.3.3-x86_64-pc-windows-msvc.zip", PkgFmt::Zip),
];
for (sccache_url, fmt) in sccache_config {
let extracted_files = Download::new(client.clone(), Url::parse(sccache_url).unwrap())
.and_extract(fmt, tempdir().unwrap())
.await
.unwrap();
let dir = Path::new("sccache-v0.3.3-x86_64-pc-windows-msvc");
assert_eq!(
extracted_files.get_dir(Path::new(".")).unwrap(),
&HashSet::from([dir.as_os_str().into()])
);
assert_eq!(
extracted_files.get_dir(dir).unwrap(),
&HashSet::from_iter(
["README.md", "LICENSE", "sccache.exe"]
.iter()
.map(OsStr::new)
.map(Box::<OsStr>::from)
),
);
}
}
}

View file

@ -0,0 +1,167 @@
use std::{
borrow::Cow,
fs,
future::Future,
io::{self, Write},
path::{Component, Path, PathBuf},
};
use bytes::Bytes;
use futures_util::Stream;
use tempfile::tempfile as create_tmpfile;
use tokio::sync::mpsc;
use tracing::debug;
use super::{extracter::*, DownloadError, ExtractedFiles, TarBasedFmt};
use crate::{
download::zip_extraction::do_extract_zip,
utils::{extract_with_blocking_task, StreamReadable},
};
pub async fn extract_bin<S>(stream: S, path: &Path) -> Result<ExtractedFiles, DownloadError>
where
S: Stream<Item = Result<Bytes, DownloadError>> + Send + Sync + Unpin,
{
debug!("Writing to `{}`", path.display());
extract_with_blocking_decoder(stream, path, |rx, path| {
let mut extracted_files = ExtractedFiles::new();
extracted_files.add_file(Path::new(path.file_name().unwrap()));
write_stream_to_file(rx, fs::File::create(path)?)?;
Ok(extracted_files)
})
.await
}
pub async fn extract_zip<S>(stream: S, path: &Path) -> Result<ExtractedFiles, DownloadError>
where
S: Stream<Item = Result<Bytes, DownloadError>> + Unpin + Send + Sync,
{
debug!("Downloading from zip archive to tempfile");
extract_with_blocking_decoder(stream, path, |rx, path| {
debug!("Decompressing from zip archive to `{}`", path.display());
do_extract_zip(write_stream_to_file(rx, create_tmpfile()?)?, path).map_err(io::Error::from)
})
.await
}
pub async fn extract_tar_based_stream<S>(
stream: S,
dst: &Path,
fmt: TarBasedFmt,
) -> Result<ExtractedFiles, DownloadError>
where
S: Stream<Item = Result<Bytes, DownloadError>> + Send + Sync + Unpin,
{
debug!("Extracting from {fmt} archive to {}", dst.display());
extract_with_blocking_decoder(stream, dst, move |rx, dst| {
// Adapted from https://docs.rs/tar/latest/src/tar/archive.rs.html#189-219
if dst.symlink_metadata().is_err() {
fs::create_dir_all(dst)?;
}
// Canonicalizing the dst directory will prepend the path with '\\?\'
// on windows which will allow windows APIs to treat the path as an
// extended-length path with a 32,767 character limit. Otherwise all
// unpacked paths over 260 characters will fail on creation with a
// NotFound exception.
let dst = &dst
.canonicalize()
.map(Cow::Owned)
.unwrap_or(Cow::Borrowed(dst));
let mut tar = create_tar_decoder(StreamReadable::new(rx), fmt)?;
let mut entries = tar.entries()?;
let mut extracted_files = ExtractedFiles::new();
// Delay any directory entries until the end (they will be created if needed by
// descendants), to ensure that directory permissions do not interfer with descendant
// extraction.
let mut directories = Vec::new();
while let Some(mut entry) = entries.next().transpose()? {
match entry.header().entry_type() {
tar::EntryType::Regular => {
// unpack_in returns false if the path contains ".."
// and is skipped.
if entry.unpack_in(dst)? {
let path = entry.path()?;
// create normalized_path in the same way
// tar::Entry::unpack_in would normalize the path.
let mut normalized_path = PathBuf::new();
for part in path.components() {
match part {
Component::Prefix(..) | Component::RootDir | Component::CurDir => {
continue
}
// unpack_in would return false if this happens.
Component::ParentDir => unreachable!(),
Component::Normal(part) => normalized_path.push(part),
}
}
extracted_files.add_file(&normalized_path);
}
}
tar::EntryType::Directory => {
directories.push(entry);
}
_ => (),
}
}
for mut dir in directories {
if dir.unpack_in(dst)? {
extracted_files.add_dir(&dir.path()?);
}
}
Ok(extracted_files)
})
.await
}
fn extract_with_blocking_decoder<S, F, T>(
stream: S,
path: &Path,
f: F,
) -> impl Future<Output = Result<T, DownloadError>>
where
S: Stream<Item = Result<Bytes, DownloadError>> + Send + Sync + Unpin,
F: FnOnce(mpsc::Receiver<Bytes>, &Path) -> io::Result<T> + Send + Sync + 'static,
T: Send + 'static,
{
let path = path.to_owned();
extract_with_blocking_task(stream, move |rx| {
if let Some(parent) = path.parent() {
fs::create_dir_all(parent)?;
}
f(rx, &path)
})
}
fn write_stream_to_file(mut rx: mpsc::Receiver<Bytes>, f: fs::File) -> io::Result<fs::File> {
let mut f = io::BufWriter::new(f);
while let Some(bytes) = rx.blocking_recv() {
f.write_all(&bytes)?;
}
f.flush()?;
f.into_inner().map_err(io::IntoInnerError::into_error)
}

View file

@ -0,0 +1,125 @@
use std::{borrow::Cow, fmt::Debug, io, path::Path, pin::Pin};
use async_compression::tokio::bufread;
use bytes::Bytes;
use futures_util::{Stream, StreamExt};
use tokio::io::{copy, sink, AsyncRead};
use tokio_tar::{Archive, Entry, EntryType};
use tokio_util::io::StreamReader;
use tracing::debug;
use super::{
DownloadError,
TarBasedFmt::{self, *},
};
pub trait TarEntry: AsyncRead + Send + Sync + Unpin + Debug {
/// Returns the path name for this entry.
///
/// This method may fail if the pathname is not valid Unicode and
/// this is called on a Windows platform.
///
/// Note that this function will convert any `\` characters to
/// directory separators.
fn path(&self) -> io::Result<Cow<'_, Path>>;
fn size(&self) -> io::Result<u64>;
fn entry_type(&self) -> TarEntryType;
}
impl<T: TarEntry + ?Sized> TarEntry for &mut T {
fn path(&self) -> io::Result<Cow<'_, Path>> {
T::path(self)
}
fn size(&self) -> io::Result<u64> {
T::size(self)
}
fn entry_type(&self) -> TarEntryType {
T::entry_type(self)
}
}
impl<R: AsyncRead + Unpin + Send + Sync> TarEntry for Entry<R> {
fn path(&self) -> io::Result<Cow<'_, Path>> {
Entry::path(self)
}
fn size(&self) -> io::Result<u64> {
self.header().size()
}
fn entry_type(&self) -> TarEntryType {
match self.header().entry_type() {
EntryType::Regular => TarEntryType::Regular,
EntryType::Link => TarEntryType::Link,
EntryType::Symlink => TarEntryType::Symlink,
EntryType::Char => TarEntryType::Char,
EntryType::Block => TarEntryType::Block,
EntryType::Directory => TarEntryType::Directory,
EntryType::Fifo => TarEntryType::Fifo,
// Implementation-defined high-performance type, treated as regular file
EntryType::Continuous => TarEntryType::Regular,
_ => TarEntryType::Unknown,
}
}
}
#[derive(Copy, Clone, Debug)]
#[non_exhaustive]
pub enum TarEntryType {
Regular,
Link,
Symlink,
Char,
Block,
Directory,
Fifo,
Unknown,
}
/// Visitor must iterate over all entries.
/// Entires can be in arbitary order.
#[async_trait::async_trait]
pub trait TarEntriesVisitor: Send + Sync {
/// Will be called once per entry
async fn visit(&mut self, entry: &mut dyn TarEntry) -> Result<(), DownloadError>;
}
pub(crate) async fn extract_tar_based_stream_and_visit<S>(
stream: S,
fmt: TarBasedFmt,
visitor: &mut dyn TarEntriesVisitor,
) -> Result<(), DownloadError>
where
S: Stream<Item = Result<Bytes, DownloadError>> + Send + Sync,
{
debug!("Extracting from {fmt} archive to process it in memory");
let reader = StreamReader::new(stream);
let decoder: Pin<Box<dyn AsyncRead + Send + Sync>> = match fmt {
Tar => Box::pin(reader),
Tbz2 => Box::pin(bufread::BzDecoder::new(reader)),
Tgz => Box::pin(bufread::GzipDecoder::new(reader)),
Txz => Box::pin(bufread::XzDecoder::new(reader)),
Tzstd => Box::pin(bufread::ZstdDecoder::new(reader)),
};
let mut tar = Archive::new(decoder);
let mut entries = tar.entries()?;
let mut sink = sink();
while let Some(res) = entries.next().await {
let mut entry = res?;
visitor.visit(&mut entry).await?;
// Consume all remaining data so that next iteration would work fine
// instead of reading the data of prevoius entry.
copy(&mut entry, &mut sink).await?;
}
Ok(())
}

View file

@ -0,0 +1,108 @@
use std::{
collections::{hash_map::Entry as HashMapEntry, HashMap, HashSet},
ffi::OsStr,
path::Path,
};
#[derive(Debug)]
#[cfg_attr(test, derive(Eq, PartialEq))]
pub enum ExtractedFilesEntry {
Dir(Box<HashSet<Box<OsStr>>>),
File,
}
impl ExtractedFilesEntry {
fn new_dir(file_name: Option<&OsStr>) -> Self {
ExtractedFilesEntry::Dir(Box::new(
file_name
.map(|file_name| HashSet::from([file_name.into()]))
.unwrap_or_default(),
))
}
}
#[derive(Debug)]
pub struct ExtractedFiles(pub(super) HashMap<Box<Path>, ExtractedFilesEntry>);
impl ExtractedFiles {
pub(super) fn new() -> Self {
Self(Default::default())
}
/// * `path` - must be canonical and must not be empty
///
/// NOTE that if the entry for the `path` is previously set to a dir,
/// it would be replaced with a file.
pub(super) fn add_file(&mut self, path: &Path) {
self.0.insert(path.into(), ExtractedFilesEntry::File);
self.add_dir_if_has_parent(path);
}
fn add_dir_if_has_parent(&mut self, path: &Path) {
if let Some(parent) = path.parent() {
if !parent.as_os_str().is_empty() {
self.add_dir_inner(parent, path.file_name());
self.add_dir_if_has_parent(parent);
} else {
self.add_dir_inner(Path::new("."), path.file_name())
}
}
}
/// * `path` - must be canonical and must not be empty
///
/// NOTE that if the entry for the `path` is previously set to a dir,
/// it would be replaced with an empty Dir entry.
pub(super) fn add_dir(&mut self, path: &Path) {
self.add_dir_inner(path, None);
self.add_dir_if_has_parent(path);
}
/// * `path` - must be canonical and must not be empty
///
/// NOTE that if the entry for the `path` is previously set to a dir,
/// it would be replaced with a Dir entry containing `file_name` if it
/// is `Some(..)`, or an empty Dir entry.
fn add_dir_inner(&mut self, path: &Path, file_name: Option<&OsStr>) {
match self.0.entry(path.into()) {
HashMapEntry::Vacant(entry) => {
entry.insert(ExtractedFilesEntry::new_dir(file_name));
}
HashMapEntry::Occupied(entry) => match entry.into_mut() {
ExtractedFilesEntry::Dir(hash_set) => {
if let Some(file_name) = file_name {
hash_set.insert(file_name.into());
}
}
entry => *entry = ExtractedFilesEntry::new_dir(file_name),
},
}
}
/// * `path` - must be a relative path without `.`, `..`, `/`, `prefix:/`
/// and must not be empty, for these values it is guaranteed to
/// return `None`.
/// But could be set to "." for top-level.
pub fn get_entry(&self, path: &Path) -> Option<&ExtractedFilesEntry> {
self.0.get(path)
}
/// * `path` - must be a relative path without `.`, `..`, `/`, `prefix:/`
/// and must not be empty, for these values it is guaranteed to
/// return `None`.
/// But could be set to "." for top-level.
pub fn get_dir(&self, path: &Path) -> Option<&HashSet<Box<OsStr>>> {
match self.get_entry(path)? {
ExtractedFilesEntry::Dir(file_names) => Some(file_names),
ExtractedFilesEntry::File => None,
}
}
/// * `path` - must be a relative path without `.`, `..`, `/`, `prefix:/`
/// and must not be empty, for these values it is guaranteed to
/// return `false`.
/// But could be set to "." for top-level.
pub fn has_file(&self, path: &Path) -> bool {
matches!(self.get_entry(path), Some(ExtractedFilesEntry::File))
}
}

View file

@ -0,0 +1,31 @@
use std::io::{self, BufRead, Read};
use bzip2::bufread::BzDecoder;
use flate2::bufread::GzDecoder;
use tar::Archive;
use xz2::bufread::XzDecoder;
use zstd::stream::Decoder as ZstdDecoder;
use super::TarBasedFmt;
pub fn create_tar_decoder(
dat: impl BufRead + 'static,
fmt: TarBasedFmt,
) -> io::Result<Archive<Box<dyn Read>>> {
use TarBasedFmt::*;
let r: Box<dyn Read> = match fmt {
Tar => Box::new(dat),
Tbz2 => Box::new(BzDecoder::new(dat)),
Tgz => Box::new(GzDecoder::new(dat)),
Txz => Box::new(XzDecoder::new(dat)),
Tzstd => {
// The error can only come from raw::Decoder::with_dictionary as of zstd 0.10.2 and
// 0.11.2, which is specified as `&[]` by `ZstdDecoder::new`, thus `ZstdDecoder::new`
// should not return any error.
Box::new(ZstdDecoder::with_buffer(dat)?)
}
};
Ok(Archive::new(r))
}

View file

@ -0,0 +1,68 @@
use std::{
fs::{create_dir_all, File},
io,
path::Path,
};
use cfg_if::cfg_if;
use rc_zip_sync::{rc_zip::parse::EntryKind, ReadZip};
use super::{DownloadError, ExtractedFiles};
pub(super) fn do_extract_zip(f: File, dir: &Path) -> Result<ExtractedFiles, DownloadError> {
let mut extracted_files = ExtractedFiles::new();
for entry in f.read_zip()?.entries() {
let Some(name) = entry.sanitized_name().map(Path::new) else {
continue;
};
let path = dir.join(name);
let do_extract_file = || {
let mut entry_writer = File::create(&path)?;
let mut entry_reader = entry.reader();
io::copy(&mut entry_reader, &mut entry_writer)?;
Ok::<_, io::Error>(())
};
let parent = path
.parent()
.expect("all full entry paths should have parent paths");
create_dir_all(parent)?;
match entry.kind() {
EntryKind::Symlink => {
extracted_files.add_file(name);
cfg_if! {
if #[cfg(windows)] {
do_extract_file()?;
} else {
use std::{fs, io::Read};
match fs::symlink_metadata(&path) {
Ok(metadata) if metadata.is_file() => fs::remove_file(&path)?,
_ => (),
}
let mut src = String::new();
entry.reader().read_to_string(&mut src)?;
// validate pointing path before creating a symbolic link
if src.contains("..") {
continue;
}
std::os::unix::fs::symlink(src, &path)?;
}
}
}
EntryKind::Directory => (),
EntryKind::File => {
extracted_files.add_file(name);
do_extract_file()?;
}
}
}
Ok(extracted_files)
}

View file

@ -0,0 +1,6 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
pub use bytes;
pub mod download;
pub mod remote;
mod utils;

View file

@ -0,0 +1,414 @@
use std::{
num::{NonZeroU16, NonZeroU64, NonZeroU8},
ops::ControlFlow,
sync::Arc,
time::{Duration, SystemTime},
};
use bytes::Bytes;
use futures_util::Stream;
use httpdate::parse_http_date;
use reqwest::{
header::{HeaderMap, HeaderValue, RETRY_AFTER},
Request,
};
use thiserror::Error as ThisError;
use tracing::{debug, info, instrument};
pub use reqwest::{header, Error as ReqwestError, Method, StatusCode};
pub use url::Url;
mod delay_request;
use delay_request::DelayRequest;
mod certificate;
pub use certificate::Certificate;
mod request_builder;
pub use request_builder::{Body, RequestBuilder, Response};
mod tls_version;
pub use tls_version::TLSVersion;
#[cfg(feature = "hickory-dns")]
mod resolver;
#[cfg(feature = "hickory-dns")]
use resolver::TrustDnsResolver;
#[cfg(feature = "json")]
pub use request_builder::JsonError;
const MAX_RETRY_DURATION: Duration = Duration::from_secs(120);
const MAX_RETRY_COUNT: u8 = 3;
const DEFAULT_RETRY_DURATION_FOR_RATE_LIMIT: Duration = Duration::from_millis(200);
const RETRY_DURATION_FOR_TIMEOUT: Duration = Duration::from_millis(200);
#[allow(dead_code)]
const DEFAULT_MIN_TLS: TLSVersion = TLSVersion::TLS_1_2;
#[derive(Debug, ThisError)]
#[non_exhaustive]
pub enum Error {
#[error("Reqwest error: {0}")]
Reqwest(#[from] reqwest::Error),
#[error(transparent)]
Http(Box<HttpError>),
#[cfg(feature = "json")]
#[error("Failed to parse http response body as Json: {0}")]
Json(#[from] JsonError),
}
#[derive(Debug, ThisError)]
#[error("could not {method} {url}: {err}")]
pub struct HttpError {
method: reqwest::Method,
url: url::Url,
#[source]
err: reqwest::Error,
}
impl HttpError {
/// Returns true if the error is from [`Response::error_for_status`].
pub fn is_status(&self) -> bool {
self.err.is_status()
}
}
#[derive(Debug)]
struct Inner {
client: reqwest::Client,
service: DelayRequest,
}
#[derive(Clone, Debug)]
pub struct Client(Arc<Inner>);
#[cfg_attr(not(feature = "__tls"), allow(unused_variables, unused_mut))]
impl Client {
/// Construct a new downloader client
///
/// * `per_millis` - The duration (in millisecond) for which at most
/// `num_request` can be sent. Increase it if rate-limit errors
/// happen.
/// * `num_request` - maximum number of requests to be processed for
/// each `per_millis` duration.
///
/// The [`reqwest::Client`] constructed has secure defaults, such as allowing
/// only TLS v1.2 and above, and disallowing plaintext HTTP altogether. If you
/// need more control, use the `from_builder` variant.
pub fn new(
user_agent: impl AsRef<str>,
min_tls: Option<TLSVersion>,
per_millis: NonZeroU16,
num_request: NonZeroU64,
certificates: impl IntoIterator<Item = Certificate>,
) -> Result<Self, Error> {
Self::from_builder(
Self::default_builder(user_agent.as_ref(), min_tls, &mut certificates.into_iter()),
per_millis,
num_request,
)
}
/// Constructs a default [`reqwest::ClientBuilder`].
///
/// This may be used alongside [`Client::from_builder`] to start from reasonable
/// defaults, but still be able to customise the reqwest instance. Arguments are
/// as [`Client::new`], but without generic parameters.
pub fn default_builder(
user_agent: &str,
min_tls: Option<TLSVersion>,
certificates: &mut dyn Iterator<Item = Certificate>,
) -> reqwest::ClientBuilder {
let mut builder = reqwest::ClientBuilder::new()
.user_agent(user_agent)
.https_only(true)
.tcp_nodelay(false);
#[cfg(feature = "hickory-dns")]
{
builder = builder.dns_resolver(Arc::new(TrustDnsResolver::default()));
}
#[cfg(feature = "__tls")]
{
let tls_ver = min_tls
.map(|tls| tls.max(DEFAULT_MIN_TLS))
.unwrap_or(DEFAULT_MIN_TLS);
builder = builder.min_tls_version(tls_ver.into());
for certificate in certificates {
builder = builder.add_root_certificate(certificate.0);
}
}
builder
}
/// Construct a custom client from a [`reqwest::ClientBuilder`].
///
/// You may want to also use [`Client::default_builder`].
pub fn from_builder(
builder: reqwest::ClientBuilder,
per_millis: NonZeroU16,
num_request: NonZeroU64,
) -> Result<Self, Error> {
let client = builder.build()?;
Ok(Client(Arc::new(Inner {
client: client.clone(),
service: DelayRequest::new(
num_request,
Duration::from_millis(per_millis.get() as u64),
client,
),
})))
}
/// Return inner reqwest client.
pub fn get_inner(&self) -> &reqwest::Client {
&self.0.client
}
/// Return `Err(_)` for fatal error tht cannot be retried.
///
/// Return `Ok(ControlFlow::Continue(res))` for retryable error, `res`
/// will contain the previous `Result<Response, ReqwestError>`.
/// A retryable error could be a `ReqwestError` or `Response` with
/// unsuccessful status code.
///
/// Return `Ok(ControlFlow::Break(response))` when succeeds and no need
/// to retry.
#[instrument(
skip(self, url),
fields(
url = format_args!("{url}"),
),
)]
async fn do_send_request(
&self,
request: Request,
url: &Url,
) -> Result<ControlFlow<reqwest::Response, Result<reqwest::Response, ReqwestError>>, ReqwestError>
{
static HEADER_VALUE_0: HeaderValue = HeaderValue::from_static("0");
let response = match self.0.service.call(request).await {
Err(err) if err.is_timeout() || err.is_connect() => {
let duration = RETRY_DURATION_FOR_TIMEOUT;
info!("Received timeout error from reqwest. Delay future request by {duration:#?}");
self.0.service.add_urls_to_delay(&[url], duration);
return Ok(ControlFlow::Continue(Err(err)));
}
res => res?,
};
let status = response.status();
let add_delay_and_continue = |response: reqwest::Response, duration| {
info!("Received status code {status}, will wait for {duration:#?} and retry");
self.0
.service
.add_urls_to_delay(&[url, response.url()], duration);
Ok(ControlFlow::Continue(Ok(response)))
};
let headers = response.headers();
// Some server (looking at you, github GraphQL API) may returns a rate limit
// even when OK is returned or on other status code (e.g. 453 forbidden).
if let Some(duration) = parse_header_retry_after(headers) {
add_delay_and_continue(response, duration.min(MAX_RETRY_DURATION))
} else if headers.get("x-ratelimit-remaining") == Some(&HEADER_VALUE_0) {
let duration = headers
.get("x-ratelimit-reset")
.and_then(|value| {
let secs = value.to_str().ok()?.parse().ok()?;
Some(Duration::from_secs(secs))
})
.unwrap_or(DEFAULT_RETRY_DURATION_FOR_RATE_LIMIT)
.min(MAX_RETRY_DURATION);
add_delay_and_continue(response, duration)
} else {
match status {
// Delay further request on rate limit
StatusCode::SERVICE_UNAVAILABLE | StatusCode::TOO_MANY_REQUESTS => {
add_delay_and_continue(response, DEFAULT_RETRY_DURATION_FOR_RATE_LIMIT)
}
// Delay further request on timeout
StatusCode::REQUEST_TIMEOUT | StatusCode::GATEWAY_TIMEOUT => {
add_delay_and_continue(response, RETRY_DURATION_FOR_TIMEOUT)
}
_ => Ok(ControlFlow::Break(response)),
}
}
}
/// * `request` - `Request::try_clone` must always return `Some`.
async fn send_request_inner(
&self,
request: &Request,
) -> Result<reqwest::Response, ReqwestError> {
let mut count = 0;
let max_retry_count = NonZeroU8::new(MAX_RETRY_COUNT).unwrap();
// Since max_retry_count is non-zero, there is at least one iteration.
loop {
// Increment the counter before checking for terminal condition.
count += 1;
match self
.do_send_request(request.try_clone().unwrap(), request.url())
.await?
{
ControlFlow::Break(response) => break Ok(response),
ControlFlow::Continue(res) if count >= max_retry_count.get() => {
break res;
}
_ => (),
}
}
}
/// * `request` - `Request::try_clone` must always return `Some`.
async fn send_request(
&self,
request: Request,
error_for_status: bool,
) -> Result<reqwest::Response, Error> {
debug!("Downloading from: '{}'", request.url());
self.send_request_inner(&request)
.await
.and_then(|response| {
if error_for_status {
response.error_for_status()
} else {
Ok(response)
}
})
.map_err(|err| {
Error::Http(Box::new(HttpError {
method: request.method().clone(),
url: request.url().clone(),
err,
}))
})
}
async fn head_or_fallback_to_get(
&self,
url: Url,
error_for_status: bool,
) -> Result<reqwest::Response, Error> {
let res = self
.send_request(Request::new(Method::HEAD, url.clone()), error_for_status)
.await;
let retry_with_get = move || async move {
// Retry using GET
info!("HEAD on {url} is not allowed, fallback to GET");
self.send_request(Request::new(Method::GET, url), error_for_status)
.await
};
let is_retryable = |status| {
matches!(
status,
StatusCode::BAD_REQUEST // 400
| StatusCode::UNAUTHORIZED // 401
| StatusCode::FORBIDDEN // 403
| StatusCode::NOT_FOUND // 404
| StatusCode::METHOD_NOT_ALLOWED // 405
| StatusCode::GONE // 410
)
};
match res {
Err(Error::Http(http_error))
if http_error.err.status().map(is_retryable).unwrap_or(false) =>
{
retry_with_get().await
}
Ok(response) if is_retryable(response.status()) => retry_with_get().await,
res => res,
}
}
/// Check if remote exists using `Method::GET`.
pub async fn remote_gettable(&self, url: Url) -> Result<bool, Error> {
Ok(self.get(url).send(false).await?.status().is_success())
}
/// Attempt to get final redirected url using `Method::HEAD` or fallback
/// to `Method::GET`.
pub async fn get_redirected_final_url(&self, url: Url) -> Result<Url, Error> {
self.head_or_fallback_to_get(url, true)
.await
.map(|response| response.url().clone())
}
/// Create `GET` request to `url` and return a stream of the response data.
/// On status code other than 200, it will return an error.
pub async fn get_stream(
&self,
url: Url,
) -> Result<impl Stream<Item = Result<Bytes, Error>>, Error> {
Ok(self.get(url).send(true).await?.bytes_stream())
}
/// Create a new request.
pub fn request(&self, method: Method, url: Url) -> RequestBuilder {
RequestBuilder {
client: self.clone(),
inner: self.0.client.request(method, url),
}
}
/// Create a new GET request.
pub fn get(&self, url: Url) -> RequestBuilder {
self.request(Method::GET, url)
}
/// Create a new POST request.
pub fn post(&self, url: Url, body: impl Into<Body>) -> RequestBuilder {
self.request(Method::POST, url).body(body.into())
}
}
fn parse_header_retry_after(headers: &HeaderMap) -> Option<Duration> {
let header = headers
.get_all(RETRY_AFTER)
.into_iter()
.next_back()?
.to_str()
.ok()?;
match header.parse::<u64>() {
Ok(dur) => Some(Duration::from_secs(dur)),
Err(_) => {
let system_time = parse_http_date(header).ok()?;
let retry_after_unix_timestamp =
system_time.duration_since(SystemTime::UNIX_EPOCH).ok()?;
let curr_time_unix_timestamp = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.expect("SystemTime before UNIX EPOCH!");
// retry_after_unix_timestamp - curr_time_unix_timestamp
// If underflows, returns Duration::ZERO.
Some(retry_after_unix_timestamp.saturating_sub(curr_time_unix_timestamp))
}
}
}

View file

@ -0,0 +1,32 @@
#[cfg(feature = "__tls")]
use reqwest::tls;
use super::Error;
#[derive(Clone, Debug)]
pub struct Certificate(#[cfg(feature = "__tls")] pub(super) tls::Certificate);
#[cfg_attr(not(feature = "__tls"), allow(unused_variables))]
impl Certificate {
/// Create a Certificate from a binary DER encoded certificate
pub fn from_der(der: impl AsRef<[u8]>) -> Result<Self, Error> {
#[cfg(not(feature = "__tls"))]
return Ok(Self());
#[cfg(feature = "__tls")]
tls::Certificate::from_der(der.as_ref())
.map(Self)
.map_err(Error::from)
}
/// Create a Certificate from a PEM encoded certificate
pub fn from_pem(pem: impl AsRef<[u8]>) -> Result<Self, Error> {
#[cfg(not(feature = "__tls"))]
return Ok(Self());
#[cfg(feature = "__tls")]
tls::Certificate::from_pem(pem.as_ref())
.map(Self)
.map_err(Error::from)
}
}

View file

@ -0,0 +1,245 @@
use std::{
collections::HashMap, future::Future, iter::Peekable, num::NonZeroU64, ops::ControlFlow,
sync::Mutex,
};
use compact_str::{CompactString, ToCompactString};
use reqwest::{Request, Url};
use tokio::time::{sleep_until, Duration, Instant};
use tracing::debug;
pub(super) type RequestResult = Result<reqwest::Response, reqwest::Error>;
trait IterExt: Iterator {
fn dedup(self) -> Dedup<Self>
where
Self: Sized,
Self::Item: PartialEq,
{
Dedup(self.peekable())
}
}
impl<It: Iterator> IterExt for It {}
struct Dedup<It: Iterator>(Peekable<It>);
impl<It> Iterator for Dedup<It>
where
It: Iterator,
It::Item: PartialEq,
{
type Item = It::Item;
fn next(&mut self) -> Option<Self::Item> {
let curr = self.0.next()?;
// Drop all consecutive dup values
while self.0.next_if_eq(&curr).is_some() {}
Some(curr)
}
}
#[derive(Debug)]
struct Inner {
client: reqwest::Client,
num_request: NonZeroU64,
per: Duration,
until: Instant,
state: State,
}
#[derive(Debug)]
enum State {
Limited,
Ready { rem: NonZeroU64 },
}
impl Inner {
fn new(num_request: NonZeroU64, per: Duration, client: reqwest::Client) -> Self {
Inner {
client,
per,
num_request,
until: Instant::now() + per,
state: State::Ready { rem: num_request },
}
}
fn inc_rate_limit(&mut self) {
if let Some(num_request) = NonZeroU64::new(self.num_request.get() / 2) {
// If self.num_request.get() > 1, then cut it by half
self.num_request = num_request;
if let State::Ready { rem, .. } = &mut self.state {
*rem = num_request.min(*rem)
}
}
let per = self.per;
if per < Duration::from_millis(700) {
self.per = per.mul_f32(1.2);
self.until += self.per - per;
}
}
fn ready(&mut self) -> Readiness {
match self.state {
State::Ready { .. } => Readiness::Ready,
State::Limited => {
if self.until.elapsed().is_zero() {
Readiness::Limited(self.until)
} else {
// rate limit can be reset now and is ready
self.until = Instant::now() + self.per;
self.state = State::Ready {
rem: self.num_request,
};
Readiness::Ready
}
}
}
}
fn call(&mut self, req: Request) -> impl Future<Output = RequestResult> {
match &mut self.state {
State::Ready { rem } => {
let now = Instant::now();
// If the period has elapsed, reset it.
if now >= self.until {
self.until = now + self.per;
*rem = self.num_request;
}
if let Some(new_rem) = NonZeroU64::new(rem.get() - 1) {
*rem = new_rem;
} else {
// The service is disabled until further notice
self.state = State::Limited;
}
// Call the inner future
self.client.execute(req)
}
State::Limited => panic!("service not ready; poll_ready must be called first"),
}
}
}
enum Readiness {
Limited(Instant),
Ready,
}
#[derive(Debug)]
pub(super) struct DelayRequest {
inner: Mutex<Inner>,
hosts_to_delay: Mutex<HashMap<CompactString, Instant>>,
}
impl DelayRequest {
pub(super) fn new(num_request: NonZeroU64, per: Duration, client: reqwest::Client) -> Self {
Self {
inner: Mutex::new(Inner::new(num_request, per, client)),
hosts_to_delay: Default::default(),
}
}
pub(super) fn add_urls_to_delay(&self, urls: &[&Url], delay_duration: Duration) {
let deadline = Instant::now() + delay_duration;
let mut hosts_to_delay = self.hosts_to_delay.lock().unwrap();
urls.iter()
.filter_map(|url| url.host_str())
.dedup()
.for_each(|host| {
hosts_to_delay
.entry(host.to_compact_string())
.and_modify(|old_dl| {
*old_dl = deadline.max(*old_dl);
})
.or_insert(deadline);
});
}
fn get_delay_until(&self, host: &str) -> Option<Instant> {
let mut hosts_to_delay = self.hosts_to_delay.lock().unwrap();
hosts_to_delay.get(host).copied().and_then(|until| {
if until.elapsed().is_zero() {
Some(until)
} else {
// We have already gone past the deadline,
// so we should remove it instead.
hosts_to_delay.remove(host);
None
}
})
}
// Define a new function so that the guard will be dropped ASAP and not
// included in the future.
fn call_inner(
&self,
counter: &mut u32,
req: &mut Option<Request>,
) -> ControlFlow<impl Future<Output = RequestResult>, Instant> {
// Wait until we are ready to send next requests
// (client-side rate-limit throttler).
let mut guard = self.inner.lock().unwrap();
if let Readiness::Limited(until) = guard.ready() {
ControlFlow::Continue(until)
} else if let Some(until) = req
.as_ref()
.unwrap()
.url()
.host_str()
.and_then(|host| self.get_delay_until(host))
{
// If the host rate-limit us, then wait until then
// and try again (server-side rate-limit throttler).
// Try increasing client-side rate-limit throttler to prevent
// rate-limit in the future.
guard.inc_rate_limit();
let additional_delay =
Duration::from_millis(200) + Duration::from_millis(100) * 20.min(*counter);
*counter += 1;
debug!("server-side rate limit exceeded; sleeping.");
ControlFlow::Continue(until + additional_delay)
} else {
ControlFlow::Break(guard.call(req.take().unwrap()))
}
}
pub(super) async fn call(&self, req: Request) -> RequestResult {
// Put all variables in a block so that will be dropped before polling
// the future returned by reqwest.
{
let mut counter = 0;
// Use Option here so that we don't have to move entire `Request`
// twice when calling `self.call_inner` while retain the ability to
// take its value without boxing.
//
// This will be taken when `ControlFlow::Break` is then it will
// break the loop, so it will never call `self.call_inner` with
// a `None`.
let mut req = Some(req);
loop {
match self.call_inner(&mut counter, &mut req) {
ControlFlow::Continue(until) => sleep_until(until).await,
ControlFlow::Break(future) => break future,
}
}
}
.await
}
}

View file

@ -0,0 +1,120 @@
use std::fmt;
use bytes::Bytes;
use futures_util::{Stream, StreamExt};
use reqwest::Method;
use super::{header, Client, Error, HttpError, StatusCode, Url};
pub use reqwest::Body;
#[cfg(feature = "json")]
pub use serde_json::Error as JsonError;
#[derive(Debug)]
pub struct RequestBuilder {
pub(super) client: Client,
pub(super) inner: reqwest::RequestBuilder,
}
impl RequestBuilder {
pub fn bearer_auth(self, token: &dyn fmt::Display) -> Self {
Self {
client: self.client,
inner: self.inner.bearer_auth(token),
}
}
pub fn header(self, key: &str, value: &str) -> Self {
Self {
client: self.client,
inner: self.inner.header(key, value),
}
}
pub fn body(self, body: impl Into<Body>) -> Self {
Self {
client: self.client,
inner: self.inner.body(body.into()),
}
}
pub async fn send(self, error_for_status: bool) -> Result<Response, Error> {
let request = self.inner.build()?;
let method = request.method().clone();
Ok(Response {
inner: self.client.send_request(request, error_for_status).await?,
method,
})
}
}
#[derive(Debug)]
pub struct Response {
inner: reqwest::Response,
method: Method,
}
impl Response {
pub async fn bytes(self) -> Result<Bytes, Error> {
self.inner.bytes().await.map_err(Error::from)
}
pub fn bytes_stream(self) -> impl Stream<Item = Result<Bytes, Error>> {
let url = Box::new(self.inner.url().clone());
let method = self.method;
self.inner.bytes_stream().map(move |res| {
res.map_err(|err| {
Error::Http(Box::new(HttpError {
method: method.clone(),
url: Url::clone(&*url),
err,
}))
})
})
}
pub fn status(&self) -> StatusCode {
self.inner.status()
}
pub fn url(&self) -> &Url {
self.inner.url()
}
pub fn method(&self) -> &Method {
&self.method
}
pub fn error_for_status_ref(&self) -> Result<&Self, Error> {
match self.inner.error_for_status_ref() {
Ok(_) => Ok(self),
Err(err) => Err(Error::Http(Box::new(HttpError {
method: self.method().clone(),
url: self.url().clone(),
err,
}))),
}
}
pub fn error_for_status(self) -> Result<Self, Error> {
match self.error_for_status_ref() {
Ok(_) => Ok(self),
Err(err) => Err(err),
}
}
pub fn headers(&self) -> &header::HeaderMap {
self.inner.headers()
}
#[cfg(feature = "json")]
pub async fn json<T>(self) -> Result<T, Error>
where
T: serde::de::DeserializeOwned,
{
let bytes = self.error_for_status()?.bytes().await?;
Ok(serde_json::from_slice(&bytes)?)
}
}

View file

@ -0,0 +1,94 @@
use std::{net::SocketAddr, sync::Arc};
use hickory_resolver::{
config::{LookupIpStrategy, ResolverConfig, ResolverOpts},
system_conf, TokioResolver as TokioAsyncResolver,
};
use once_cell::sync::OnceCell;
use reqwest::dns::{Addrs, Name, Resolve, Resolving};
use tracing::{debug, instrument, warn};
#[cfg(windows)]
use hickory_resolver::{config::NameServerConfig, proto::xfer::Protocol};
type BoxError = Box<dyn std::error::Error + Send + Sync>;
#[derive(Debug, Default, Clone)]
pub struct TrustDnsResolver(Arc<OnceCell<TokioAsyncResolver>>);
impl Resolve for TrustDnsResolver {
fn resolve(&self, name: Name) -> Resolving {
let resolver = self.clone();
Box::pin(async move {
let resolver = resolver.0.get_or_try_init(new_resolver)?;
let lookup = resolver.lookup_ip(name.as_str()).await?;
let addrs: Addrs = Box::new(lookup.into_iter().map(|ip| SocketAddr::new(ip, 0)));
Ok(addrs)
})
}
}
#[cfg(unix)]
fn get_configs() -> Result<(ResolverConfig, ResolverOpts), BoxError> {
debug!("Using system DNS resolver configuration");
system_conf::read_system_conf().map_err(Into::into)
}
#[cfg(windows)]
fn get_configs() -> Result<(ResolverConfig, ResolverOpts), BoxError> {
debug!("Using custom DNS resolver configuration");
let mut config = ResolverConfig::new();
let opts = ResolverOpts::default();
get_adapter()?.dns_servers().iter().for_each(|addr| {
tracing::trace!("Adding DNS server: {}", addr);
let socket_addr = SocketAddr::new(*addr, 53);
for protocol in [Protocol::Udp, Protocol::Tcp] {
config.add_name_server(NameServerConfig {
socket_addr,
protocol,
tls_dns_name: None,
trust_negative_responses: false,
bind_addr: None,
http_endpoint: None,
})
}
});
Ok((config, opts))
}
#[instrument]
fn new_resolver() -> Result<TokioAsyncResolver, BoxError> {
let (config, mut opts) = get_configs()?;
debug!("Resolver configuration complete");
opts.ip_strategy = LookupIpStrategy::Ipv4AndIpv6;
let mut builder = TokioAsyncResolver::builder_with_config(config, Default::default());
*builder.options_mut() = opts;
Ok(builder.build())
}
#[cfg(windows)]
#[instrument]
fn get_adapter() -> Result<ipconfig::Adapter, BoxError> {
debug!("Retrieving local IP address");
let local_ip =
default_net::interface::get_local_ipaddr().ok_or("Local IP address not found")?;
debug!("Local IP address: {local_ip}");
debug!("Retrieving network adapters");
let adapters = ipconfig::get_adapters()?;
debug!("Found {} network adapters", adapters.len());
debug!("Searching for adapter with IP address {local_ip}");
let adapter = adapters
.into_iter()
.find(|adapter| adapter.ip_addresses().contains(&local_ip))
.ok_or("Adapter not found")?;
debug!(
"Using adapter {} with {} DNS servers",
adapter.friendly_name(),
adapter.dns_servers().len()
);
Ok(adapter)
}

View file

@ -0,0 +1,37 @@
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
enum Inner {
Tls1_2 = 0,
Tls1_3 = 1,
}
/// TLS version for [`crate::remote::Client`].
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct TLSVersion(Inner);
impl TLSVersion {
pub const TLS_1_2: TLSVersion = TLSVersion(Inner::Tls1_2);
pub const TLS_1_3: TLSVersion = TLSVersion(Inner::Tls1_3);
}
#[cfg(feature = "__tls")]
impl From<TLSVersion> for reqwest::tls::Version {
fn from(ver: TLSVersion) -> reqwest::tls::Version {
use reqwest::tls::Version;
use Inner::*;
match ver.0 {
Tls1_2 => Version::TLS_1_2,
Tls1_3 => Version::TLS_1_3,
}
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_tls_version_order() {
assert!(TLSVersion::TLS_1_2 < TLSVersion::TLS_1_3);
}
}

View file

@ -0,0 +1,172 @@
use std::{
future::Future,
io::{self, BufRead, Read},
};
use bytes::{Buf, Bytes};
use futures_util::{FutureExt, Stream, StreamExt};
use tokio::{sync::mpsc, task};
pub(super) fn extract_with_blocking_task<E, StreamError, S, F, T>(
stream: S,
f: F,
) -> impl Future<Output = Result<T, E>>
where
T: Send + 'static,
E: From<io::Error>,
E: From<StreamError>,
S: Stream<Item = Result<Bytes, StreamError>> + Send + Sync + Unpin,
F: FnOnce(mpsc::Receiver<Bytes>) -> io::Result<T> + Send + Sync + 'static,
{
async fn inner<S, StreamError, Fut, T, E>(
mut stream: S,
task: Fut,
tx: mpsc::Sender<Bytes>,
) -> Result<T, E>
where
E: From<io::Error>,
E: From<StreamError>,
// We do not use trait object for S since there will only be one
// S used with this function.
S: Stream<Item = Result<Bytes, StreamError>> + Send + Sync + Unpin,
// asyncify would always return the same future, so no need to
// use trait object here.
Fut: Future<Output = io::Result<T>> + Send + Sync,
{
let read_fut = async move {
while let Some(bytes) = stream.next().await.transpose()? {
if bytes.is_empty() {
continue;
}
if tx.send(bytes).await.is_err() {
// The extract tar returns, which could be that:
// - Extraction fails with an error
// - Extraction success without the rest of the data
//
//
// It's hard to tell the difference here, so we assume
// the first scienario occurs.
//
// Even if the second scienario occurs, it won't affect the
// extraction process anyway, so we can jsut ignore it.
return Ok(());
}
}
Ok::<_, E>(())
};
tokio::pin!(read_fut);
let task_fut = async move { task.await.map_err(E::from) };
tokio::pin!(task_fut);
tokio::select! {
biased;
res = &mut read_fut => {
// The stream reaches eof, propagate error and wait for
// read task to be done.
res?;
task_fut.await
},
res = &mut task_fut => {
// The task finishes before the read task, return early
// after checking for errors in read_fut.
if let Some(Err(err)) = read_fut.now_or_never() {
Err(err)
} else {
res
}
}
}
}
// Use channel size = 5 to minimize the waiting time in the extraction task
let (tx, rx) = mpsc::channel(5);
let task = asyncify(move || f(rx));
inner(stream, task, tx)
}
/// Copied from tokio https://docs.rs/tokio/latest/src/tokio/fs/mod.rs.html#132
pub(super) fn asyncify<F, T>(f: F) -> impl Future<Output = io::Result<T>> + Send + Sync + 'static
where
F: FnOnce() -> io::Result<T> + Send + 'static,
T: Send + 'static,
{
async fn inner<T: Send + 'static>(handle: task::JoinHandle<io::Result<T>>) -> io::Result<T> {
match handle.await {
Ok(res) => res,
Err(err) => Err(io::Error::new(
io::ErrorKind::Other,
format!("background task failed: {err}"),
)),
}
}
inner(task::spawn_blocking(f))
}
/// This wraps an AsyncIterator as a `Read`able.
/// It must be used in non-async context only,
/// meaning you have to use it with
/// `tokio::task::{block_in_place, spawn_blocking}` or
/// `std::thread::spawn`.
pub(super) struct StreamReadable {
rx: mpsc::Receiver<Bytes>,
bytes: Bytes,
}
impl StreamReadable {
pub(super) fn new(rx: mpsc::Receiver<Bytes>) -> Self {
Self {
rx,
bytes: Bytes::new(),
}
}
}
impl Read for StreamReadable {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
if buf.is_empty() {
return Ok(0);
}
if self.fill_buf()?.is_empty() {
return Ok(0);
}
let bytes = &mut self.bytes;
// copy_to_slice requires the bytes to have enough remaining bytes
// to fill buf.
let n = buf.len().min(bytes.remaining());
// <Bytes as Buf>::copy_to_slice copies and consumes the bytes
bytes.copy_to_slice(&mut buf[..n]);
Ok(n)
}
}
impl BufRead for StreamReadable {
fn fill_buf(&mut self) -> io::Result<&[u8]> {
let bytes = &mut self.bytes;
if !bytes.has_remaining() {
if let Some(new_bytes) = self.rx.blocking_recv() {
// new_bytes are guaranteed to be non-empty.
*bytes = new_bytes;
}
}
Ok(&*bytes)
}
fn consume(&mut self, amt: usize) {
self.bytes.advance(amt);
}
}

View file

@ -0,0 +1,133 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.10.18](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.17...binstalk-fetchers-v0.10.18) - 2025-04-05
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader, binstalk-git-repo-api
## [0.10.17](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.16...binstalk-fetchers-v0.10.17) - 2025-03-19
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.10.16](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.15...binstalk-fetchers-v0.10.16) - 2025-03-15
### Other
- *(deps)* bump the deps group with 2 updates ([#2084](https://github.com/cargo-bins/cargo-binstall/pull/2084))
- *(deps)* bump tokio from 1.43.0 to 1.44.0 in the deps group ([#2079](https://github.com/cargo-bins/cargo-binstall/pull/2079))
## [0.10.15](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.14...binstalk-fetchers-v0.10.15) - 2025-03-07
### Other
- *(deps)* bump the deps group with 3 updates ([#2072](https://github.com/cargo-bins/cargo-binstall/pull/2072))
## [0.10.14](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.13...binstalk-fetchers-v0.10.14) - 2025-02-28
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.10.13](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.12...binstalk-fetchers-v0.10.13) - 2025-02-11
### Other
- *(deps)* bump the deps group with 2 updates (#2044)
## [0.10.12](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.11...binstalk-fetchers-v0.10.12) - 2025-02-04
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.10.11](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.10...binstalk-fetchers-v0.10.11) - 2025-01-19
### Other
- update Cargo.lock dependencies
## [0.10.10](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.9...binstalk-fetchers-v0.10.10) - 2025-01-13
### Other
- update Cargo.lock dependencies
## [0.10.9](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.8...binstalk-fetchers-v0.10.9) - 2025-01-11
### Other
- *(deps)* bump the deps group with 3 updates (#2015)
## [0.10.8](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.7...binstalk-fetchers-v0.10.8) - 2025-01-04
### Other
- *(deps)* bump the deps group with 2 updates (#2010)
## [0.10.7](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.6...binstalk-fetchers-v0.10.7) - 2024-12-14
### Other
- *(deps)* bump the deps group with 2 updates (#1997)
## [0.10.6](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.5...binstalk-fetchers-v0.10.6) - 2024-11-29
### Other
- Upgrade transitive dependencies ([#1985](https://github.com/cargo-bins/cargo-binstall/pull/1985))
## [0.10.5](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.4...binstalk-fetchers-v0.10.5) - 2024-11-23
### Other
- *(deps)* bump the deps group with 2 updates ([#1981](https://github.com/cargo-bins/cargo-binstall/pull/1981))
## [0.10.4](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.3...binstalk-fetchers-v0.10.4) - 2024-11-09
### Other
- *(deps)* bump the deps group with 3 updates ([#1966](https://github.com/cargo-bins/cargo-binstall/pull/1966))
## [0.10.3](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.2...binstalk-fetchers-v0.10.3) - 2024-11-05
### Other
- *(deps)* bump the deps group with 3 updates ([#1954](https://github.com/cargo-bins/cargo-binstall/pull/1954))
## [0.10.2](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.1...binstalk-fetchers-v0.10.2) - 2024-11-02
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.10.1](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.10.0...binstalk-fetchers-v0.10.1) - 2024-10-12
### Other
- updated the following local packages: binstalk-git-repo-api
## [0.10.0](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.9.1...binstalk-fetchers-v0.10.0) - 2024-09-11
### Other
- report to new stats server (with status) ([#1912](https://github.com/cargo-bins/cargo-binstall/pull/1912))
- Improve quickinstall telemetry failure message ([#1910](https://github.com/cargo-bins/cargo-binstall/pull/1910))
## [0.9.1](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.9.0...binstalk-fetchers-v0.9.1) - 2024-08-12
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.9.0](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-fetchers-v0.8.0...binstalk-fetchers-v0.9.0) - 2024-08-10
### Other
- updated the following local packages: binstalk-types, binstalk-downloader, binstalk-downloader

View file

@ -0,0 +1,44 @@
[package]
name = "binstalk-fetchers"
version = "0.10.18"
edition = "2021"
description = "The binstall fetchers"
repository = "https://github.com/cargo-bins/cargo-binstall"
documentation = "https://docs.rs/binstalk-fetchers"
rust-version = "1.70.0"
authors = ["Jiahao XU <Jiahao_XU@outlook.com>"]
license = "GPL-3.0-only"
[dependencies]
async-trait = "0.1.88"
binstalk-downloader = { version = "0.13.17", path = "../binstalk-downloader", default-features = false }
binstalk-git-repo-api = { version = "0.5.19", path = "../binstalk-git-repo-api" }
binstalk-types = { version = "0.9.4", path = "../binstalk-types" }
bytes = "1.4.0"
compact_str = { version = "0.9.0" }
either = "1.11.0"
itertools = "0.14.0"
leon = "3.0.0"
leon-macros = "1.0.1"
miette = "7.0.0"
minisign-verify = "0.2.1"
once_cell = "1.18.0"
strum = "0.27.0"
thiserror = "2.0.11"
tokio = { version = "1.44.0", features = [
"rt",
"sync",
], default-features = false }
tracing = "0.1.39"
url = "2.5.4"
[dev-dependencies]
binstalk-downloader = { version = "0.13.17", path = "../binstalk-downloader" }
[features]
quickinstall = []
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
all-features = true

View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View file

@ -0,0 +1,120 @@
#![allow(unused)]
use std::{
future::Future,
sync::{
atomic::{AtomicBool, Ordering::Relaxed},
Once,
},
};
pub(super) use binstalk_downloader::{
download::{Download, ExtractedFiles},
remote::{Client, Url},
};
pub(super) use binstalk_git_repo_api::gh_api_client::GhApiClient;
use binstalk_git_repo_api::gh_api_client::{GhApiError, GhReleaseArtifact, GhReleaseArtifactUrl};
pub(super) use binstalk_types::cargo_toml_binstall::{PkgFmt, PkgMeta};
pub(super) use compact_str::CompactString;
pub(super) use tokio::task::JoinHandle;
pub(super) use tracing::{debug, instrument, warn};
use crate::FetchError;
static WARN_RATE_LIMIT_ONCE: Once = Once::new();
static WARN_UNAUTHORIZED_ONCE: Once = Once::new();
/// Return Ok(Some(api_artifact_url)) if exists, or Ok(None) if it doesn't.
///
/// Caches info on all artifacts matching (repo, tag).
pub(super) async fn get_gh_release_artifact_url(
gh_api_client: GhApiClient,
artifact: GhReleaseArtifact,
) -> Result<Option<GhReleaseArtifactUrl>, GhApiError> {
debug!("Using GitHub API to check for existence of artifact, which will also cache the API response");
// The future returned has the same size as a pointer
match gh_api_client.has_release_artifact(artifact).await {
Ok(ret) => Ok(ret),
Err(GhApiError::NotFound) => Ok(None),
Err(GhApiError::RateLimit { retry_after }) => {
WARN_RATE_LIMIT_ONCE.call_once(|| {
warn!("Your GitHub API token (if any) has reached its rate limit and cannot be used again until {retry_after:?}, so we will fallback to HEAD/GET on the url.");
warn!("If you did not supply a github token, consider doing so: GitHub limits unauthorized users to 60 requests per hour per origin IP address.");
});
Err(GhApiError::RateLimit { retry_after })
}
Err(GhApiError::Unauthorized) => {
WARN_UNAUTHORIZED_ONCE.call_once(|| {
warn!("GitHub API somehow requires a token for the API access, so we will fallback to HEAD/GET on the url.");
warn!("Please consider supplying a token to cargo-binstall to speedup resolution.");
});
Err(GhApiError::Unauthorized)
}
Err(err) => Err(err),
}
}
/// Check if the URL exists by querying the GitHub API.
///
/// Caches info on all artifacts matching (repo, tag).
///
/// This function returns a future where its size should be at most size of
/// 2-4 pointers.
pub(super) async fn does_url_exist(
client: Client,
gh_api_client: GhApiClient,
url: &Url,
) -> Result<bool, FetchError> {
static GH_API_CLIENT_FAILED: AtomicBool = AtomicBool::new(false);
debug!("Checking for package at: '{url}'");
if !GH_API_CLIENT_FAILED.load(Relaxed) {
if let Some(artifact) = GhReleaseArtifact::try_extract_from_url(url) {
match get_gh_release_artifact_url(gh_api_client, artifact).await {
Ok(ret) => return Ok(ret.is_some()),
Err(GhApiError::RateLimit { .. }) | Err(GhApiError::Unauthorized) => {}
Err(err) => return Err(err.into()),
}
GH_API_CLIENT_FAILED.store(true, Relaxed);
}
}
Ok(Box::pin(client.remote_gettable(url.clone())).await?)
}
#[derive(Debug)]
pub(super) struct AutoAbortJoinHandle<T>(JoinHandle<T>);
impl<T> AutoAbortJoinHandle<T>
where
T: Send + 'static,
{
pub(super) fn spawn<F>(future: F) -> Self
where
F: Future<Output = T> + Send + 'static,
{
Self(tokio::spawn(future))
}
}
impl<T> Drop for AutoAbortJoinHandle<T> {
fn drop(&mut self) {
self.0.abort();
}
}
impl<T, E> AutoAbortJoinHandle<Result<T, E>>
where
E: Into<FetchError>,
{
pub(super) async fn flattened_join(mut self) -> Result<T, FetchError> {
(&mut self.0).await?.map_err(Into::into)
}
}

View file

@ -0,0 +1,86 @@
use std::{fmt::Debug, future::Future, pin::Pin};
use tokio::sync::mpsc;
use tracing::warn;
/// Given multiple futures with output = `Result<Option<T>, E>`,
/// returns the the first one that returns either `Err(_)` or
/// `Ok(Some(_))`.
pub struct FuturesResolver<T, E> {
rx: mpsc::Receiver<Result<T, E>>,
tx: mpsc::Sender<Result<T, E>>,
}
impl<T, E> Default for FuturesResolver<T, E> {
fn default() -> Self {
// We only need the first one, so the channel is of size 1.
let (tx, rx) = mpsc::channel(1);
Self { tx, rx }
}
}
impl<T: Send + 'static, E: Send + Debug + 'static> FuturesResolver<T, E> {
/// Insert new future into this resolver, they will start running
/// right away.
pub fn push<Fut>(&self, fut: Fut)
where
Fut: Future<Output = Result<Option<T>, E>> + Send + 'static,
{
let tx = self.tx.clone();
tokio::spawn(async move {
tokio::pin!(fut);
Self::spawn_inner(fut, tx).await;
});
}
async fn spawn_inner(
fut: Pin<&mut (dyn Future<Output = Result<Option<T>, E>> + Send)>,
tx: mpsc::Sender<Result<T, E>>,
) {
let res = tokio::select! {
biased;
_ = tx.closed() => return,
res = fut => res,
};
if let Some(res) = res.transpose() {
// try_send can only fail due to being full or being closed.
//
// In both cases, this could means some other future has
// completed first.
//
// For closed, it could additionally means that the task
// is cancelled.
tx.try_send(res).ok();
}
}
/// Insert multiple futures into this resolver, they will start running
/// right away.
pub fn extend<Fut, Iter>(&self, iter: Iter)
where
Fut: Future<Output = Result<Option<T>, E>> + Send + 'static,
Iter: IntoIterator<Item = Fut>,
{
iter.into_iter().for_each(|fut| self.push(fut));
}
/// Return the resolution.
pub fn resolve(self) -> impl Future<Output = Option<T>> {
let mut rx = self.rx;
drop(self.tx);
async move {
loop {
match rx.recv().await {
Some(Ok(ret)) => return Some(ret),
Some(Err(err)) => warn!(?err, "Fail to resolve the future"),
None => return None,
}
}
}
}
}

View file

@ -0,0 +1,660 @@
use std::{borrow::Cow, fmt, iter, path::Path, sync::Arc};
use binstalk_git_repo_api::gh_api_client::{GhApiError, GhReleaseArtifact, GhReleaseArtifactUrl};
use binstalk_types::cargo_toml_binstall::Strategy;
use compact_str::{CompactString, ToCompactString};
use either::Either;
use leon::Template;
use once_cell::sync::OnceCell;
use strum::IntoEnumIterator;
use tokio::time::sleep;
use tracing::{debug, info, trace, warn};
use url::Url;
use crate::{
common::*, futures_resolver::FuturesResolver, Data, FetchError, InvalidPkgFmtError, RepoInfo,
SignaturePolicy, SignatureVerifier, TargetDataErased, DEFAULT_GH_API_RETRY_DURATION,
};
pub const FETCHER_GH_CRATE_META: &str = "GhCrateMeta";
pub(crate) mod hosting;
pub struct GhCrateMeta {
client: Client,
gh_api_client: GhApiClient,
data: Arc<Data>,
target_data: Arc<TargetDataErased>,
signature_policy: SignaturePolicy,
resolution: OnceCell<Resolved>,
}
#[derive(Debug)]
struct Resolved {
url: Url,
pkg_fmt: PkgFmt,
archive_suffix: Option<String>,
repo: Option<String>,
subcrate: Option<String>,
gh_release_artifact_url: Option<GhReleaseArtifactUrl>,
is_repo_private: bool,
}
impl GhCrateMeta {
fn launch_baseline_find_tasks(
&self,
futures_resolver: &FuturesResolver<Resolved, FetchError>,
pkg_fmt: PkgFmt,
pkg_url: &Template<'_>,
repo: Option<&str>,
subcrate: Option<&str>,
is_repo_private: bool,
) {
let render_url = |ext| {
let ctx = Context::from_data_with_repo(
&self.data,
&self.target_data.target,
&self.target_data.target_related_info,
ext,
repo,
subcrate,
);
match ctx.render_url_with(pkg_url) {
Ok(url) => Some(url),
Err(err) => {
warn!("Failed to render url for {ctx:#?}: {err}");
None
}
}
};
let is_windows = self.target_data.target.contains("windows");
let urls = if pkg_url.has_any_of_keys(&["format", "archive-format", "archive-suffix"]) {
// build up list of potential URLs
Either::Left(
pkg_fmt
.extensions(is_windows)
.iter()
.filter_map(|ext| render_url(Some(ext)).map(|url| (url, Some(ext)))),
)
} else {
Either::Right(render_url(None).map(|url| (url, None)).into_iter())
};
// go check all potential URLs at once
futures_resolver.extend(urls.map(move |(url, ext)| {
let client = self.client.clone();
let gh_api_client = self.gh_api_client.clone();
let repo = repo.map(ToString::to_string);
let subcrate = subcrate.map(ToString::to_string);
let archive_suffix = ext.map(ToString::to_string);
let gh_release_artifact = GhReleaseArtifact::try_extract_from_url(&url);
async move {
debug!("Checking for package at: '{url}'");
let mut resolved = Resolved {
url: url.clone(),
pkg_fmt,
repo,
subcrate,
archive_suffix,
is_repo_private,
gh_release_artifact_url: None,
};
if let Some(artifact) = gh_release_artifact {
loop {
match get_gh_release_artifact_url(gh_api_client.clone(), artifact.clone())
.await
{
Ok(Some(artifact_url)) => {
resolved.gh_release_artifact_url = Some(artifact_url);
return Ok(Some(resolved));
}
Ok(None) => return Ok(None),
Err(GhApiError::RateLimit { retry_after }) => {
sleep(retry_after.unwrap_or(DEFAULT_GH_API_RETRY_DURATION)).await;
}
Err(GhApiError::Unauthorized) if !is_repo_private => break,
Err(err) => return Err(err.into()),
}
}
}
Ok(Box::pin(client.remote_gettable(url))
.await?
.then_some(resolved))
}
}));
}
}
#[async_trait::async_trait]
impl super::Fetcher for GhCrateMeta {
fn new(
client: Client,
gh_api_client: GhApiClient,
data: Arc<Data>,
target_data: Arc<TargetDataErased>,
signature_policy: SignaturePolicy,
) -> Arc<dyn super::Fetcher> {
Arc::new(Self {
client,
gh_api_client,
data,
target_data,
signature_policy,
resolution: OnceCell::new(),
})
}
fn find(self: Arc<Self>) -> JoinHandle<Result<bool, FetchError>> {
tokio::spawn(async move {
let info = self.data.get_repo_info(&self.gh_api_client).await?;
let repo = info.map(|info| &info.repo);
let subcrate = info.and_then(|info| info.subcrate.as_deref());
let is_repo_private = info.map(|info| info.is_private).unwrap_or_default();
let mut pkg_fmt = self.target_data.meta.pkg_fmt;
let pkg_urls = if let Some(pkg_url) = self.target_data.meta.pkg_url.as_deref() {
let template = Template::parse(pkg_url)?;
if pkg_fmt.is_none()
&& !template.has_any_of_keys(&["format", "archive-format", "archive-suffix"])
{
// The crate does not specify the pkg-fmt, yet its pkg-url
// template doesn't contains format, archive-format or
// archive-suffix which is required for automatically
// deducing the pkg-fmt.
//
// We will attempt to guess the pkg-fmt there, but this is
// just a best-effort
pkg_fmt = PkgFmt::guess_pkg_format(pkg_url);
let crate_name = &self.data.name;
let version = &self.data.version;
let target = &self.target_data.target;
if pkg_fmt.is_none() {
return Err(InvalidPkgFmtError {
crate_name: crate_name.clone(),
version: version.clone(),
target: target.into(),
pkg_url: pkg_url.into(),
reason:
&"pkg-fmt is not specified, yet pkg-url does not contain format, \
archive-format or archive-suffix which is required for automatically \
deducing pkg-fmt",
}
.into());
}
warn!(
"Crate {crate_name}@{version} on target {target} does not specify pkg-fmt \
but its pkg-url also does not contain key format, archive-format or \
archive-suffix.\nbinstall was able to guess that from pkg-url, but \
just note that it could be wrong:\npkg-fmt=\"{pkg_fmt}\", pkg-url=\"{pkg_url}\"",
pkg_fmt = pkg_fmt.unwrap(),
);
}
Either::Left(iter::once(template))
} else if let Some(RepoInfo {
repo,
repository_host,
..
}) = info
{
if let Some(pkg_urls) = repository_host.get_default_pkg_url_template() {
let has_subcrate = subcrate.is_some();
Either::Right(
pkg_urls
.map(Template::cast)
// If subcrate is Some, then all templates will be included.
// Otherwise, only templates without key "subcrate" will be
// included.
.filter(move |template| has_subcrate || !template.has_key("subcrate")),
)
} else {
warn!(
concat!(
"Unknown repository {}, cargo-binstall cannot provide default pkg_url for it.\n",
"Please ask the upstream to provide it for target {}."
),
repo, self.target_data.target
);
return Ok(false);
}
} else {
warn!(
concat!(
"Package does not specify repository, cargo-binstall cannot provide default pkg_url for it.\n",
"Please ask the upstream to provide it for target {}."
),
self.target_data.target
);
return Ok(false);
};
// Convert Option<Url> to Option<String> to reduce size of future.
let repo = repo.map(|u| u.as_str().trim_end_matches('/'));
// Use reference to self to fix error of closure
// launch_baseline_find_tasks which moves `this`
let this = &self;
let pkg_fmts = if let Some(pkg_fmt) = pkg_fmt {
Either::Left(iter::once(pkg_fmt))
} else {
Either::Right(PkgFmt::iter())
};
let resolver = FuturesResolver::default();
// Iterate over pkg_urls first to avoid String::clone.
for pkg_url in pkg_urls {
// Clone iter pkg_fmts to ensure all pkg_fmts is
// iterated over for each pkg_url, which is
// basically cartesian product.
// |
for pkg_fmt in pkg_fmts.clone() {
this.launch_baseline_find_tasks(
&resolver,
pkg_fmt,
&pkg_url,
repo,
subcrate,
is_repo_private,
);
}
}
if let Some(resolved) = resolver.resolve().await {
debug!(?resolved, "Winning URL found!");
self.resolution
.set(resolved)
.expect("find() should be only called once");
Ok(true)
} else {
Ok(false)
}
})
}
async fn fetch_and_extract(&self, dst: &Path) -> Result<ExtractedFiles, FetchError> {
let resolved = self
.resolution
.get()
.expect("find() should be called once before fetch_and_extract()");
trace!(?resolved, "preparing to fetch");
let verifier = match (self.signature_policy, &self.target_data.meta.signing) {
(SignaturePolicy::Ignore, _) | (SignaturePolicy::IfPresent, None) => {
SignatureVerifier::Noop
}
(SignaturePolicy::Require, None) => {
return Err(FetchError::MissingSignature);
}
(_, Some(config)) => {
let template = match config.file.as_deref() {
Some(file) => Template::parse(file)?,
None => leon_macros::template!("{ url }.sig"),
};
trace!(?template, "parsed signature file template");
let sign_url = Context::from_data_with_repo(
&self.data,
&self.target_data.target,
&self.target_data.target_related_info,
resolved.archive_suffix.as_deref(),
resolved.repo.as_deref(),
resolved.subcrate.as_deref(),
)
.with_url(&resolved.url)
.render_url_with(&template)?;
debug!(?sign_url, "Downloading signature");
let signature = Download::new(self.client.clone(), sign_url)
.into_bytes()
.await?;
trace!(?signature, "got signature contents");
SignatureVerifier::new(config, &signature)?
}
};
debug!(
url=%resolved.url,
dst=%dst.display(),
fmt=?resolved.pkg_fmt,
"Downloading package",
);
let mut data_verifier = verifier.data_verifier()?;
let files = match resolved.gh_release_artifact_url.as_ref() {
Some(artifact_url) if resolved.is_repo_private => self
.gh_api_client
.download_artifact(artifact_url.clone())
.await?
.with_data_verifier(data_verifier.as_mut()),
_ => Download::new_with_data_verifier(
self.client.clone(),
resolved.url.clone(),
data_verifier.as_mut(),
),
}
.and_extract(resolved.pkg_fmt, dst)
.await?;
trace!("validating signature (if any)");
if data_verifier.validate() {
if let Some(info) = verifier.info() {
info!(
"Verified signature for package '{}': {info}",
self.data.name
);
}
Ok(files)
} else {
Err(FetchError::InvalidSignature)
}
}
fn pkg_fmt(&self) -> PkgFmt {
self.resolution.get().unwrap().pkg_fmt
}
fn target_meta(&self) -> PkgMeta {
let mut meta = self.target_data.meta.clone();
meta.pkg_fmt = Some(self.pkg_fmt());
meta
}
fn source_name(&self) -> CompactString {
self.resolution
.get()
.map(|resolved| {
if let Some(domain) = resolved.url.domain() {
domain.to_compact_string()
} else if let Some(host) = resolved.url.host_str() {
host.to_compact_string()
} else {
resolved.url.to_compact_string()
}
})
.unwrap_or_else(|| "invalid url".into())
}
fn fetcher_name(&self) -> &'static str {
FETCHER_GH_CRATE_META
}
fn strategy(&self) -> Strategy {
Strategy::CrateMetaData
}
fn is_third_party(&self) -> bool {
false
}
fn target(&self) -> &str {
&self.target_data.target
}
fn target_data(&self) -> &Arc<TargetDataErased> {
&self.target_data
}
}
/// Template for constructing download paths
#[derive(Clone)]
struct Context<'c> {
name: &'c str,
repo: Option<&'c str>,
target: &'c str,
version: &'c str,
/// Archive format e.g. tar.gz, zip
archive_format: Option<&'c str>,
archive_suffix: Option<&'c str>,
/// Filename extension on the binary, i.e. .exe on Windows, nothing otherwise
binary_ext: &'c str,
/// Workspace of the crate inside the repository.
subcrate: Option<&'c str>,
/// Url of the file being downloaded (only for signing.file)
url: Option<&'c Url>,
target_related_info: &'c dyn leon::Values,
}
impl fmt::Debug for Context<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Context")
.field("name", &self.name)
.field("repo", &self.repo)
.field("target", &self.target)
.field("version", &self.version)
.field("archive_format", &self.archive_format)
.field("binary_ext", &self.binary_ext)
.field("subcrate", &self.subcrate)
.field("url", &self.url)
.finish_non_exhaustive()
}
}
impl leon::Values for Context<'_> {
fn get_value<'s>(&'s self, key: &str) -> Option<Cow<'s, str>> {
match key {
"name" => Some(Cow::Borrowed(self.name)),
"repo" => self.repo.map(Cow::Borrowed),
"target" => Some(Cow::Borrowed(self.target)),
"version" => Some(Cow::Borrowed(self.version)),
"archive-format" => self.archive_format.map(Cow::Borrowed),
// Soft-deprecated alias for archive-format
"format" => self.archive_format.map(Cow::Borrowed),
"archive-suffix" => self.archive_suffix.map(Cow::Borrowed),
"binary-ext" => Some(Cow::Borrowed(self.binary_ext)),
"subcrate" => self.subcrate.map(Cow::Borrowed),
"url" => self.url.map(|url| Cow::Borrowed(url.as_str())),
key => self.target_related_info.get_value(key),
}
}
}
impl<'c> Context<'c> {
fn from_data_with_repo(
data: &'c Data,
target: &'c str,
target_related_info: &'c dyn leon::Values,
archive_suffix: Option<&'c str>,
repo: Option<&'c str>,
subcrate: Option<&'c str>,
) -> Self {
let archive_format = archive_suffix.map(|archive_suffix| {
if archive_suffix.is_empty() {
// Empty archive_suffix means PkgFmt::Bin
"bin"
} else {
debug_assert!(archive_suffix.starts_with('.'), "{archive_suffix}");
&archive_suffix[1..]
}
});
Self {
name: &data.name,
repo,
target,
version: &data.version,
archive_format,
archive_suffix,
binary_ext: if target.contains("windows") {
".exe"
} else {
""
},
subcrate,
url: None,
target_related_info,
}
}
fn with_url(&mut self, url: &'c Url) -> &mut Self {
self.url = Some(url);
self
}
fn render_url_with(&self, template: &Template<'_>) -> Result<Url, FetchError> {
debug!(?template, context=?self, "render url template");
Ok(Url::parse(&template.render(self)?)?)
}
#[cfg(test)]
fn render_url(&self, template: &str) -> Result<Url, FetchError> {
self.render_url_with(&Template::parse(template)?)
}
}
#[cfg(test)]
mod test {
use super::{super::Data, Context};
use compact_str::ToCompactString;
use url::Url;
const DEFAULT_PKG_URL: &str = "{ repo }/releases/download/v{ version }/{ name }-{ target }-v{ version }.{ archive-format }";
fn assert_context_rendering(
data: &Data,
target: &str,
archive_format: &str,
template: &str,
expected_url: &str,
) {
// The template provided doesn't need this, so just returning None
// is OK.
let target_info = leon::vals(|_| None);
let ctx = Context::from_data_with_repo(
data,
target,
&target_info,
Some(archive_format),
data.repo.as_deref(),
None,
);
let expected_url = Url::parse(expected_url).unwrap();
assert_eq!(ctx.render_url(template).unwrap(), expected_url);
}
#[test]
fn defaults() {
assert_context_rendering(
&Data::new(
"cargo-binstall".to_compact_string(),
"1.2.3".to_compact_string(),
Some("https://github.com/ryankurte/cargo-binstall".to_string()),
),
"x86_64-unknown-linux-gnu",
".tgz",
DEFAULT_PKG_URL,
"https://github.com/ryankurte/cargo-binstall/releases/download/v1.2.3/cargo-binstall-x86_64-unknown-linux-gnu-v1.2.3.tgz"
);
}
#[test]
fn no_repo_but_full_url() {
assert_context_rendering(
&Data::new(
"cargo-binstall".to_compact_string(),
"1.2.3".to_compact_string(),
None,
),
"x86_64-unknown-linux-gnu",
".tgz",
&format!("https://example.com{}", &DEFAULT_PKG_URL[8..]),
"https://example.com/releases/download/v1.2.3/cargo-binstall-x86_64-unknown-linux-gnu-v1.2.3.tgz"
);
}
#[test]
fn different_url() {
assert_context_rendering(
&Data::new(
"radio-sx128x".to_compact_string(),
"0.14.1-alpha.5".to_compact_string(),
Some("https://github.com/rust-iot/rust-radio-sx128x".to_string()),
),
"x86_64-unknown-linux-gnu",
".tgz",
"{ repo }/releases/download/v{ version }/sx128x-util-{ target }-v{ version }.{ archive-format }",
"https://github.com/rust-iot/rust-radio-sx128x/releases/download/v0.14.1-alpha.5/sx128x-util-x86_64-unknown-linux-gnu-v0.14.1-alpha.5.tgz"
);
}
#[test]
fn deprecated_format() {
assert_context_rendering(
&Data::new(
"radio-sx128x".to_compact_string(),
"0.14.1-alpha.5".to_compact_string(),
Some("https://github.com/rust-iot/rust-radio-sx128x".to_string()),
),
"x86_64-unknown-linux-gnu",
".tgz",
"{ repo }/releases/download/v{ version }/sx128x-util-{ target }-v{ version }.{ format }",
"https://github.com/rust-iot/rust-radio-sx128x/releases/download/v0.14.1-alpha.5/sx128x-util-x86_64-unknown-linux-gnu-v0.14.1-alpha.5.tgz"
);
}
#[test]
fn different_ext() {
assert_context_rendering(
&Data::new(
"cargo-watch".to_compact_string(),
"9.0.0".to_compact_string(),
Some("https://github.com/watchexec/cargo-watch".to_string()),
),
"aarch64-apple-darwin",
".txz",
"{ repo }/releases/download/v{ version }/{ name }-v{ version }-{ target }.tar.xz",
"https://github.com/watchexec/cargo-watch/releases/download/v9.0.0/cargo-watch-v9.0.0-aarch64-apple-darwin.tar.xz"
);
}
#[test]
fn no_archive() {
assert_context_rendering(
&Data::new(
"cargo-watch".to_compact_string(),
"9.0.0".to_compact_string(),
Some("https://github.com/watchexec/cargo-watch".to_string()),
),
"aarch64-pc-windows-msvc",
".bin",
"{ repo }/releases/download/v{ version }/{ name }-v{ version }-{ target }{ binary-ext }",
"https://github.com/watchexec/cargo-watch/releases/download/v9.0.0/cargo-watch-v9.0.0-aarch64-pc-windows-msvc.exe"
);
}
}

View file

@ -0,0 +1,117 @@
use itertools::Itertools;
use leon::{Item, Template};
use leon_macros::template;
use url::Url;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum RepositoryHost {
GitHub,
GitLab,
BitBucket,
SourceForge,
Unknown,
}
/// Make sure to update possible_dirs in `bins::infer_bin_dir_template`
/// if you modified FULL_FILENAMES or NOVERSION_FILENAMES.
pub const FULL_FILENAMES: &[Template<'_>] = &[
template!("/{ name }-{ target }-v{ version }{ archive-suffix }"),
template!("/{ name }-{ target }-{ version }{ archive-suffix }"),
template!("/{ name }-{ version }-{ target }{ archive-suffix }"),
template!("/{ name }-v{ version }-{ target }{ archive-suffix }"),
template!("/{ name }_{ target }_v{ version }{ archive-suffix }"),
template!("/{ name }_{ target }_{ version }{ archive-suffix }"),
template!("/{ name }_{ version }_{ target }{ archive-suffix }"),
template!("/{ name }_v{ version }_{ target }{ archive-suffix }"),
];
pub const NOVERSION_FILENAMES: &[Template<'_>] = &[
template!("/{ name }-{ target }{ archive-suffix }"),
template!("/{ name }_{ target }{ archive-suffix }"),
];
const GITHUB_RELEASE_PATHS: &[Template<'_>] = &[
template!("{ repo }/releases/download/{ version }"),
template!("{ repo }/releases/download/v{ version }"),
// %2F is escaped form of '/'
template!("{ repo }/releases/download/{ subcrate }%2F{ version }"),
template!("{ repo }/releases/download/{ subcrate }%2Fv{ version }"),
];
const GITLAB_RELEASE_PATHS: &[Template<'_>] = &[
template!("{ repo }/-/releases/{ version }/downloads/binaries"),
template!("{ repo }/-/releases/v{ version }/downloads/binaries"),
// %2F is escaped form of '/'
template!("{ repo }/-/releases/{ subcrate }%2F{ version }/downloads/binaries"),
template!("{ repo }/-/releases/{ subcrate }%2Fv{ version }/downloads/binaries"),
];
const BITBUCKET_RELEASE_PATHS: &[Template<'_>] = &[template!("{ repo }/downloads")];
const SOURCEFORGE_RELEASE_PATHS: &[Template<'_>] = &[
template!("{ repo }/files/binaries/{ version }"),
template!("{ repo }/files/binaries/v{ version }"),
// %2F is escaped form of '/'
template!("{ repo }/files/binaries/{ subcrate }%2F{ version }"),
template!("{ repo }/files/binaries/{ subcrate }%2Fv{ version }"),
];
impl RepositoryHost {
pub fn guess_git_hosting_services(repo: &Url) -> Self {
use RepositoryHost::*;
match repo.domain() {
Some(domain) if domain.starts_with("github") => GitHub,
Some(domain) if domain.starts_with("gitlab") => GitLab,
Some("bitbucket.org") => BitBucket,
Some("sourceforge.net") => SourceForge,
_ => Unknown,
}
}
pub fn get_default_pkg_url_template(
self,
) -> Option<impl Iterator<Item = Template<'static>> + Clone + 'static> {
use RepositoryHost::*;
match self {
GitHub => Some(apply_filenames_to_paths(
GITHUB_RELEASE_PATHS,
&[FULL_FILENAMES, NOVERSION_FILENAMES],
"",
)),
GitLab => Some(apply_filenames_to_paths(
GITLAB_RELEASE_PATHS,
&[FULL_FILENAMES, NOVERSION_FILENAMES],
"",
)),
BitBucket => Some(apply_filenames_to_paths(
BITBUCKET_RELEASE_PATHS,
&[FULL_FILENAMES],
"",
)),
SourceForge => Some(apply_filenames_to_paths(
SOURCEFORGE_RELEASE_PATHS,
&[FULL_FILENAMES, NOVERSION_FILENAMES],
"/download",
)),
Unknown => None,
}
}
}
fn apply_filenames_to_paths(
paths: &'static [Template<'static>],
filenames: &'static [&'static [Template<'static>]],
suffix: &'static str,
) -> impl Iterator<Item = Template<'static>> + Clone + 'static {
filenames
.iter()
.flat_map(|fs| fs.iter())
.cartesian_product(paths.iter())
.map(move |(filename, path)| {
let mut template = path.clone() + filename;
template += Item::Text(suffix);
template
})
}

View file

@ -0,0 +1,457 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
use std::{path::Path, sync::Arc, time::Duration};
use binstalk_downloader::{download::DownloadError, remote::Error as RemoteError};
use binstalk_git_repo_api::gh_api_client::{GhApiError, GhRepo, RepoInfo as GhRepoInfo};
use binstalk_types::cargo_toml_binstall::{SigningAlgorithm, Strategy};
use thiserror::Error as ThisError;
use tokio::{sync::OnceCell, task::JoinError, time::sleep};
pub use url::ParseError as UrlParseError;
mod gh_crate_meta;
pub use gh_crate_meta::*;
#[cfg(feature = "quickinstall")]
mod quickinstall;
#[cfg(feature = "quickinstall")]
pub use quickinstall::*;
mod common;
use common::*;
mod signing;
use signing::*;
mod futures_resolver;
use gh_crate_meta::hosting::RepositoryHost;
static DEFAULT_GH_API_RETRY_DURATION: Duration = Duration::from_secs(1);
#[derive(Debug, ThisError)]
#[error("Invalid pkg-url {pkg_url} for {crate_name}@{version} on {target}: {reason}")]
pub struct InvalidPkgFmtError {
pub crate_name: CompactString,
pub version: CompactString,
pub target: CompactString,
pub pkg_url: Box<str>,
pub reason: &'static &'static str,
}
#[derive(Debug, ThisError, miette::Diagnostic)]
#[non_exhaustive]
pub enum FetchError {
#[error(transparent)]
Download(#[from] DownloadError),
#[error("Failed to parse template: {0}")]
#[diagnostic(transparent)]
TemplateParse(#[from] leon::ParseError),
#[error("Failed to render template: {0}")]
#[diagnostic(transparent)]
TemplateRender(#[from] leon::RenderError),
#[error("Failed to render template: {0}")]
GhApi(#[from] GhApiError),
#[error(transparent)]
InvalidPkgFmt(Box<InvalidPkgFmtError>),
#[error("Failed to parse url: {0}")]
UrlParse(#[from] UrlParseError),
#[error("Signing algorithm not supported: {0:?}")]
UnsupportedSigningAlgorithm(SigningAlgorithm),
#[error("No signature present")]
MissingSignature,
#[error("Failed to verify signature")]
InvalidSignature,
#[error("Failed to wait for task: {0}")]
TaskJoinError(#[from] JoinError),
}
impl From<RemoteError> for FetchError {
fn from(e: RemoteError) -> Self {
DownloadError::from(e).into()
}
}
impl From<InvalidPkgFmtError> for FetchError {
fn from(e: InvalidPkgFmtError) -> Self {
Self::InvalidPkgFmt(Box::new(e))
}
}
#[async_trait::async_trait]
pub trait Fetcher: Send + Sync {
/// Create a new fetcher from some data
#[allow(clippy::new_ret_no_self)]
fn new(
client: Client,
gh_api_client: GhApiClient,
data: Arc<Data>,
target_data: Arc<TargetDataErased>,
signature_policy: SignaturePolicy,
) -> Arc<dyn Fetcher>
where
Self: Sized;
/// Fetch a package and extract
async fn fetch_and_extract(&self, dst: &Path) -> Result<ExtractedFiles, FetchError>;
/// Find the package, if it is available for download
///
/// This may look for multiple remote targets, but must write (using some form of interior
/// mutability) the best one to the implementing struct in some way so `fetch_and_extract` can
/// proceed without additional work.
///
/// Must return `true` if a package is available, `false` if none is, and reserve errors to
/// fatal conditions only.
fn find(self: Arc<Self>) -> JoinHandle<Result<bool, FetchError>>;
/// Report to upstream that cargo-binstall tries to use this fetcher.
/// Currently it is only overriden by [`quickinstall::QuickInstall`].
fn report_to_upstream(self: Arc<Self>) {}
/// Return the package format
fn pkg_fmt(&self) -> PkgFmt;
/// Return finalized target meta.
fn target_meta(&self) -> PkgMeta;
/// A short human-readable name or descriptor for the package source
fn source_name(&self) -> CompactString;
/// A short human-readable name, must contains only characters
/// and numbers and it also must be unique.
///
/// It is used to create a temporary dir where it is used for
/// [`Fetcher::fetch_and_extract`].
fn fetcher_name(&self) -> &'static str;
/// The strategy used by this fetcher
fn strategy(&self) -> Strategy;
/// Should return true if the remote is from a third-party source
fn is_third_party(&self) -> bool;
/// Return the target for this fetcher
fn target(&self) -> &str;
fn target_data(&self) -> &Arc<TargetDataErased>;
}
#[derive(Clone, Debug)]
struct RepoInfo {
repo: Url,
repository_host: RepositoryHost,
subcrate: Option<CompactString>,
is_private: bool,
}
/// What to do about package signatures
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum SignaturePolicy {
/// Don't process any signing information at all
Ignore,
/// Verify and fail if a signature is found, but pass a signature-less package
IfPresent,
/// Require signatures to be present (and valid)
Require,
}
/// Data required to fetch a package
#[derive(Clone, Debug)]
pub struct Data {
name: CompactString,
version: CompactString,
repo: Option<String>,
repo_info: OnceCell<Option<RepoInfo>>,
}
impl Data {
pub fn new(name: CompactString, version: CompactString, repo: Option<String>) -> Self {
Self {
name,
version,
repo,
repo_info: OnceCell::new(),
}
}
#[instrument(skip(client))]
async fn get_repo_info(&self, client: &GhApiClient) -> Result<Option<&RepoInfo>, FetchError> {
async fn gh_get_repo_info(
client: &GhApiClient,
gh_repo: &GhRepo,
) -> Result<GhRepoInfo, GhApiError> {
loop {
match client.get_repo_info(gh_repo).await {
Ok(Some(gh_repo_info)) => break Ok(gh_repo_info),
Ok(None) => break Err(GhApiError::NotFound),
Err(GhApiError::RateLimit { retry_after }) => {
sleep(retry_after.unwrap_or(DEFAULT_GH_API_RETRY_DURATION)).await
}
Err(err) => break Err(err),
}
}
}
async fn get_repo_info_inner(
repo: &str,
client: &GhApiClient,
) -> Result<RepoInfo, FetchError> {
let repo = Url::parse(repo)?;
let mut repo = client
.remote_client()
.get_redirected_final_url(repo.clone())
.await
.unwrap_or(repo);
let repository_host = RepositoryHost::guess_git_hosting_services(&repo);
let subcrate = RepoInfo::detect_subcrate(&mut repo, repository_host);
if let Some(repo) = repo
.as_str()
.strip_suffix(".git")
.and_then(|s| Url::parse(s).ok())
{
let repository_host = RepositoryHost::guess_git_hosting_services(&repo);
match GhRepo::try_extract_from_url(&repo) {
Some(gh_repo) if client.has_gh_token() => {
if let Ok(gh_repo_info) = gh_get_repo_info(client, &gh_repo).await {
return Ok(RepoInfo {
subcrate,
repository_host,
repo,
is_private: gh_repo_info.is_private(),
});
}
}
_ => {
if let Ok(repo) =
client.remote_client().get_redirected_final_url(repo).await
{
return Ok(RepoInfo {
subcrate,
repository_host: RepositoryHost::guess_git_hosting_services(&repo),
repo,
is_private: false,
});
}
}
}
}
Ok(RepoInfo {
is_private: match GhRepo::try_extract_from_url(&repo) {
Some(gh_repo) if client.has_gh_token() => {
gh_get_repo_info(client, &gh_repo).await?.is_private()
}
_ => false,
},
subcrate,
repo,
repository_host,
})
}
self.repo_info
.get_or_try_init(move || {
Box::pin(async move {
let Some(repo) = self.repo.as_deref() else {
return Ok(None);
};
let repo_info = get_repo_info_inner(repo, client).await?;
debug!("Resolved repo_info = {repo_info:#?}");
Ok(Some(repo_info))
})
})
.await
.map(Option::as_ref)
}
}
impl RepoInfo {
/// If `repo` contains a subcrate, then extracts and returns it.
/// It will also remove that subcrate path from `repo` to match
/// `scheme:/{repo_owner}/{repo_name}`
fn detect_subcrate(repo: &mut Url, repository_host: RepositoryHost) -> Option<CompactString> {
match repository_host {
RepositoryHost::GitHub => Self::detect_subcrate_common(repo, &["tree"]),
RepositoryHost::GitLab => Self::detect_subcrate_common(repo, &["-", "blob"]),
_ => None,
}
}
fn detect_subcrate_common(repo: &mut Url, seps: &[&str]) -> Option<CompactString> {
let mut path_segments = repo.path_segments()?;
let _repo_owner = path_segments.next()?;
let _repo_name = path_segments.next()?;
// Skip separators
for sep in seps.iter().copied() {
if path_segments.next()? != sep {
return None;
}
}
// Skip branch name
let _branch_name = path_segments.next()?;
let (subcrate, is_crate_present) = match path_segments.next()? {
// subcrate url is of path /crates/$subcrate_name, e.g. wasm-bindgen-cli
"crates" => (path_segments.next()?, true),
// subcrate url is of path $subcrate_name, e.g. cargo-audit
subcrate => (subcrate, false),
};
if path_segments.next().is_some() {
// A subcrate url should not contain anything more.
None
} else {
let subcrate = subcrate.into();
// Pop subcrate path to match regular repo style:
//
// scheme:/{addr}/{repo_owner}/{repo_name}
//
// path_segments() succeeds, so path_segments_mut()
// must also succeeds.
let mut paths = repo.path_segments_mut().unwrap();
paths.pop(); // pop subcrate
if is_crate_present {
paths.pop(); // pop crate
}
paths.pop(); // pop branch name
seps.iter().for_each(|_| {
paths.pop();
}); // pop separators
Some(subcrate)
}
}
}
/// Target specific data required to fetch a package
#[derive(Clone, Debug)]
pub struct TargetData<T: leon::Values + ?Sized> {
pub target: String,
pub meta: PkgMeta,
/// More target related info, it's recommend to provide the following keys:
/// - target_family,
/// - target_arch
/// - target_libc
/// - target_vendor
pub target_related_info: T,
}
pub type TargetDataErased = TargetData<dyn leon::Values + Send + Sync + 'static>;
#[cfg(test)]
mod test {
use std::num::{NonZeroU16, NonZeroU64};
use super::*;
#[test]
fn test_detect_subcrate_github() {
// cargo-audit
let urls = [
"https://github.com/RustSec/rustsec/tree/main/cargo-audit",
"https://github.com/RustSec/rustsec/tree/master/cargo-audit",
];
for url in urls {
let mut repo = Url::parse(url).unwrap();
let repository_host = RepositoryHost::guess_git_hosting_services(&repo);
assert_eq!(repository_host, RepositoryHost::GitHub);
let subcrate_prefix = RepoInfo::detect_subcrate(&mut repo, repository_host).unwrap();
assert_eq!(subcrate_prefix, "cargo-audit");
assert_eq!(
repo,
Url::parse("https://github.com/RustSec/rustsec").unwrap()
);
}
// wasm-bindgen-cli
let urls = [
"https://github.com/rustwasm/wasm-bindgen/tree/main/crates/cli",
"https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli",
];
for url in urls {
let mut repo = Url::parse(url).unwrap();
let repository_host = RepositoryHost::guess_git_hosting_services(&repo);
assert_eq!(repository_host, RepositoryHost::GitHub);
let subcrate_prefix = RepoInfo::detect_subcrate(&mut repo, repository_host).unwrap();
assert_eq!(subcrate_prefix, "cli");
assert_eq!(
repo,
Url::parse("https://github.com/rustwasm/wasm-bindgen").unwrap()
);
}
}
#[test]
fn test_detect_subcrate_gitlab() {
let urls = [
"https://gitlab.kitware.com/NobodyXu/hello/-/blob/main/cargo-binstall",
"https://gitlab.kitware.com/NobodyXu/hello/-/blob/master/cargo-binstall",
];
for url in urls {
let mut repo = Url::parse(url).unwrap();
let repository_host = RepositoryHost::guess_git_hosting_services(&repo);
assert_eq!(repository_host, RepositoryHost::GitLab);
let subcrate_prefix = RepoInfo::detect_subcrate(&mut repo, repository_host).unwrap();
assert_eq!(subcrate_prefix, "cargo-binstall");
assert_eq!(
repo,
Url::parse("https://gitlab.kitware.com/NobodyXu/hello").unwrap()
);
}
}
#[tokio::test]
async fn test_ignore_dot_git_for_github_repos() {
let url_without_git = "https://github.com/cargo-bins/cargo-binstall";
let url_with_git = format!("{}.git", url_without_git);
let data = Data::new("cargo-binstall".into(), "v1.2.3".into(), Some(url_with_git));
let gh_client = GhApiClient::new(
Client::new(
"user-agent",
None,
NonZeroU16::new(1000).unwrap(),
NonZeroU64::new(1000).unwrap(),
[],
)
.unwrap(),
None,
);
let repo_info = data.get_repo_info(&gh_client).await.unwrap().unwrap();
assert_eq!(url_without_git, repo_info.repo.as_str());
}
}

View file

@ -0,0 +1,383 @@
use std::{
borrow::Cow,
path::Path,
sync::{Arc, Mutex, OnceLock},
};
use binstalk_downloader::remote::Method;
use binstalk_types::cargo_toml_binstall::{PkgFmt, PkgMeta, PkgSigning, Strategy};
use tokio::sync::OnceCell;
use tracing::{error, info, trace};
use url::Url;
use crate::{
common::*, Data, FetchError, SignaturePolicy, SignatureVerifier, SigningAlgorithm,
TargetDataErased,
};
const BASE_URL: &str = "https://github.com/cargo-bins/cargo-quickinstall/releases/download";
pub const QUICKINSTALL_STATS_URL: &str =
"https://cargo-quickinstall-stats-server.fly.dev/record-install";
const QUICKINSTALL_SIGN_KEY: Cow<'static, str> =
Cow::Borrowed("RWTdnnab2pAka9OdwgCMYyOE66M/BlQoFWaJ/JjwcPV+f3n24IRTj97t");
const QUICKINSTALL_SUPPORTED_TARGETS_URL: &str =
"https://raw.githubusercontent.com/cargo-bins/cargo-quickinstall/main/supported-targets";
fn is_universal_macos(target: &str) -> bool {
["universal-apple-darwin", "universal2-apple-darwin"].contains(&target)
}
async fn get_quickinstall_supported_targets(
client: &Client,
) -> Result<&'static [CompactString], FetchError> {
static SUPPORTED_TARGETS: OnceCell<Box<[CompactString]>> = OnceCell::const_new();
SUPPORTED_TARGETS
.get_or_try_init(|| async {
let bytes = client
.get(Url::parse(QUICKINSTALL_SUPPORTED_TARGETS_URL)?)
.send(true)
.await?
.bytes()
.await?;
let mut v: Vec<CompactString> = String::from_utf8_lossy(&bytes)
.split_whitespace()
.map(CompactString::new)
.collect();
v.sort_unstable();
v.dedup();
Ok(v.into())
})
.await
.map(Box::as_ref)
}
pub struct QuickInstall {
client: Client,
gh_api_client: GhApiClient,
is_supported_v: OnceCell<bool>,
data: Arc<Data>,
package: String,
package_url: Url,
signature_url: Url,
signature_policy: SignaturePolicy,
target_data: Arc<TargetDataErased>,
signature_verifier: OnceLock<SignatureVerifier>,
status: Mutex<Status>,
}
#[derive(Debug, Clone, Copy)]
enum Status {
Start,
NotFound,
Found,
AttemptingInstall,
InvalidSignature,
InstalledFromTarball,
}
impl Status {
fn as_str(&self) -> &'static str {
match self {
Status::Start => "start",
Status::NotFound => "not-found",
Status::Found => "found",
Status::AttemptingInstall => "attempting-install",
Status::InvalidSignature => "invalid-signature",
Status::InstalledFromTarball => "installed-from-tarball",
}
}
}
impl QuickInstall {
async fn is_supported(&self) -> Result<bool, FetchError> {
self.is_supported_v
.get_or_try_init(|| async {
Ok(get_quickinstall_supported_targets(&self.client)
.await?
.binary_search(&CompactString::new(&self.target_data.target))
.is_ok())
})
.await
.copied()
}
fn download_signature(
self: Arc<Self>,
) -> AutoAbortJoinHandle<Result<SignatureVerifier, FetchError>> {
AutoAbortJoinHandle::spawn(async move {
if self.signature_policy == SignaturePolicy::Ignore {
Ok(SignatureVerifier::Noop)
} else {
debug!(url=%self.signature_url, "Downloading signature");
match Download::new(self.client.clone(), self.signature_url.clone())
.into_bytes()
.await
{
Ok(signature) => {
trace!(?signature, "got signature contents");
let config = PkgSigning {
algorithm: SigningAlgorithm::Minisign,
pubkey: QUICKINSTALL_SIGN_KEY,
file: None,
};
SignatureVerifier::new(&config, &signature)
}
Err(err) => {
if self.signature_policy == SignaturePolicy::Require {
error!("Failed to download signature: {err}");
Err(FetchError::MissingSignature)
} else {
debug!("Failed to download signature, skipping verification: {err}");
Ok(SignatureVerifier::Noop)
}
}
}
}
})
}
fn get_status(&self) -> Status {
*self.status.lock().unwrap()
}
fn set_status(&self, status: Status) {
*self.status.lock().unwrap() = status;
}
}
#[async_trait::async_trait]
impl super::Fetcher for QuickInstall {
fn new(
client: Client,
gh_api_client: GhApiClient,
data: Arc<Data>,
target_data: Arc<TargetDataErased>,
signature_policy: SignaturePolicy,
) -> Arc<dyn super::Fetcher> {
let crate_name = &data.name;
let version = &data.version;
let target = &target_data.target;
let package = format!("{crate_name}-{version}-{target}");
let url = format!("{BASE_URL}/{crate_name}-{version}/{package}.tar.gz");
Arc::new(Self {
client,
data,
gh_api_client,
is_supported_v: OnceCell::new(),
package_url: Url::parse(&url)
.expect("package_url is pre-generated and should never be invalid url"),
signature_url: Url::parse(&format!("{url}.sig"))
.expect("signature_url is pre-generated and should never be invalid url"),
package,
signature_policy,
target_data,
signature_verifier: OnceLock::new(),
status: Mutex::new(Status::Start),
})
}
fn find(self: Arc<Self>) -> JoinHandle<Result<bool, FetchError>> {
tokio::spawn(async move {
if !self.is_supported().await? {
return Ok(false);
}
let download_signature_task = self.clone().download_signature();
let is_found = does_url_exist(
self.client.clone(),
self.gh_api_client.clone(),
&self.package_url,
)
.await?;
if !is_found {
self.set_status(Status::NotFound);
return Ok(false);
}
if self
.signature_verifier
.set(download_signature_task.flattened_join().await?)
.is_err()
{
panic!("<QuickInstall as Fetcher>::find is run twice");
}
self.set_status(Status::Found);
Ok(true)
})
}
fn report_to_upstream(self: Arc<Self>) {
if cfg!(debug_assertions) {
debug!("Not sending quickinstall report in debug mode");
} else if is_universal_macos(&self.target_data.target) {
debug!(
r#"Not sending quickinstall report for universal-apple-darwin
and universal2-apple-darwin.
Quickinstall does not support these targets, it only supports targets supported
by rust officially."#,
);
} else if self.is_supported_v.get().copied() != Some(false) {
tokio::spawn(async move {
if let Err(err) = self.report().await {
warn!(
"Failed to send quickinstall report for package {} (NOTE that this does not affect package resolution): {err}",
self.package
)
}
});
}
}
async fn fetch_and_extract(&self, dst: &Path) -> Result<ExtractedFiles, FetchError> {
self.set_status(Status::AttemptingInstall);
let Some(verifier) = self.signature_verifier.get() else {
panic!("<QuickInstall as Fetcher>::find has not been called yet!")
};
debug!(url=%self.package_url, "Downloading package");
let mut data_verifier = verifier.data_verifier()?;
let files = Download::new_with_data_verifier(
self.client.clone(),
self.package_url.clone(),
data_verifier.as_mut(),
)
.and_extract(self.pkg_fmt(), dst)
.await?;
trace!("validating signature (if any)");
if data_verifier.validate() {
if let Some(info) = verifier.info() {
info!("Verified signature for package '{}': {info}", self.package);
}
self.set_status(Status::InstalledFromTarball);
Ok(files)
} else {
self.set_status(Status::InvalidSignature);
Err(FetchError::InvalidSignature)
}
}
fn pkg_fmt(&self) -> PkgFmt {
PkgFmt::Tgz
}
fn target_meta(&self) -> PkgMeta {
let mut meta = self.target_data.meta.clone();
meta.pkg_fmt = Some(self.pkg_fmt());
meta.bin_dir = Some("{ bin }{ binary-ext }".to_string());
meta
}
fn source_name(&self) -> CompactString {
CompactString::from("QuickInstall")
}
fn fetcher_name(&self) -> &'static str {
"QuickInstall"
}
fn strategy(&self) -> Strategy {
Strategy::QuickInstall
}
fn is_third_party(&self) -> bool {
true
}
fn target(&self) -> &str {
&self.target_data.target
}
fn target_data(&self) -> &Arc<TargetDataErased> {
&self.target_data
}
}
impl QuickInstall {
pub async fn report(&self) -> Result<(), FetchError> {
if !self.is_supported().await? {
debug!(
"Not sending quickinstall report for {} since Quickinstall does not support these targets.",
self.target_data.target
);
return Ok(());
}
let mut url = Url::parse(QUICKINSTALL_STATS_URL)
.expect("stats_url is pre-generated and should never be invalid url");
url.query_pairs_mut()
.append_pair("crate", &self.data.name)
.append_pair("version", &self.data.version)
.append_pair("target", &self.target_data.target)
.append_pair(
"agent",
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")),
)
.append_pair("status", self.get_status().as_str());
debug!("Sending installation report to quickinstall ({url})");
self.client.request(Method::POST, url).send(true).await?;
Ok(())
}
}
#[cfg(test)]
mod test {
use super::{get_quickinstall_supported_targets, Client, CompactString};
use std::num::NonZeroU16;
/// Mark this as an async fn so that you won't accidentally use it in
/// sync context.
async fn create_client() -> Client {
Client::new(
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")),
None,
NonZeroU16::new(10).unwrap(),
1.try_into().unwrap(),
[],
)
.unwrap()
}
#[tokio::test]
async fn test_get_quickinstall_supported_targets() {
let supported_targets = get_quickinstall_supported_targets(&create_client().await)
.await
.unwrap();
[
"x86_64-pc-windows-msvc",
"x86_64-apple-darwin",
"aarch64-apple-darwin",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"armv7-unknown-linux-musleabihf",
"armv7-unknown-linux-gnueabihf",
]
.into_iter()
.for_each(|known_supported_target| {
supported_targets
.binary_search(&CompactString::new(known_supported_target))
.unwrap();
});
}
}

View file

@ -0,0 +1,91 @@
use binstalk_downloader::download::DataVerifier;
use binstalk_types::cargo_toml_binstall::{PkgSigning, SigningAlgorithm};
use bytes::Bytes;
use minisign_verify::{PublicKey, Signature, StreamVerifier};
use tracing::{error, trace};
use crate::FetchError;
pub enum SignatureVerifier {
Noop,
Minisign(Box<MinisignVerifier>),
}
impl SignatureVerifier {
pub fn new(config: &PkgSigning, signature: &[u8]) -> Result<Self, FetchError> {
match config.algorithm {
SigningAlgorithm::Minisign => MinisignVerifier::new(config, signature)
.map(Box::new)
.map(Self::Minisign),
algorithm => Err(FetchError::UnsupportedSigningAlgorithm(algorithm)),
}
}
pub fn data_verifier(&self) -> Result<Box<dyn DataVerifier + '_>, FetchError> {
match self {
Self::Noop => Ok(Box::new(())),
Self::Minisign(v) => v.data_verifier(),
}
}
pub fn info(&self) -> Option<String> {
match self {
Self::Noop => None,
Self::Minisign(v) => Some(v.signature.trusted_comment().into()),
}
}
}
pub struct MinisignVerifier {
pubkey: PublicKey,
signature: Signature,
}
impl MinisignVerifier {
pub fn new(config: &PkgSigning, signature: &[u8]) -> Result<Self, FetchError> {
trace!(key=?config.pubkey, "parsing public key");
let pubkey = PublicKey::from_base64(&config.pubkey).map_err(|err| {
error!("Package public key is invalid: {err}");
FetchError::InvalidSignature
})?;
trace!(?signature, "parsing signature");
let signature = Signature::decode(std::str::from_utf8(signature).map_err(|err| {
error!(?signature, "Signature file is not UTF-8! {err}");
FetchError::InvalidSignature
})?)
.map_err(|err| {
error!("Signature file is invalid: {err}");
FetchError::InvalidSignature
})?;
Ok(Self { pubkey, signature })
}
pub fn data_verifier(&self) -> Result<Box<dyn DataVerifier + '_>, FetchError> {
self.pubkey
.verify_stream(&self.signature)
.map(|vs| Box::new(MinisignDataVerifier(vs)) as _)
.map_err(|err| {
error!("Failed to setup stream verifier: {err}");
FetchError::InvalidSignature
})
}
}
pub struct MinisignDataVerifier<'a>(StreamVerifier<'a>);
impl DataVerifier for MinisignDataVerifier<'_> {
fn update(&mut self, data: &Bytes) {
self.0.update(data);
}
fn validate(&mut self) -> bool {
if let Err(err) = self.0.finalize() {
error!("Failed to finalize signature verify: {err}");
false
} else {
true
}
}
}

View file

@ -0,0 +1,129 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.5.19](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.18...binstalk-git-repo-api-v0.5.19) - 2025-04-05
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.5.18](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.17...binstalk-git-repo-api-v0.5.18) - 2025-03-19
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.5.17](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.16...binstalk-git-repo-api-v0.5.17) - 2025-03-15
### Other
- *(deps)* bump tokio from 1.43.0 to 1.44.0 in the deps group ([#2079](https://github.com/cargo-bins/cargo-binstall/pull/2079))
## [0.5.16](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.15...binstalk-git-repo-api-v0.5.16) - 2025-03-07
### Other
- *(deps)* bump the deps group with 3 updates ([#2072](https://github.com/cargo-bins/cargo-binstall/pull/2072))
## [0.5.15](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.14...binstalk-git-repo-api-v0.5.15) - 2025-02-28
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.5.14](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.13...binstalk-git-repo-api-v0.5.14) - 2025-02-11
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.5.13](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.12...binstalk-git-repo-api-v0.5.13) - 2025-02-04
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.5.12](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.11...binstalk-git-repo-api-v0.5.12) - 2025-01-19
### Other
- update Cargo.lock dependencies
## [0.5.11](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.10...binstalk-git-repo-api-v0.5.11) - 2025-01-13
### Other
- update Cargo.lock dependencies
## [0.5.10](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.9...binstalk-git-repo-api-v0.5.10) - 2025-01-11
### Other
- *(deps)* bump the deps group with 3 updates (#2015)
## [0.5.9](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.8...binstalk-git-repo-api-v0.5.9) - 2025-01-04
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.5.8](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.7...binstalk-git-repo-api-v0.5.8) - 2024-12-14
### Other
- *(deps)* bump the deps group with 2 updates (#1997)
## [0.5.7](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.6...binstalk-git-repo-api-v0.5.7) - 2024-11-23
### Other
- *(deps)* bump the deps group with 2 updates ([#1981](https://github.com/cargo-bins/cargo-binstall/pull/1981))
## [0.5.6](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.5...binstalk-git-repo-api-v0.5.6) - 2024-11-09
### Other
- *(deps)* bump the deps group with 3 updates ([#1966](https://github.com/cargo-bins/cargo-binstall/pull/1966))
## [0.5.5](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.4...binstalk-git-repo-api-v0.5.5) - 2024-11-05
### Other
- *(deps)* bump the deps group with 3 updates ([#1954](https://github.com/cargo-bins/cargo-binstall/pull/1954))
## [0.5.4](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.3...binstalk-git-repo-api-v0.5.4) - 2024-11-02
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.5.3](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.2...binstalk-git-repo-api-v0.5.3) - 2024-10-12
### Fixed
- *(gh_api_client)* remote client should never being shared everywhere bacause the underlying connection pool will be reused. ([#1930](https://github.com/cargo-bins/cargo-binstall/pull/1930))
### Other
- Fix binstalk-git-repo-api on PR of forks ([#1932](https://github.com/cargo-bins/cargo-binstall/pull/1932))
## [0.5.2](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.1...binstalk-git-repo-api-v0.5.2) - 2024-09-11
### Other
- report to new stats server (with status) ([#1912](https://github.com/cargo-bins/cargo-binstall/pull/1912))
## [0.5.1](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.5.0...binstalk-git-repo-api-v0.5.1) - 2024-08-12
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader
## [0.5.0](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-git-repo-api-v0.4.0...binstalk-git-repo-api-v0.5.0) - 2024-08-10
### Other
- updated the following local packages: binstalk-downloader, binstalk-downloader

View file

@ -0,0 +1,30 @@
[package]
name = "binstalk-git-repo-api"
description = "The binstall toolkit for accessing API for git repository"
repository = "https://github.com/cargo-bins/cargo-binstall"
documentation = "https://docs.rs/binstalk-git-repo-api"
version = "0.5.19"
rust-version = "1.70.0"
authors = ["Jiahao XU <Jiahao_XU@outlook.com>"]
edition = "2021"
license = "Apache-2.0 OR MIT"
[dependencies]
binstalk-downloader = { version = "0.13.17", path = "../binstalk-downloader", default-features = false, features = [
"json",
] }
compact_str = "0.9.0"
percent-encoding = "2.2.0"
serde = { version = "1.0.163", features = ["derive"] }
serde-tuple-vec-map = "1.0.1"
serde_json = { version = "1.0.107" }
thiserror = "2.0.11"
tokio = { version = "1.44.0", features = ["sync"], default-features = false }
tracing = "0.1.39"
url = "2.5.4"
zeroize = "1.8.1"
[dev-dependencies]
binstalk-downloader = { version = "0.13.17", path = "../binstalk-downloader" }
tracing-subscriber = "0.3"
once_cell = "1"

View file

@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

View file

@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,730 @@
use std::{
collections::HashMap,
future::Future,
ops::Deref,
sync::{
atomic::{AtomicBool, Ordering::Relaxed},
Arc, Mutex, RwLock,
},
time::{Duration, Instant},
};
use binstalk_downloader::{download::Download, remote};
use compact_str::{format_compact, CompactString, ToCompactString};
use tokio::sync::OnceCell;
use tracing::{instrument, Level};
use url::Url;
use zeroize::Zeroizing;
mod common;
mod error;
mod release_artifacts;
mod repo_info;
use common::{check_http_status_and_header, percent_decode_http_url_path};
pub use error::{GhApiContextError, GhApiError, GhGraphQLErrors};
pub use repo_info::RepoInfo;
/// default retry duration if x-ratelimit-reset is not found in response header
const DEFAULT_RETRY_DURATION: Duration = Duration::from_secs(10 * 60);
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub struct GhRepo {
pub owner: CompactString,
pub repo: CompactString,
}
impl GhRepo {
pub fn repo_url(&self) -> Result<Url, url::ParseError> {
Url::parse(&format_compact!(
"https://github.com/{}/{}",
self.owner,
self.repo
))
}
pub fn try_extract_from_url(url: &Url) -> Option<Self> {
if url.domain() != Some("github.com") {
return None;
}
let mut path_segments = url.path_segments()?;
Some(Self {
owner: path_segments.next()?.to_compact_string(),
repo: path_segments.next()?.to_compact_string(),
})
}
}
/// The keys required to identify a github release.
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub struct GhRelease {
pub repo: GhRepo,
pub tag: CompactString,
}
/// The Github Release and one of its artifact.
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub struct GhReleaseArtifact {
pub release: GhRelease,
pub artifact_name: CompactString,
}
impl GhReleaseArtifact {
/// Create [`GhReleaseArtifact`] from url.
pub fn try_extract_from_url(url: &remote::Url) -> Option<Self> {
if url.domain() != Some("github.com") {
return None;
}
let mut path_segments = url.path_segments()?;
let owner = path_segments.next()?;
let repo = path_segments.next()?;
if (path_segments.next()?, path_segments.next()?) != ("releases", "download") {
return None;
}
let tag = path_segments.next()?;
let artifact_name = path_segments.next()?;
(path_segments.next().is_none() && url.fragment().is_none() && url.query().is_none()).then(
|| Self {
release: GhRelease {
repo: GhRepo {
owner: percent_decode_http_url_path(owner),
repo: percent_decode_http_url_path(repo),
},
tag: percent_decode_http_url_path(tag),
},
artifact_name: percent_decode_http_url_path(artifact_name),
},
)
}
}
#[derive(Debug)]
struct Map<K, V>(RwLock<HashMap<K, Arc<V>>>);
impl<K, V> Default for Map<K, V> {
fn default() -> Self {
Self(Default::default())
}
}
impl<K, V> Map<K, V>
where
K: Eq + std::hash::Hash,
V: Default,
{
fn get(&self, k: K) -> Arc<V> {
let optional_value = self.0.read().unwrap().deref().get(&k).cloned();
optional_value.unwrap_or_else(|| Arc::clone(self.0.write().unwrap().entry(k).or_default()))
}
}
#[derive(Debug)]
struct Inner {
client: remote::Client,
release_artifacts: Map<GhRelease, OnceCell<Option<release_artifacts::Artifacts>>>,
retry_after: Mutex<Option<Instant>>,
auth_token: Option<Zeroizing<Box<str>>>,
is_auth_token_valid: AtomicBool,
only_use_restful_api: AtomicBool,
}
/// Github API client for querying whether a release artifact exitsts.
/// Can only handle github.com for now.
#[derive(Clone, Debug)]
pub struct GhApiClient(Arc<Inner>);
impl GhApiClient {
pub fn new(client: remote::Client, auth_token: Option<Zeroizing<Box<str>>>) -> Self {
Self(Arc::new(Inner {
client,
release_artifacts: Default::default(),
retry_after: Default::default(),
auth_token,
is_auth_token_valid: AtomicBool::new(true),
only_use_restful_api: AtomicBool::new(false),
}))
}
/// If you don't want to use GitHub GraphQL API for whatever reason, call this.
pub fn set_only_use_restful_api(&self) {
self.0.only_use_restful_api.store(true, Relaxed);
}
pub fn remote_client(&self) -> &remote::Client {
&self.0.client
}
}
impl GhApiClient {
fn check_retry_after(&self) -> Result<(), GhApiError> {
let mut guard = self.0.retry_after.lock().unwrap();
if let Some(retry_after) = *guard {
if retry_after.elapsed().is_zero() {
return Err(GhApiError::RateLimit {
retry_after: Some(retry_after - Instant::now()),
});
} else {
// Instant retry_after is already reached.
*guard = None;
}
}
Ok(())
}
fn get_auth_token(&self) -> Option<&str> {
if self.0.is_auth_token_valid.load(Relaxed) {
self.0.auth_token.as_deref().map(|s| &**s)
} else {
None
}
}
pub fn has_gh_token(&self) -> bool {
self.get_auth_token().is_some()
}
async fn do_fetch<T, U, GraphQLFn, RestfulFn, GraphQLFut, RestfulFut>(
&self,
graphql_func: GraphQLFn,
restful_func: RestfulFn,
data: &T,
) -> Result<U, GhApiError>
where
GraphQLFn: Fn(&remote::Client, &T, &str) -> GraphQLFut,
RestfulFn: Fn(&remote::Client, &T, Option<&str>) -> RestfulFut,
GraphQLFut: Future<Output = Result<U, GhApiError>> + Send + 'static,
RestfulFut: Future<Output = Result<U, GhApiError>> + Send + 'static,
{
self.check_retry_after()?;
if !self.0.only_use_restful_api.load(Relaxed) {
if let Some(auth_token) = self.get_auth_token() {
match graphql_func(&self.0.client, data, auth_token).await {
Err(GhApiError::Unauthorized) => {
self.0.is_auth_token_valid.store(false, Relaxed);
}
res => return res.map_err(|err| err.context("GraphQL API")),
}
}
}
restful_func(&self.0.client, data, self.get_auth_token())
.await
.map_err(|err| err.context("Restful API"))
}
#[instrument(skip(self), ret(level = Level::DEBUG))]
pub async fn get_repo_info(&self, repo: &GhRepo) -> Result<Option<RepoInfo>, GhApiError> {
match self
.do_fetch(
repo_info::fetch_repo_info_graphql_api,
repo_info::fetch_repo_info_restful_api,
repo,
)
.await
{
Ok(repo_info) => Ok(repo_info),
Err(GhApiError::NotFound) => Ok(None),
Err(err) => Err(err),
}
}
}
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct GhReleaseArtifactUrl(Url);
impl GhApiClient {
/// Return `Ok(Some(api_artifact_url))` if exists.
///
/// Caches info on all artifacts matching (repo, tag).
///
/// The returned future is guaranteed to be pointer size.
#[instrument(skip(self), ret(level = Level::DEBUG))]
pub async fn has_release_artifact(
&self,
GhReleaseArtifact {
release,
artifact_name,
}: GhReleaseArtifact,
) -> Result<Option<GhReleaseArtifactUrl>, GhApiError> {
let once_cell = self.0.release_artifacts.get(release.clone());
let res = once_cell
.get_or_try_init(|| {
Box::pin(async {
match self
.do_fetch(
release_artifacts::fetch_release_artifacts_graphql_api,
release_artifacts::fetch_release_artifacts_restful_api,
&release,
)
.await
{
Ok(artifacts) => Ok(Some(artifacts)),
Err(GhApiError::NotFound) => Ok(None),
Err(err) => Err(err),
}
})
})
.await;
match res {
Ok(Some(artifacts)) => Ok(artifacts
.get_artifact_url(&artifact_name)
.map(GhReleaseArtifactUrl)),
Ok(None) => Ok(None),
Err(GhApiError::RateLimit { retry_after }) => {
*self.0.retry_after.lock().unwrap() =
Some(Instant::now() + retry_after.unwrap_or(DEFAULT_RETRY_DURATION));
Err(GhApiError::RateLimit { retry_after })
}
Err(err) => Err(err),
}
}
pub async fn download_artifact(
&self,
artifact_url: GhReleaseArtifactUrl,
) -> Result<Download<'static>, GhApiError> {
self.check_retry_after()?;
let Some(auth_token) = self.get_auth_token() else {
return Err(GhApiError::Unauthorized);
};
let response = self
.0
.client
.get(artifact_url.0)
.header("Accept", "application/octet-stream")
.bearer_auth(&auth_token)
.send(false)
.await?;
match check_http_status_and_header(response) {
Err(GhApiError::Unauthorized) => {
self.0.is_auth_token_valid.store(false, Relaxed);
Err(GhApiError::Unauthorized)
}
res => res.map(Download::from_response),
}
}
}
#[cfg(test)]
mod test {
use super::*;
use compact_str::{CompactString, ToCompactString};
use std::{env, num::NonZeroU16, time::Duration};
use tokio::time::sleep;
use tracing::subscriber::set_global_default;
use tracing_subscriber::{filter::LevelFilter, fmt::fmt};
static DEFAULT_RETRY_AFTER: Duration = Duration::from_secs(1);
mod cargo_binstall_v0_20_1 {
use super::{CompactString, GhRelease, GhRepo};
pub(super) const RELEASE: GhRelease = GhRelease {
repo: GhRepo {
owner: CompactString::const_new("cargo-bins"),
repo: CompactString::const_new("cargo-binstall"),
},
tag: CompactString::const_new("v0.20.1"),
};
pub(super) const ARTIFACTS: &[&str] = &[
"cargo-binstall-aarch64-apple-darwin.full.zip",
"cargo-binstall-aarch64-apple-darwin.zip",
"cargo-binstall-aarch64-pc-windows-msvc.full.zip",
"cargo-binstall-aarch64-pc-windows-msvc.zip",
"cargo-binstall-aarch64-unknown-linux-gnu.full.tgz",
"cargo-binstall-aarch64-unknown-linux-gnu.tgz",
"cargo-binstall-aarch64-unknown-linux-musl.full.tgz",
"cargo-binstall-aarch64-unknown-linux-musl.tgz",
"cargo-binstall-armv7-unknown-linux-gnueabihf.full.tgz",
"cargo-binstall-armv7-unknown-linux-gnueabihf.tgz",
"cargo-binstall-armv7-unknown-linux-musleabihf.full.tgz",
"cargo-binstall-armv7-unknown-linux-musleabihf.tgz",
"cargo-binstall-universal-apple-darwin.full.zip",
"cargo-binstall-universal-apple-darwin.zip",
"cargo-binstall-x86_64-apple-darwin.full.zip",
"cargo-binstall-x86_64-apple-darwin.zip",
"cargo-binstall-x86_64-pc-windows-msvc.full.zip",
"cargo-binstall-x86_64-pc-windows-msvc.zip",
"cargo-binstall-x86_64-unknown-linux-gnu.full.tgz",
"cargo-binstall-x86_64-unknown-linux-gnu.tgz",
"cargo-binstall-x86_64-unknown-linux-musl.full.tgz",
"cargo-binstall-x86_64-unknown-linux-musl.tgz",
];
}
mod cargo_audit_v_0_17_6 {
use super::*;
pub(super) const RELEASE: GhRelease = GhRelease {
repo: GhRepo {
owner: CompactString::const_new("rustsec"),
repo: CompactString::const_new("rustsec"),
},
tag: CompactString::const_new("cargo-audit/v0.17.6"),
};
#[allow(unused)]
pub(super) const ARTIFACTS: &[&str] = &[
"cargo-audit-aarch64-unknown-linux-gnu-v0.17.6.tgz",
"cargo-audit-armv7-unknown-linux-gnueabihf-v0.17.6.tgz",
"cargo-audit-x86_64-apple-darwin-v0.17.6.tgz",
"cargo-audit-x86_64-pc-windows-msvc-v0.17.6.zip",
"cargo-audit-x86_64-unknown-linux-gnu-v0.17.6.tgz",
"cargo-audit-x86_64-unknown-linux-musl-v0.17.6.tgz",
];
#[test]
fn extract_with_escaped_characters() {
let release_artifact = try_extract_artifact_from_str(
"https://github.com/rustsec/rustsec/releases/download/cargo-audit%2Fv0.17.6/cargo-audit-aarch64-unknown-linux-gnu-v0.17.6.tgz"
).unwrap();
assert_eq!(
release_artifact,
GhReleaseArtifact {
release: RELEASE,
artifact_name: CompactString::from(
"cargo-audit-aarch64-unknown-linux-gnu-v0.17.6.tgz",
)
}
);
}
}
#[test]
fn gh_repo_extract_from_and_to_url() {
[
"https://github.com/cargo-bins/cargo-binstall",
"https://github.com/rustsec/rustsec",
]
.into_iter()
.for_each(|url| {
let url = Url::parse(url).unwrap();
assert_eq!(
GhRepo::try_extract_from_url(&url)
.unwrap()
.repo_url()
.unwrap(),
url
);
})
}
fn try_extract_artifact_from_str(s: &str) -> Option<GhReleaseArtifact> {
GhReleaseArtifact::try_extract_from_url(&url::Url::parse(s).unwrap())
}
fn assert_extract_gh_release_artifacts_failures(urls: &[&str]) {
for url in urls {
assert_eq!(try_extract_artifact_from_str(url), None);
}
}
#[test]
fn extract_gh_release_artifacts_failure() {
use cargo_binstall_v0_20_1::*;
let GhRelease {
repo: GhRepo { owner, repo },
tag,
} = RELEASE;
assert_extract_gh_release_artifacts_failures(&[
"https://examle.com",
"https://github.com",
&format!("https://github.com/{owner}"),
&format!("https://github.com/{owner}/{repo}"),
&format!("https://github.com/{owner}/{repo}/123e"),
&format!("https://github.com/{owner}/{repo}/releases/21343"),
&format!("https://github.com/{owner}/{repo}/releases/download"),
&format!("https://github.com/{owner}/{repo}/releases/download/{tag}"),
&format!("https://github.com/{owner}/{repo}/releases/download/{tag}/a/23"),
&format!("https://github.com/{owner}/{repo}/releases/download/{tag}/a#a=12"),
&format!("https://github.com/{owner}/{repo}/releases/download/{tag}/a?page=3"),
]);
}
#[test]
fn extract_gh_release_artifacts_success() {
use cargo_binstall_v0_20_1::*;
let GhRelease {
repo: GhRepo { owner, repo },
tag,
} = RELEASE;
for artifact in ARTIFACTS {
let GhReleaseArtifact {
release,
artifact_name,
} = try_extract_artifact_from_str(&format!(
"https://github.com/{owner}/{repo}/releases/download/{tag}/{artifact}"
))
.unwrap();
assert_eq!(release, RELEASE);
assert_eq!(artifact_name, artifact);
}
}
fn init_logger() {
// Disable time, target, file, line_num, thread name/ids to make the
// output more readable
let subscriber = fmt()
.without_time()
.with_target(false)
.with_file(false)
.with_line_number(false)
.with_thread_names(false)
.with_thread_ids(false)
.with_test_writer()
.with_max_level(LevelFilter::DEBUG)
.finish();
// Setup global subscriber
let _ = set_global_default(subscriber);
}
fn create_remote_client() -> remote::Client {
remote::Client::new(
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")),
None,
NonZeroU16::new(300).unwrap(),
1.try_into().unwrap(),
[],
)
.unwrap()
}
/// Mark this as an async fn so that you won't accidentally use it in
/// sync context.
fn create_client() -> Vec<GhApiClient> {
let client = create_remote_client();
let auth_token = match env::var("CI_UNIT_TEST_GITHUB_TOKEN") {
Ok(auth_token) if !auth_token.is_empty() => {
Some(zeroize::Zeroizing::new(auth_token.into_boxed_str()))
}
_ => None,
};
let gh_client = GhApiClient::new(client.clone(), auth_token.clone());
gh_client.set_only_use_restful_api();
let mut gh_clients = vec![gh_client];
if auth_token.is_some() {
gh_clients.push(GhApiClient::new(client, auth_token));
}
gh_clients
}
#[tokio::test]
async fn rate_limited_test_get_repo_info() {
const PUBLIC_REPOS: [GhRepo; 1] = [GhRepo {
owner: CompactString::const_new("cargo-bins"),
repo: CompactString::const_new("cargo-binstall"),
}];
const PRIVATE_REPOS: [GhRepo; 1] = [GhRepo {
owner: CompactString::const_new("cargo-bins"),
repo: CompactString::const_new("private-repo-for-testing"),
}];
const NON_EXISTENT_REPOS: [GhRepo; 1] = [GhRepo {
owner: CompactString::const_new("cargo-bins"),
repo: CompactString::const_new("ttt"),
}];
init_logger();
let mut tests: Vec<(_, _)> = Vec::new();
for client in create_client() {
let spawn_get_repo_info_task = |repo| {
let client = client.clone();
tokio::spawn(async move {
loop {
match client.get_repo_info(&repo).await {
Err(GhApiError::RateLimit { retry_after }) => {
sleep(retry_after.unwrap_or(DEFAULT_RETRY_AFTER)).await
}
res => break res,
}
}
})
};
for repo in PUBLIC_REPOS {
tests.push((
Some(RepoInfo::new(repo.clone(), false)),
spawn_get_repo_info_task(repo),
));
}
for repo in NON_EXISTENT_REPOS {
tests.push((None, spawn_get_repo_info_task(repo)));
}
if client.has_gh_token() {
for repo in PRIVATE_REPOS {
tests.push((
Some(RepoInfo::new(repo.clone(), true)),
spawn_get_repo_info_task(repo),
));
}
}
}
for (expected, task) in tests {
assert_eq!(task.await.unwrap().unwrap(), expected);
}
}
#[tokio::test]
async fn rate_limited_test_has_release_artifact_and_download_artifacts() {
const RELEASES: [(GhRelease, &[&str]); 1] = [(
cargo_binstall_v0_20_1::RELEASE,
cargo_binstall_v0_20_1::ARTIFACTS,
)];
const NON_EXISTENT_RELEASES: [GhRelease; 1] = [GhRelease {
repo: GhRepo {
owner: CompactString::const_new("cargo-bins"),
repo: CompactString::const_new("cargo-binstall"),
},
// We are currently at v0.20.1 and we would never release
// anything older than v0.20.1
tag: CompactString::const_new("v0.18.2"),
}];
init_logger();
let mut tasks = Vec::new();
for client in create_client() {
async fn has_release_artifact(
client: &GhApiClient,
artifact: &GhReleaseArtifact,
) -> Result<Option<GhReleaseArtifactUrl>, GhApiError> {
loop {
match client.has_release_artifact(artifact.clone()).await {
Err(GhApiError::RateLimit { retry_after }) => {
sleep(retry_after.unwrap_or(DEFAULT_RETRY_AFTER)).await
}
res => break res,
}
}
}
for (release, artifacts) in RELEASES {
for artifact_name in artifacts {
let client = client.clone();
let release = release.clone();
tasks.push(tokio::spawn(async move {
let artifact = GhReleaseArtifact {
release,
artifact_name: artifact_name.to_compact_string(),
};
let browser_download_task = client.get_auth_token().map(|_| {
tokio::spawn(
Download::new(
client.remote_client().clone(),
Url::parse(&format!(
"https://github.com/{}/{}/releases/download/{}/{}",
artifact.release.repo.owner,
artifact.release.repo.repo,
artifact.release.tag,
artifact.artifact_name,
))
.unwrap(),
)
.into_bytes(),
)
});
let artifact_url = has_release_artifact(&client, &artifact)
.await
.unwrap()
.unwrap();
if let Some(browser_download_task) = browser_download_task {
let artifact_download_data = loop {
match client.download_artifact(artifact_url.clone()).await {
Err(GhApiError::RateLimit { retry_after }) => {
sleep(retry_after.unwrap_or(DEFAULT_RETRY_AFTER)).await
}
res => break res.unwrap(),
}
}
.into_bytes()
.await
.unwrap();
let browser_download_data =
browser_download_task.await.unwrap().unwrap();
assert_eq!(artifact_download_data, browser_download_data);
}
}));
}
let client = client.clone();
tasks.push(tokio::spawn(async move {
assert_eq!(
has_release_artifact(
&client,
&GhReleaseArtifact {
release,
artifact_name: "123z".to_compact_string(),
}
)
.await
.unwrap(),
None
);
}));
}
for release in NON_EXISTENT_RELEASES {
let client = client.clone();
tasks.push(tokio::spawn(async move {
assert_eq!(
has_release_artifact(
&client,
&GhReleaseArtifact {
release,
artifact_name: "1234".to_compact_string(),
}
)
.await
.unwrap(),
None
);
}));
}
}
for task in tasks {
task.await.unwrap();
}
}
}

View file

@ -0,0 +1,130 @@
use std::{fmt::Debug, future::Future, sync::OnceLock};
use binstalk_downloader::remote::{self, Response, Url};
use compact_str::CompactString;
use percent_encoding::percent_decode_str;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use serde_json::to_string as to_json_string;
use tracing::debug;
use super::{GhApiError, GhGraphQLErrors};
pub(super) fn percent_decode_http_url_path(input: &str) -> CompactString {
if input.contains('%') {
percent_decode_str(input).decode_utf8_lossy().into()
} else {
// No '%', no need to decode.
CompactString::new(input)
}
}
pub(super) fn check_http_status_and_header(response: Response) -> Result<Response, GhApiError> {
match response.status() {
remote::StatusCode::UNAUTHORIZED => Err(GhApiError::Unauthorized),
remote::StatusCode::NOT_FOUND => Err(GhApiError::NotFound),
_ => Ok(response.error_for_status()?),
}
}
fn get_api_endpoint() -> &'static Url {
static API_ENDPOINT: OnceLock<Url> = OnceLock::new();
API_ENDPOINT.get_or_init(|| {
Url::parse("https://api.github.com/").expect("Literal provided must be a valid url")
})
}
pub(super) fn issue_restful_api<T>(
client: &remote::Client,
path: &[&str],
auth_token: Option<&str>,
) -> impl Future<Output = Result<T, GhApiError>> + Send + 'static
where
T: DeserializeOwned,
{
let mut url = get_api_endpoint().clone();
url.path_segments_mut()
.expect("get_api_endpoint() should return a https url")
.extend(path);
debug!("Getting restful API: {url}");
let mut request_builder = client
.get(url)
.header("Accept", "application/vnd.github+json")
.header("X-GitHub-Api-Version", "2022-11-28");
if let Some(auth_token) = auth_token {
request_builder = request_builder.bearer_auth(&auth_token);
}
let future = request_builder.send(false);
async move {
let response = check_http_status_and_header(future.await?)?;
Ok(response.json().await?)
}
}
#[derive(Debug, Deserialize)]
struct GraphQLResponse<T> {
data: T,
errors: Option<GhGraphQLErrors>,
}
#[derive(Serialize)]
struct GraphQLQuery {
query: String,
}
fn get_graphql_endpoint() -> Url {
let mut graphql_endpoint = get_api_endpoint().clone();
graphql_endpoint
.path_segments_mut()
.expect("get_api_endpoint() should return a https url")
.push("graphql");
graphql_endpoint
}
pub(super) fn issue_graphql_query<T>(
client: &remote::Client,
query: String,
auth_token: &str,
) -> impl Future<Output = Result<T, GhApiError>> + Send + 'static
where
T: DeserializeOwned + Debug,
{
let res = to_json_string(&GraphQLQuery { query })
.map_err(remote::Error::from)
.map(|graphql_query| {
let graphql_endpoint = get_graphql_endpoint();
debug!("Sending graphql query to {graphql_endpoint}: '{graphql_query}'");
let request_builder = client
.post(graphql_endpoint, graphql_query)
.header("Accept", "application/vnd.github+json")
.bearer_auth(&auth_token);
request_builder.send(false)
});
async move {
let response = check_http_status_and_header(res?.await?)?;
let mut response: GraphQLResponse<T> = response.json().await?;
debug!("response = {response:?}");
if let Some(error) = response.errors.take() {
Err(error.into())
} else {
Ok(response.data)
}
}
}

View file

@ -0,0 +1,203 @@
use std::{error, fmt, io, time::Duration};
use binstalk_downloader::remote;
use compact_str::{CompactString, ToCompactString};
use serde::{de::Deserializer, Deserialize};
use thiserror::Error as ThisError;
#[derive(ThisError, Debug)]
#[error("Context: '{context}', err: '{err}'")]
pub struct GhApiContextError {
context: CompactString,
#[source]
err: GhApiError,
}
#[derive(ThisError, Debug)]
#[non_exhaustive]
pub enum GhApiError {
#[error("IO Error: {0}")]
Io(#[from] io::Error),
#[error("Remote Error: {0}")]
Remote(#[from] remote::Error),
#[error("Failed to parse url: {0}")]
InvalidUrl(#[from] url::ParseError),
/// A wrapped error providing the context the error is about.
#[error(transparent)]
Context(Box<GhApiContextError>),
#[error("Remote failed to process GraphQL query: {0}")]
GraphQLErrors(GhGraphQLErrors),
#[error("Hit rate-limit, retry after {retry_after:?}")]
RateLimit { retry_after: Option<Duration> },
#[error("Corresponding resource is not found")]
NotFound,
#[error("Does not have permission to access the API")]
Unauthorized,
}
impl GhApiError {
/// Attach context to [`GhApiError`]
pub fn context(self, context: impl fmt::Display) -> Self {
use GhApiError::*;
if matches!(self, RateLimit { .. } | NotFound | Unauthorized) {
self
} else {
Self::Context(Box::new(GhApiContextError {
context: context.to_compact_string(),
err: self,
}))
}
}
}
impl From<GhGraphQLErrors> for GhApiError {
fn from(e: GhGraphQLErrors) -> Self {
if e.is_rate_limited() {
Self::RateLimit { retry_after: None }
} else if e.is_not_found_error() {
Self::NotFound
} else {
Self::GraphQLErrors(e)
}
}
}
#[derive(Debug, Deserialize)]
pub struct GhGraphQLErrors(Box<[GraphQLError]>);
impl GhGraphQLErrors {
fn is_rate_limited(&self) -> bool {
self.0
.iter()
.any(|error| matches!(error.error_type, GraphQLErrorType::RateLimited))
}
fn is_not_found_error(&self) -> bool {
self.0
.iter()
.any(|error| matches!(&error.error_type, GraphQLErrorType::Other(error_type) if *error_type == "NOT_FOUND"))
}
}
impl error::Error for GhGraphQLErrors {}
impl fmt::Display for GhGraphQLErrors {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let last_error_index = self.0.len() - 1;
for (i, error) in self.0.iter().enumerate() {
write!(
f,
"type: '{error_type}', msg: '{msg}'",
error_type = error.error_type,
msg = error.message,
)?;
for location in error.locations.as_deref().into_iter().flatten() {
write!(
f,
", occured on query line {line} col {col}",
line = location.line,
col = location.column
)?;
}
for (k, v) in &error.others {
write!(f, ", {k}: {v}")?;
}
if i < last_error_index {
f.write_str("\n")?;
}
}
Ok(())
}
}
#[derive(Debug, Deserialize)]
struct GraphQLError {
message: CompactString,
locations: Option<Box<[GraphQLLocation]>>,
#[serde(rename = "type")]
error_type: GraphQLErrorType,
#[serde(flatten, with = "tuple_vec_map")]
others: Vec<(CompactString, serde_json::Value)>,
}
#[derive(Debug)]
pub(super) enum GraphQLErrorType {
RateLimited,
Other(CompactString),
}
impl fmt::Display for GraphQLErrorType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
GraphQLErrorType::RateLimited => "RATE_LIMITED",
GraphQLErrorType::Other(s) => s,
})
}
}
impl<'de> Deserialize<'de> for GraphQLErrorType {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
let s = CompactString::deserialize(deserializer)?;
Ok(match &*s {
"RATE_LIMITED" => GraphQLErrorType::RateLimited,
_ => GraphQLErrorType::Other(s),
})
}
}
#[derive(Debug, Deserialize)]
struct GraphQLLocation {
line: u64,
column: u64,
}
#[cfg(test)]
mod test {
use super::*;
use serde::de::value::{BorrowedStrDeserializer, Error};
macro_rules! assert_matches {
($expression:expr, $pattern:pat $(if $guard:expr)? $(,)?) => {
match $expression {
$pattern $(if $guard)? => true,
expr => {
panic!(
"assertion failed: `{expr:?}` does not match `{}`",
stringify!($pattern $(if $guard)?)
)
}
}
}
}
#[test]
fn test_graph_ql_error_type() {
let deserialize = |input: &str| {
GraphQLErrorType::deserialize(BorrowedStrDeserializer::<'_, Error>::new(input)).unwrap()
};
assert_matches!(deserialize("RATE_LIMITED"), GraphQLErrorType::RateLimited);
assert_matches!(
deserialize("rATE_LIMITED"),
GraphQLErrorType::Other(val) if val == CompactString::const_new("rATE_LIMITED")
);
}
}

View file

@ -0,0 +1,192 @@
use std::{
borrow::Borrow,
collections::HashSet,
fmt,
future::Future,
hash::{Hash, Hasher},
};
use binstalk_downloader::remote::{self};
use compact_str::{CompactString, ToCompactString};
use serde::Deserialize;
use url::Url;
use super::{
common::{issue_graphql_query, issue_restful_api},
GhApiError, GhRelease, GhRepo,
};
// Only include fields we do care about
#[derive(Eq, Deserialize, Debug)]
struct Artifact {
name: CompactString,
url: Url,
}
// Manually implement PartialEq and Hash to ensure it will always produce the
// same hash as a str with the same content, and that the comparison will be
// the same to coparing a string.
impl PartialEq for Artifact {
fn eq(&self, other: &Self) -> bool {
self.name.eq(&other.name)
}
}
impl Hash for Artifact {
fn hash<H>(&self, state: &mut H)
where
H: Hasher,
{
let s: &str = self.name.as_str();
s.hash(state)
}
}
// Implement Borrow so that we can use call
// `HashSet::contains::<str>`
impl Borrow<str> for Artifact {
fn borrow(&self) -> &str {
&self.name
}
}
#[derive(Debug, Default, Deserialize)]
pub(super) struct Artifacts {
assets: HashSet<Artifact>,
}
impl Artifacts {
/// get url for downloading the artifact using GitHub API (for private repository).
pub(super) fn get_artifact_url(&self, artifact_name: &str) -> Option<Url> {
self.assets
.get(artifact_name)
.map(|artifact| artifact.url.clone())
}
}
pub(super) fn fetch_release_artifacts_restful_api(
client: &remote::Client,
GhRelease {
repo: GhRepo { owner, repo },
tag,
}: &GhRelease,
auth_token: Option<&str>,
) -> impl Future<Output = Result<Artifacts, GhApiError>> + Send + 'static {
issue_restful_api(
client,
&["repos", owner, repo, "releases", "tags", tag],
auth_token,
)
}
#[derive(Debug, Deserialize)]
struct GraphQLData {
repository: Option<GraphQLRepo>,
}
#[derive(Debug, Deserialize)]
struct GraphQLRepo {
release: Option<GraphQLRelease>,
}
#[derive(Debug, Deserialize)]
struct GraphQLRelease {
#[serde(rename = "releaseAssets")]
assets: GraphQLReleaseAssets,
}
#[derive(Debug, Deserialize)]
struct GraphQLReleaseAssets {
nodes: Vec<Artifact>,
#[serde(rename = "pageInfo")]
page_info: GraphQLPageInfo,
}
#[derive(Debug, Deserialize)]
struct GraphQLPageInfo {
#[serde(rename = "endCursor")]
end_cursor: Option<CompactString>,
#[serde(rename = "hasNextPage")]
has_next_page: bool,
}
enum FilterCondition {
Init,
After(CompactString),
}
impl fmt::Display for FilterCondition {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
// GitHub imposes a limit of 100 for the value passed to param "first"
FilterCondition::Init => f.write_str("first:100"),
FilterCondition::After(end_cursor) => write!(f, r#"first:100,after:"{end_cursor}""#),
}
}
}
pub(super) fn fetch_release_artifacts_graphql_api(
client: &remote::Client,
GhRelease {
repo: GhRepo { owner, repo },
tag,
}: &GhRelease,
auth_token: &str,
) -> impl Future<Output = Result<Artifacts, GhApiError>> + Send + 'static {
let client = client.clone();
let auth_token = auth_token.to_compact_string();
let base_query_prefix = format!(
r#"
query {{
repository(owner:"{owner}",name:"{repo}") {{
release(tagName:"{tag}") {{"#
);
let base_query_suffix = r#"
nodes { name url }
pageInfo { endCursor hasNextPage }
}}}}"#
.trim();
async move {
let mut artifacts = Artifacts::default();
let mut cond = FilterCondition::Init;
let base_query_prefix = base_query_prefix.trim();
loop {
let query = format!(
r#"
{base_query_prefix}
releaseAssets({cond}) {{
{base_query_suffix}"#
);
let data: GraphQLData = issue_graphql_query(&client, query, &auth_token).await?;
let assets = data
.repository
.and_then(|repository| repository.release)
.map(|release| release.assets);
if let Some(assets) = assets {
artifacts.assets.extend(assets.nodes);
match assets.page_info {
GraphQLPageInfo {
end_cursor: Some(end_cursor),
has_next_page: true,
} => {
cond = FilterCondition::After(end_cursor);
}
_ => break Ok(artifacts),
}
} else {
break Err(GhApiError::NotFound);
}
}
}
}

View file

@ -0,0 +1,91 @@
use std::{fmt, future::Future};
use compact_str::CompactString;
use serde::Deserialize;
use super::{
common::{issue_graphql_query, issue_restful_api},
remote, GhApiError, GhRepo,
};
#[derive(Clone, Eq, PartialEq, Hash, Debug, Deserialize)]
struct Owner {
login: CompactString,
}
#[derive(Clone, Eq, PartialEq, Hash, Debug, Deserialize)]
pub struct RepoInfo {
owner: Owner,
name: CompactString,
private: bool,
}
impl fmt::Display for RepoInfo {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"RepoInfo {{ owner: {}, name: {}, is_private: {} }}",
self.owner.login, self.name, self.private
)
}
}
impl RepoInfo {
#[cfg(test)]
pub(crate) fn new(GhRepo { owner, repo }: GhRepo, private: bool) -> Self {
Self {
owner: Owner { login: owner },
name: repo,
private,
}
}
pub fn repo(&self) -> GhRepo {
GhRepo {
owner: self.owner.login.clone(),
repo: self.name.clone(),
}
}
pub fn is_private(&self) -> bool {
self.private
}
}
pub(super) fn fetch_repo_info_restful_api(
client: &remote::Client,
GhRepo { owner, repo }: &GhRepo,
auth_token: Option<&str>,
) -> impl Future<Output = Result<Option<RepoInfo>, GhApiError>> + Send + 'static {
issue_restful_api(client, &["repos", owner, repo], auth_token)
}
#[derive(Debug, Deserialize)]
struct GraphQLData {
repository: Option<RepoInfo>,
}
pub(super) fn fetch_repo_info_graphql_api(
client: &remote::Client,
GhRepo { owner, repo }: &GhRepo,
auth_token: &str,
) -> impl Future<Output = Result<Option<RepoInfo>, GhApiError>> + Send + 'static {
let query = format!(
r#"
query {{
repository(owner:"{owner}",name:"{repo}") {{
owner {{
login
}}
name
private: isPrivate
}}
}}"#
);
let future = issue_graphql_query(client, query, auth_token);
async move {
let data: GraphQLData = future.await?;
Ok(data.repository)
}
}

View file

@ -0,0 +1 @@
pub mod gh_api_client;

View file

@ -0,0 +1,183 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.15.28](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.27...binstalk-manifests-v0.15.28) - 2025-04-05
### Other
- Fix clippy lints ([#2111](https://github.com/cargo-bins/cargo-binstall/pull/2111))
## [0.15.27](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.26...binstalk-manifests-v0.15.27) - 2025-03-19
### Other
- updated the following local packages: detect-targets, fs-lock
## [0.15.26](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.25...binstalk-manifests-v0.15.26) - 2025-03-15
### Other
- updated the following local packages: detect-targets
## [0.15.25](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.24...binstalk-manifests-v0.15.25) - 2025-03-07
### Other
- *(deps)* bump the deps group with 3 updates ([#2072](https://github.com/cargo-bins/cargo-binstall/pull/2072))
## [0.15.24](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.23...binstalk-manifests-v0.15.24) - 2025-02-28
### Other
- updated the following local packages: detect-targets
## [0.15.23](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.22...binstalk-manifests-v0.15.23) - 2025-02-22
### Other
- Log when FileLock::drop fails to unlock file ([#2064](https://github.com/cargo-bins/cargo-binstall/pull/2064))
## [0.15.22](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.21...binstalk-manifests-v0.15.22) - 2025-02-15
### Other
- updated the following local packages: detect-targets
## [0.15.21](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.20...binstalk-manifests-v0.15.21) - 2025-02-11
### Other
- updated the following local packages: binstalk-types, detect-targets
## [0.15.20](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.19...binstalk-manifests-v0.15.20) - 2025-02-04
### Other
- updated the following local packages: detect-targets
## [0.15.19](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.18...binstalk-manifests-v0.15.19) - 2025-01-19
### Other
- update Cargo.lock dependencies
## [0.15.18](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.17...binstalk-manifests-v0.15.18) - 2025-01-13
### Other
- update Cargo.lock dependencies
## [0.15.17](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.16...binstalk-manifests-v0.15.17) - 2025-01-11
### Other
- *(deps)* bump the deps group with 3 updates (#2015)
## [0.15.16](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.15...binstalk-manifests-v0.15.16) - 2025-01-04
### Other
- updated the following local packages: detect-targets
## [0.15.15](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.14...binstalk-manifests-v0.15.15) - 2024-12-28
### Other
- updated the following local packages: detect-targets
## [0.15.14](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.13...binstalk-manifests-v0.15.14) - 2024-12-14
### Other
- *(deps)* bump the deps group with 2 updates (#1997)
## [0.15.13](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.12...binstalk-manifests-v0.15.13) - 2024-12-07
### Other
- updated the following local packages: detect-targets, fs-lock
## [0.15.12](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.11...binstalk-manifests-v0.15.12) - 2024-11-29
### Other
- updated the following local packages: detect-targets
## [0.15.11](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.10...binstalk-manifests-v0.15.11) - 2024-11-23
### Other
- *(deps)* bump the deps group with 2 updates ([#1981](https://github.com/cargo-bins/cargo-binstall/pull/1981))
## [0.15.10](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.9...binstalk-manifests-v0.15.10) - 2024-11-18
### Other
- updated the following local packages: detect-targets
## [0.15.9](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.8...binstalk-manifests-v0.15.9) - 2024-11-09
### Other
- *(deps)* bump the deps group with 3 updates ([#1966](https://github.com/cargo-bins/cargo-binstall/pull/1966))
## [0.15.8](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.7...binstalk-manifests-v0.15.8) - 2024-11-05
### Other
- *(deps)* bump the deps group with 3 updates ([#1954](https://github.com/cargo-bins/cargo-binstall/pull/1954))
## [0.15.7](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.6...binstalk-manifests-v0.15.7) - 2024-11-02
### Other
- updated the following local packages: detect-targets
## [0.15.6](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.5...binstalk-manifests-v0.15.6) - 2024-10-25
### Other
- updated the following local packages: detect-targets
## [0.15.5](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.4...binstalk-manifests-v0.15.5) - 2024-10-12
### Other
- updated the following local packages: detect-targets, fs-lock
## [0.15.4](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.3...binstalk-manifests-v0.15.4) - 2024-10-04
### Other
- updated the following local packages: detect-targets
## [0.15.3](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.2...binstalk-manifests-v0.15.3) - 2024-09-22
### Other
- updated the following local packages: detect-targets
## [0.15.2](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.1...binstalk-manifests-v0.15.2) - 2024-09-06
### Other
- updated the following local packages: detect-targets
## [0.15.1](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.15.0...binstalk-manifests-v0.15.1) - 2024-08-25
### Other
- updated the following local packages: detect-targets
## [0.15.0](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.14.1...binstalk-manifests-v0.15.0) - 2024-08-10
### Other
- updated the following local packages: binstalk-types, detect-targets
## [0.14.1](https://github.com/cargo-bins/cargo-binstall/compare/binstalk-manifests-v0.14.0...binstalk-manifests-v0.14.1) - 2024-08-04
### Other
- updated the following local packages: detect-targets, fs-lock

View file

@ -0,0 +1,29 @@
[package]
name = "binstalk-manifests"
description = "The binstall toolkit for manipulating with manifest"
repository = "https://github.com/cargo-bins/cargo-binstall"
documentation = "https://docs.rs/binstalk-manifests"
version = "0.15.28"
rust-version = "1.61.0"
authors = ["ryan <ryan@kurte.nz>"]
edition = "2021"
license = "Apache-2.0 OR MIT"
[dependencies]
beef = { version = "0.5.2", features = ["impl_serde"] }
binstalk-types = { version = "0.9.4", path = "../binstalk-types" }
compact_str = { version = "0.9.0", features = ["serde"] }
fs-lock = { version = "0.1.10", path = "../fs-lock", features = ["tracing"] }
home = "0.5.9"
miette = "7.0.0"
semver = { version = "1.0.17", features = ["serde"] }
serde = { version = "1.0.163", features = ["derive"] }
serde-tuple-vec-map = "1.0.1"
serde_json = "1.0.107"
thiserror = "2.0.11"
toml_edit = { version = "0.22.12", features = ["serde"] }
url = { version = "2.5.4", features = ["serde"] }
[dev-dependencies]
detect-targets = { version = "0.1.47", path = "../detect-targets" }
tempfile = "3.5.0"

View file

@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

View file

@ -0,0 +1,23 @@
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Some files were not shown because too many files have changed in this diff Show more