From fbaa36efcc330e96147642269cb5b354236266ee Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Mon, 12 Feb 2024 23:24:16 +0100 Subject: [PATCH] feat: add progress bars during compression (#620) --- .github/workflows/end-to-end.yml | 2 +- .github/workflows/rust.yml | 4 +- Cargo.lock | 166 ++++++++++++++++--------------- Cargo.toml | 36 +++---- rust-toolchain | 2 +- src/build.rs | 3 +- src/packaging.rs | 27 ++++- src/render/solver.rs | 7 +- src/source/mod.rs | 5 +- 9 files changed, 138 insertions(+), 114 deletions(-) diff --git a/.github/workflows/end-to-end.yml b/.github/workflows/end-to-end.yml index a72bd6f4f..9c54d8ed2 100644 --- a/.github/workflows/end-to-end.yml +++ b/.github/workflows/end-to-end.yml @@ -38,7 +38,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - uses: dtolnay/rust-toolchain@master with: - toolchain: "1.73.0" + toolchain: "1.75.0" - uses: prefix-dev/setup-pixi@v0.5.1 with: pixi-version: v0.13.0 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0310bff64..2d707ca18 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -38,7 +38,7 @@ jobs: submodules: recursive - uses: dtolnay/rust-toolchain@master with: - toolchain: "1.73.0" + toolchain: "1.75.0" components: clippy,rustfmt - uses: Swatinem/rust-cache@v2 - name: Check @@ -102,7 +102,7 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@master with: - toolchain: "1.73.0" + toolchain: "1.75.0" targets: ${{ matrix.target }} - name: Install musl-gcc diff --git a/Cargo.lock b/Cargo.lock index 8e15427cc..7c8c44960 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -495,9 +495,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", @@ -519,9 +519,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.18" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f" dependencies = [ "clap_builder", "clap_derive", @@ -539,30 +539,30 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.0", ] [[package]] name = "clap_complete" -version = "4.4.10" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb745187d7f4d76267b37485a65e0149edd0e91a4cfcdd3f27524ad86cee9f3" +checksum = "299353be8209bd133b049bf1c63582d184a8b39fd9c04f15fe65f50f88bdfe6c" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck", "proc-macro2", @@ -572,9 +572,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -736,7 +736,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.10.0", "syn 2.0.48", ] @@ -941,6 +941,17 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "event-listener" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b72557800024fabbaa2449dd4bf24e37b93702d457a4d4f2b0dd1f0f039f20c1" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + [[package]] name = "event-listener-strategy" version = "0.4.0" @@ -1258,7 +1269,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.2", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -1493,9 +1504,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -1504,9 +1515,9 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25" +checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" dependencies = [ "console", "instant", @@ -1562,15 +1573,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.1" @@ -2172,7 +2174,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b645dcde5f119c2c454a92d0dfa271a2a3b205da92e4292a68ead4bdbfde1f33" dependencies = [ "heck", - "itertools 0.12.1", + "itertools", "proc-macro2", "proc-macro2-diagnostics", "quote", @@ -2239,7 +2241,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.2.2", + "indexmap 2.2.3", ] [[package]] @@ -2328,7 +2330,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef" dependencies = [ "base64", - "indexmap 2.2.2", + "indexmap 2.2.3", "line-wrap", "quick-xml", "serde", @@ -2487,8 +2489,7 @@ dependencies = [ [[package]] name = "rattler" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64882db05a84394da66ca78e0a738b7f883a411ae66ff0be2e3af375fecb9666" +source = "git+https://github.com/mamba-org/rattler?branch=main#4fc2d38ee482aeb154d75cd3423577d3bcc6b3f9" dependencies = [ "anyhow", "async-compression", @@ -2497,11 +2498,12 @@ dependencies = [ "digest", "dirs", "drop_bomb", + "fs-err", "futures", "fxhash", "hex", - "indexmap 2.2.2", - "itertools 0.12.1", + "indexmap 2.2.3", + "itertools", "memchr", "memmap2", "nom", @@ -2552,10 +2554,10 @@ dependencies = [ "goblin", "hex", "ignore", - "indexmap 2.2.2", + "indexmap 2.2.3", "indicatif", "insta", - "itertools 0.12.1", + "itertools", "marked-yaml", "memmap2", "miette", @@ -2608,15 +2610,14 @@ dependencies = [ [[package]] name = "rattler_conda_types" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf438bb2467bc91cef3dcf254e1146e8ea23afd6cbe76799e53a50d0d1d71079" +source = "git+https://github.com/mamba-org/rattler?branch=main#4fc2d38ee482aeb154d75cd3423577d3bcc6b3f9" dependencies = [ "chrono", "fxhash", "glob", "hex", - "indexmap 2.2.2", - "itertools 0.12.1", + "indexmap 2.2.3", + "itertools", "lazy-regex", "nom", "purl", @@ -2638,8 +2639,7 @@ dependencies = [ [[package]] name = "rattler_digest" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26606e577c9c5b214023c8a31a12753cffd2b09a6768d1d556b99ae9d730bc23" +source = "git+https://github.com/mamba-org/rattler?branch=main#4fc2d38ee482aeb154d75cd3423577d3bcc6b3f9" dependencies = [ "blake2", "digest", @@ -2654,8 +2654,7 @@ dependencies = [ [[package]] name = "rattler_index" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0836ee9b0e6b45ff7f8cda1b3e469274d650ba8982161ffde43c841e7d84d3b" +source = "git+https://github.com/mamba-org/rattler?branch=main#4fc2d38ee482aeb154d75cd3423577d3bcc6b3f9" dependencies = [ "fs-err", "rattler_conda_types", @@ -2669,8 +2668,7 @@ dependencies = [ [[package]] name = "rattler_macros" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206cc71800e9ba58c50215e7e53d0000e6a04829b2ef51e1f76a6ee4c26bd93f" +source = "git+https://github.com/mamba-org/rattler?branch=main#4fc2d38ee482aeb154d75cd3423577d3bcc6b3f9" dependencies = [ "quote", "syn 2.0.48", @@ -2679,8 +2677,7 @@ dependencies = [ [[package]] name = "rattler_networking" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8970cb99764a9231d45cb8c520468e5aadf1731996cdeb27ba87eb629227c73" +source = "git+https://github.com/mamba-org/rattler?branch=main#4fc2d38ee482aeb154d75cd3423577d3bcc6b3f9" dependencies = [ "anyhow", "async-trait", @@ -2688,7 +2685,7 @@ dependencies = [ "dirs", "fslock", "getrandom", - "itertools 0.12.1", + "itertools", "keyring", "lazy_static", "libc", @@ -2708,13 +2705,12 @@ dependencies = [ [[package]] name = "rattler_package_streaming" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a1ba1b857bd0dcd41edf1fd3af81a8d15641b9d0a273b58d6faa640d71d2dbf" +source = "git+https://github.com/mamba-org/rattler?branch=main#4fc2d38ee482aeb154d75cd3423577d3bcc6b3f9" dependencies = [ "bzip2", "chrono", "futures-util", - "itertools 0.12.1", + "itertools", "num_cpus", "rattler_conda_types", "rattler_digest", @@ -2735,8 +2731,7 @@ dependencies = [ [[package]] name = "rattler_repodata_gateway" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9da052dabd1d359a74b81eb0480ff6ee3149ac45877fabb7a1b4be6d61336aa8" +source = "git+https://github.com/mamba-org/rattler?branch=main#4fc2d38ee482aeb154d75cd3423577d3bcc6b3f9" dependencies = [ "anyhow", "async-compression", @@ -2747,7 +2742,7 @@ dependencies = [ "hex", "humansize", "humantime", - "itertools 0.12.1", + "itertools", "json-patch", "libc", "md-5", @@ -2775,12 +2770,11 @@ dependencies = [ [[package]] name = "rattler_shell" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4437834a7cec85a246dbf64241125c8d16acc9e3d990884acfbb5e359e6f4318" +source = "git+https://github.com/mamba-org/rattler?branch=main#4fc2d38ee482aeb154d75cd3423577d3bcc6b3f9" dependencies = [ "enum_dispatch", - "indexmap 2.2.2", - "itertools 0.12.1", + "indexmap 2.2.3", + "itertools", "rattler_conda_types", "serde_json", "shlex", @@ -2793,13 +2787,13 @@ dependencies = [ [[package]] name = "rattler_solve" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76b7cb1b5c5559546f5337145eff7aedfcd4b96d412cf00ee3a852b0230c19d0" +source = "git+https://github.com/mamba-org/rattler?branch=main#4fc2d38ee482aeb154d75cd3423577d3bcc6b3f9" dependencies = [ "anyhow", "chrono", + "futures", "hex", - "itertools 0.12.1", + "itertools", "rattler_conda_types", "rattler_digest", "resolvo", @@ -2813,8 +2807,7 @@ dependencies = [ [[package]] name = "rattler_virtual_packages" version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "863fe4a198900906da025f8f8e27c8b1c7256a01984447f94ef9e7284a1cb5c8" +source = "git+https://github.com/mamba-org/rattler?branch=main#4fc2d38ee482aeb154d75cd3423577d3bcc6b3f9" dependencies = [ "cfg-if", "libloading", @@ -2995,13 +2988,15 @@ dependencies = [ [[package]] name = "resolvo" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd163bc7df01195423c83a7a391fecf319ff41d3de899694a9ccb698e790b29" +checksum = "2016584c3fd9df0fd859a7dcbc7fafdc7fdd2d87b53a576e8e63e62fad140e33" dependencies = [ "bitvec", "elsa", - "itertools 0.11.0", + "event-listener 5.0.0", + "futures", + "itertools", "petgraph", "tracing", ] @@ -3066,7 +3061,7 @@ version = "0.1.0" dependencies = [ "duct", "glob", - "itertools 0.12.1", + "itertools", "rattler_package_streaming", "serde_json", "sha1", @@ -3303,7 +3298,7 @@ version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.3", "itoa", "ryu", "serde", @@ -3343,16 +3338,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.6.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b0ed1662c5a68664f45b76d18deb0e234aff37207086803165c961eb695e981" +checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" dependencies = [ "base64", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.2", + "indexmap 2.2.3", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -3360,9 +3356,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.6.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568577ff0ef47b879f736cd66740e022f3672788cdf002a05a4e609ea5a6fb15" +checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" dependencies = [ "darling", "proc-macro2", @@ -3376,7 +3372,7 @@ version = "0.9.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adf8a49373e98a4c5f0ceb5d05aa7c648d75f63774981ed95b7c7443bbd50c6e" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.3", "itoa", "ryu", "serde", @@ -3539,6 +3535,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" + [[package]] name = "strum" version = "0.25.0" @@ -3738,18 +3740,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", @@ -3913,7 +3915,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.3", "toml_datetime", "winnow", ] @@ -3924,7 +3926,7 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c9ffdf896f8daaabf9b66ba8e77ea1ed5ed0f72821b398aba62352e95062951" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", diff --git a/Cargo.toml b/Cargo.toml index e99f87c31..b53c2d379 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,10 +48,10 @@ reqwest = { version = "0.11.24", default-features = false, features = [ tokio = { version = "1.36.0", features = ["rt", "macros", "rt-multi-thread"] } itertools = "0.12.1" content_inspector = "0.2.4" -serde_with = "3.6.0" +serde_with = "3.6.1" url = "2.5.0" tracing = "0.1.40" -clap = { version = "4.4.18", features = ["derive", "env", "cargo"] } +clap = { version = "4.5.0", features = ["derive", "env", "cargo"] } minijinja = { version = "1.0.12", features = [ "unstable_machinery", "custom_syntax", @@ -69,12 +69,12 @@ scroll = "0.12.0" pathdiff = "0.2.1" comfy-table = "7.1.0" futures = "0.3.30" -indicatif = "0.17.7" +indicatif = "0.17.8" console = { version = "0.15.8", features = ["windows-console-colors"] } once_cell = "1.19.0" -thiserror = "1.0.56" +thiserror = "1.0.57" tempfile = "3.10.0" -chrono = "0.4.33" +chrono = "0.4.34" sha1 = "0.10.6" spdx = "0.10.3" fs_extra = "1.3.0" @@ -84,11 +84,11 @@ tracing-indicatif = "0.3.6" clap-verbosity-flag = "2.1.2" tracing-core = "0.1.32" petgraph = "0.6.4" -indexmap = "2.2.2" +indexmap = "2.2.3" dunce = "1.0.4" fs-err = "2.11.0" which = "6.0.0" -clap_complete = "4.4.10" +clap_complete = "4.5.0" tokio-util = "0.7.10" tar = "0.4.40" @@ -120,17 +120,17 @@ pre-build = [ "apt-get update && apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH", ] -# [patch.crates-io] -# rattler = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_conda_types = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_digest = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_index = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_networking = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_shell = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_solve = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", branch = "main" } -# rattler_package_streaming = { git = "https://github.com/mamba-org/rattler", branch = "main" } +[patch.crates-io] +rattler = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_conda_types = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_digest = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_index = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_networking = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_repodata_gateway = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_shell = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_solve = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_virtual_packages = { git = "https://github.com/mamba-org/rattler", branch = "main" } +rattler_package_streaming = { git = "https://github.com/mamba-org/rattler", branch = "main" } # rattler = { path = "../rattler/crates/rattler" } # rattler_conda_types = { path = "../rattler/crates/rattler_conda_types" } diff --git a/rust-toolchain b/rust-toolchain index 5e3a42566..7c7053aa2 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.73.0 +1.75.0 diff --git a/src/build.rs b/src/build.rs index f598bddb3..7363c4b42 100644 --- a/src/build.rs +++ b/src/build.rs @@ -307,7 +307,8 @@ pub async fn run_build( ) .into_diagnostic()?; - let (result, paths_json) = package_conda(&output, &files_after).into_diagnostic()?; + let (result, paths_json) = + package_conda(&output, &tool_configuration, &files_after).into_diagnostic()?; // We run all the package content tests for test in output.recipe.tests() { diff --git a/src/packaging.rs b/src/packaging.rs index c7da481d1..ead881942 100644 --- a/src/packaging.rs +++ b/src/packaging.rs @@ -20,7 +20,8 @@ pub use metadata::create_prefix_placeholder; use crate::metadata::Output; use crate::package_test::write_test_files; -use crate::post_process; +use crate::render::solver::default_bytes_style; +use crate::{post_process, tool_configuration}; #[allow(missing_docs)] #[derive(Debug, thiserror::Error)] @@ -150,6 +151,21 @@ fn write_recipe_folder( Ok(files) } +struct ProgressBar { + progress_bar: indicatif::ProgressBar, +} + +impl rattler_package_streaming::write::ProgressBar for ProgressBar { + fn set_progress(&mut self, progress: u64, message: &str) { + self.progress_bar.set_position(progress); + self.progress_bar.set_message(message.to_string()); + } + + fn set_total(&mut self, total: u64) { + self.progress_bar.set_length(total); + } +} + /// Given an output and a set of new files, create a conda package. /// This function will copy all the files to a temporary directory and then /// create a conda package from that. Note that the output needs to have its @@ -158,6 +174,7 @@ fn write_recipe_folder( /// The `local_channel_dir` is the path to the local channel / output directory. pub fn package_conda( output: &Output, + tool_configuration: &tool_configuration::Configuration, files: &Files, ) -> Result<(PathBuf, PathsJson), PackagingError> { let local_channel_dir = &output.build_configuration.directories.output_dir; @@ -231,6 +248,12 @@ pub fn package_conda( tracing::info!("Compressing archive..."); + let progress_bar = tool_configuration.multi_progress_indicator.add( + indicatif::ProgressBar::new(0) + .with_prefix("Compressing ") + .with_style(default_bytes_style().unwrap()), + ); + match packaging_settings.archive_type { ArchiveType::TarBz2 => { write_tar_bz2_package( @@ -239,6 +262,7 @@ pub fn package_conda( &tmp.files.iter().cloned().collect::>(), CompressionLevel::Numeric(packaging_settings.compression_level), Some(&output.build_configuration.timestamp), + Some(Box::new(ProgressBar { progress_bar })), )?; } ArchiveType::Conda => { @@ -250,6 +274,7 @@ pub fn package_conda( packaging_settings.compression_threads, &identifier, Some(&output.build_configuration.timestamp), + Some(Box::new(ProgressBar { progress_bar })), )?; } } diff --git a/src/render/solver.rs b/src/render/solver.rs index 0f2c38d23..8fdaca921 100644 --- a/src/render/solver.rs +++ b/src/render/solver.rs @@ -289,7 +289,7 @@ async fn execute_transaction( link_pb.enable_steady_tick(Duration::from_millis(100)); // Perform all transactions operations in parallel. - stream::iter(transaction.operations) + stream::iter(transaction.operations.clone()) .map(Ok) .try_for_each_concurrent(50, |op| { let download_client = download_client.clone(); @@ -314,10 +314,7 @@ async fn execute_transaction( }) .await?; - install_driver.post_process( - &PrefixRecord::collect_from_prefix(target_prefix)?, - target_prefix, - )?; + install_driver.post_process(&transaction, target_prefix)?; Ok(()) } diff --git a/src/source/mod.rs b/src/source/mod.rs index 1fd0b5a9c..27377afec 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -285,8 +285,7 @@ impl std::io::Read for TarCompression<'_> { } } -/// Moves the directory content from src to dest -/// after stripping root dir, if present. +/// Moves the directory content from src to dest after stripping root dir, if present. fn move_extracted_dir(src: &Path, dest: &Path) -> Result<(), SourceError> { let mut entries = fs::read_dir(src)?; let src_dir = match entries.next().transpose()? { @@ -297,7 +296,7 @@ fn move_extracted_dir(src: &Path, dest: &Path) -> Result<(), SourceError> { _ => src.to_path_buf(), }; - for entry in fs::read_dir(&src_dir)? { + for entry in fs::read_dir(src_dir)? { let entry = entry?; let destination = dest.join(entry.file_name()); fs::rename(entry.path(), destination)?;