Commit graph

1118 commits

Author SHA1 Message Date
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