Commit graph

11 commits

Author SHA1 Message Date
Félix Saparelli
e25aa50ec9
Rename lib to binstalk (#361) 2022-09-10 16:44:18 +10:00
Félix Saparelli
0c6687455f
Trim trailing slash from repo (#360) 2022-09-10 17:32:55 +12:00
Félix Saparelli
a628cbf876
Rename flock to fs-lock (#338) 2022-09-04 15:28:22 +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
0cb4c993b3
Explode out even more variants of default download URLs (#329) 2022-09-02 16:00:46 +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
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
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
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
Renamed from src/fetchers/gh_crate_meta.rs (Browse further)