Commit graph

84 commits

Author SHA1 Message Date
Jiahao XU
a6e52afaa0
Retry http request on connection error (#922) 2023-03-18 22:35:18 +13: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
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
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]
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]
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
Félix Saparelli
ff5276f4f4
Squash lint warning on windows (#881)
Squash warning on windows
2023-03-11 19:17:50 +13: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
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]
a6a42f30af
Bump async-trait from 0.1.64 to 0.1.66 (#866) 2023-03-06 03:16:31 +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
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
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]
fcbdfcf04f
Bump tokio from 1.25.0 to 1.26.0 (#843) 2023-03-02 03:02:43 +00: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]
e13354e8fa
Bump tempfile from 3.3.0 to 3.4.0 (#834) 2023-02-27 03:35:21 +00: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
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
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
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
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
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]
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]
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
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
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
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
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]
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]
d34ad5ad1f
Bump tokio from 1.24.2 to 1.25.0 (#749) 2023-01-30 02:20:04 +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
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]
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]
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]
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]
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