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
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
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
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
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
Jiahao XU
132c5dfaa9
Merge pull request #280 from cargo-bins/signal-handling
...
Add Signal handling
2022-08-06 20:13:03 +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
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
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
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
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
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
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