diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 0eecbfc79..b2a92dcc3 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -321,7 +321,7 @@ dependencies = [ "reqwest 0.12.28", "serde", "serde_json", - "sha2 0.10.9", + "sha2 0.11.0", "tokio", "tracing", ] @@ -368,10 +368,10 @@ dependencies = [ "regex", "serde", "serde_json", - "sha2 0.10.9", + "sha2 0.11.0", "tempfile", "tracing", - "windows 0.62.2", + "windows", ] [[package]] @@ -395,8 +395,8 @@ dependencies = [ "thiserror 2.0.21", "tracing", "url", - "windows 0.62.2", - "windows-future 0.3.2", + "windows", + "windows-future", ] [[package]] @@ -426,7 +426,7 @@ dependencies = [ "regex", "reqwest 0.12.28", "serde_json", - "sha2 0.10.9", + "sha2 0.11.0", "tempfile", "thiserror 2.0.21", "tracing", @@ -638,7 +638,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -856,8 +856,8 @@ dependencies = [ "objc2-core-foundation", "objc2-foundation", "web-sys", - "windows 0.62.2", - "windows-core 0.62.2", + "windows", + "windows-core", ] [[package]] @@ -1072,7 +1072,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -1189,9 +1189,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e" dependencies = [ "percent-encoding", ] @@ -1509,7 +1509,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core 0.62.2", + "windows-core", ] [[package]] @@ -1701,7 +1701,7 @@ dependencies = [ "simd_cesu8", "thiserror 2.0.21", "walkdir", - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -1799,7 +1799,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -2028,16 +2028,16 @@ dependencies = [ [[package]] name = "notify-rust" -version = "4.18.0" +version = "4.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5b4c1b4f2aa9f25f63a7a49d3dd0ed567b3670da15330a66b29434be899b891" +checksum = "57da5b5d3b7809bf71858da5a2818c3404ca4688c02c8abecdda0fcdec235df3" dependencies = [ "futures-lite", "log", "mac-notification-sys", "serde", "tauri-winrt-notification", - "zbus 5.19.0", + "zbus 6.5.0", ] [[package]] @@ -2046,7 +2046,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2447,9 +2447,9 @@ dependencies = [ [[package]] name = "prism-sys" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7205352adf3f71f6873ea93d0e5d315cf8118c534a4db6343d32a3847d7cfe" +checksum = "eb2be0a97d8e6d8992fadbccd02a010359b9dabb8db9507b720944ac8d6e88ee" dependencies = [ "cmake", "pkg-config", @@ -2457,9 +2457,9 @@ dependencies = [ [[package]] name = "prismer" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23252e8edaba03f8a24e833e7383f49b653e5389f7b8546c0ada445097aec2e3" +checksum = "e3c80e3e73a26f96361003b0be10847b2814070e7d43d38c3151115bd9fcbb92" dependencies = [ "prism-sys", ] @@ -2550,7 +2550,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2787,7 +2787,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3319,12 +3319,12 @@ dependencies = [ [[package]] name = "tauri-winrt-notification" -version = "0.7.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed071c670382e85fc2f48ae706492d8c338f4f89bf72520d32f8abfe880aade" +checksum = "f37a6c354fd28fc9e322ed9bd47e3959576dad28c9d58ea1cf888cce1c7ccb36" dependencies = [ "thiserror 2.0.21", - "windows 0.61.3", + "windows", "windows-version", ] @@ -3338,7 +3338,7 @@ dependencies = [ "getrandom 0.4.3", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -3683,9 +3683,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.8" +version = "2.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a" dependencies = [ "form_urlencoded", "idna", @@ -3850,20 +3850,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "windows" -version = "0.61.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" -dependencies = [ - "windows-collections 0.2.0", - "windows-core 0.61.2", - "windows-future 0.2.1", - "windows-link 0.1.3", - "windows-numerics 0.2.0", + "windows-sys 0.52.0", ] [[package]] @@ -3872,19 +3859,10 @@ version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" dependencies = [ - "windows-collections 0.3.2", - "windows-core 0.62.2", - "windows-future 0.3.2", - "windows-numerics 0.3.1", -] - -[[package]] -name = "windows-collections" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" -dependencies = [ - "windows-core 0.61.2", + "windows-collections", + "windows-core", + "windows-future", + "windows-numerics", ] [[package]] @@ -3893,20 +3871,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" dependencies = [ - "windows-core 0.62.2", -] - -[[package]] -name = "windows-core" -version = "0.61.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-link 0.1.3", - "windows-result 0.3.4", - "windows-strings 0.4.2", + "windows-core", ] [[package]] @@ -3917,20 +3882,9 @@ checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", - "windows-link 0.2.1", - "windows-result 0.4.1", - "windows-strings 0.5.1", -] - -[[package]] -name = "windows-future" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", - "windows-threading 0.1.0", + "windows-link", + "windows-result", + "windows-strings", ] [[package]] @@ -3939,9 +3893,9 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" dependencies = [ - "windows-core 0.62.2", - "windows-link 0.2.1", - "windows-threading 0.2.1", + "windows-core", + "windows-link", + "windows-threading", ] [[package]] @@ -3966,45 +3920,20 @@ dependencies = [ "syn 2.0.119", ] -[[package]] -name = "windows-link" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" - [[package]] name = "windows-link" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" -[[package]] -name = "windows-numerics" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" -dependencies = [ - "windows-core 0.61.2", - "windows-link 0.1.3", -] - [[package]] name = "windows-numerics" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" dependencies = [ - "windows-core 0.62.2", - "windows-link 0.2.1", -] - -[[package]] -name = "windows-result" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" -dependencies = [ - "windows-link 0.1.3", + "windows-core", + "windows-link", ] [[package]] @@ -4013,16 +3942,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-link 0.2.1", -] - -[[package]] -name = "windows-strings" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" -dependencies = [ - "windows-link 0.1.3", + "windows-link", ] [[package]] @@ -4031,7 +3951,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -4058,7 +3978,7 @@ version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -4077,22 +3997,13 @@ dependencies = [ "windows_x86_64_msvc", ] -[[package]] -name = "windows-threading" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" -dependencies = [ - "windows-link 0.1.3", -] - [[package]] name = "windows-threading" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" dependencies = [ - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -4101,7 +4012,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631" dependencies = [ - "windows-link 0.2.1", + "windows-link", ] [[package]] @@ -4179,9 +4090,9 @@ checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" [[package]] name = "wxdragon" -version = "0.9.24" +version = "0.9.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10bc93e4c8366136a9d1468c7bde5363be8386af52f77f133d7805e09031163" +checksum = "7c7ada439c6cf4130bad122cb47aff3831e79ea54b2988abebee7f3aa41ba47d" dependencies = [ "bitflags 2.13.2", "log", @@ -4192,9 +4103,9 @@ dependencies = [ [[package]] name = "wxdragon-macros" -version = "0.9.24" +version = "0.9.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d53c29add134e7f383ebc1a3ca4bbff5f3840fd2f2d5843168691c5d3648e9" +checksum = "ebd5ad27a26559b9d0679c82a814f6ead7b59abb3310850dd8409f49d3d8911d" dependencies = [ "proc-macro2", "quick-xml", @@ -4204,9 +4115,9 @@ dependencies = [ [[package]] name = "wxdragon-sys" -version = "0.9.24" +version = "0.9.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f46998e50d71680abec6360432fca9dd2953066a1f7b64b22b69261e3ce7bf9" +checksum = "bbd2e7bc93a6a132da79ef2d8ea1d46cf25399f635d18fe2049a39711770c075" dependencies = [ "bindgen", "cmake", @@ -4251,7 +4162,7 @@ dependencies = [ "regex", "reqwest 0.12.28", "serde_json", - "sha2 0.10.9", + "sha2 0.11.0", "tar", "tempfile", "zip", @@ -4314,43 +4225,35 @@ dependencies = [ "windows-sys 0.52.0", "xdg-home", "zbus_macros 4.4.0", - "zbus_names 3.0.0", - "zvariant 4.2.0", + "zbus_names", + "zvariant", ] [[package]] name = "zbus" -version = "5.19.0" +version = "6.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" +checksum = "9a7f9f5dd97fa527c1202ba1cb35d48e07f77d4de8542317c854f7aef22b0668" dependencies = [ - "async-broadcast", - "async-executor", - "async-io", - "async-lock", - "async-process", - "async-recursion", - "async-task", "async-trait", - "blocking", - "enumflags2", - "event-listener", + "bitflags 2.13.2", + "endi", "futures-core", - "futures-lite", "hex", "libc", "ordered-stream", "rustix", "serde", "serde_repr", - "tracing", + "socket2", "uds_windows", "uuid", "windows-sys 0.61.2", "winnow", - "zbus_macros 5.19.0", - "zbus_names 4.3.4", - "zvariant 5.15.0", + "zbus_macros 6.5.0", + "zbus_utils", + "zcheapstr", + "zruntime", ] [[package]] @@ -4363,22 +4266,19 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.119", - "zvariant_utils 2.1.0", + "zvariant_utils", ] [[package]] name = "zbus_macros" -version = "5.19.0" +version = "6.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" +checksum = "2f5aa7f2c4ea81b7ccfb26bafefdb4d1a44dd9d4f82c8426173a3727311743e4" dependencies = [ - "proc-macro-crate", "proc-macro2", "quote", "syn 3.0.6", - "zbus_names 4.3.4", - "zvariant 5.15.0", - "zvariant_utils 4.2.0", + "zbus_utils", ] [[package]] @@ -4389,25 +4289,27 @@ checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" dependencies = [ "serde", "static_assertions", - "zvariant 4.2.0", + "zvariant", ] [[package]] -name = "zbus_names" -version = "4.3.4" +name = "zbus_utils" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e" +checksum = "af55e52da295311b368c45bcae221f020e28e97a2420360170ce389218e76ec7" dependencies = [ + "proc-macro2", + "quote", "serde", + "syn 3.0.6", "winnow", - "zvariant 5.15.0", ] [[package]] name = "zcheapstr" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473" +checksum = "2da34e7164b75d803c3197b86e6cf61b874106fbd472c5082575a8bc5fbd0907" dependencies = [ "serde", ] @@ -4551,31 +4453,29 @@ dependencies = [ ] [[package]] -name = "zvariant" -version = "4.2.0" +name = "zruntime" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2084290ab9a1c471c38fc524945837734fbf124487e105daec2bb57fd48c81fe" +checksum = "ac67096b97c00742108c4674db6bb6178adb78c4b66a506b0e4a7a9593aa5d9e" dependencies = [ - "endi", - "enumflags2", - "serde", - "static_assertions", - "zvariant_derive 4.2.0", + "futures-core", + "futures-io", + "rustix", + "socket2", + "windows-sys 0.61.2", ] [[package]] name = "zvariant" -version = "5.15.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1d34c27cc6cdd1f458427519dd6b8612f7b7e3f7b9a0b2355d041dda9869147" +checksum = "2084290ab9a1c471c38fc524945837734fbf124487e105daec2bb57fd48c81fe" dependencies = [ "endi", "enumflags2", "serde", - "winnow", - "zcheapstr", - "zvariant_derive 5.15.0", - "zvariant_utils 4.2.0", + "static_assertions", + "zvariant_derive", ] [[package]] @@ -4588,20 +4488,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.119", - "zvariant_utils 2.1.0", -] - -[[package]] -name = "zvariant_derive" -version = "5.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864155e69b4352db0c7f374917bf45d1e0c8d17659c8b3dbf9795f3673f8c497" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 3.0.6", - "zvariant_utils 4.2.0", + "zvariant_utils", ] [[package]] @@ -4614,16 +4501,3 @@ dependencies = [ "quote", "syn 2.0.119", ] - -[[package]] -name = "zvariant_utils" -version = "4.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "syn 3.0.6", - "winnow", -] diff --git a/rust/crates/aw-ai/Cargo.toml b/rust/crates/aw-ai/Cargo.toml index cf9871f45..0c6d2770e 100644 --- a/rust/crates/aw-ai/Cargo.toml +++ b/rust/crates/aw-ai/Cargo.toml @@ -14,5 +14,5 @@ chrono-tz.workspace = true tracing.workspace = true reqwest.workspace = true regex = "1" -sha2 = "0.10" +sha2 = "0.11" tokio = { version = "1", features = ["rt-multi-thread", "time"] } diff --git a/rust/crates/aw-ai/src/explainer.rs b/rust/crates/aw-ai/src/explainer.rs index e2b459e40..58da7ded6 100644 --- a/rust/crates/aw-ai/src/explainer.rs +++ b/rust/crates/aw-ai/src/explainer.rs @@ -27,6 +27,13 @@ use crate::provider::{ use crate::pyfmt::{self, truthy}; use crate::transport::{self, CancelToken, StreamLimits}; +fn sha256_hex(bytes: &[u8]) -> String { + Sha256::digest(bytes) + .iter() + .map(|b| format!("{b:02x}")) + .collect() +} + /// How long an explanation stays cached. Python's `Cache` is created with /// `ai_cache_ttl`, but the explainer always stores with `ttl=300`. pub const EXPLANATION_CACHE_TTL: Duration = Duration::from_secs(300); @@ -529,7 +536,7 @@ impl AiExplainer { string(&self.effective_system_prompt(style)), string(&self.build_prompt(weather, location_name)), ); - format!("ai_explanation:v2:{:x}", Sha256::digest(dumped.as_bytes())) + format!("ai_explanation:v2:{}", sha256_hex(dumped.as_bytes())) } /// `_text_product_cache_key`. @@ -541,10 +548,10 @@ impl AiExplainer { style: ExplanationStyle, ) -> String { format!( - "ai_text_product:{}:{}:{product_type}:{location_name}:{:x}:{}", + "ai_text_product:{}:{}:{product_type}:{location_name}:{}:{}", self.provider.as_str(), self.effective_model(), - Sha256::digest(product_text.as_bytes()), + sha256_hex(product_text.as_bytes()), style.as_str() ) } diff --git a/rust/crates/aw-notify/Cargo.toml b/rust/crates/aw-notify/Cargo.toml index b33cfd264..748bf5ac6 100644 --- a/rust/crates/aw-notify/Cargo.toml +++ b/rust/crates/aw-notify/Cargo.toml @@ -14,7 +14,7 @@ chrono.workspace = true tracing.workspace = true tempfile.workspace = true regex = "1" -sha2 = "0.10" +sha2 = "0.11" [target.'cfg(windows)'.dependencies] windows = { version = "0.62", features = [ diff --git a/rust/crates/aw-services/Cargo.toml b/rust/crates/aw-services/Cargo.toml index 67bf62a08..d65a24925 100644 --- a/rust/crates/aw-services/Cargo.toml +++ b/rust/crates/aw-services/Cargo.toml @@ -18,7 +18,7 @@ reqwest.workspace = true tempfile.workspace = true url.workspace = true regex = "1" -sha2 = "0.10" +sha2 = "0.11" md5 = "0.8" [target.'cfg(windows)'.dependencies] diff --git a/rust/xtask/Cargo.toml b/rust/xtask/Cargo.toml index f70cc29c6..8f8deccc6 100644 --- a/rust/xtask/Cargo.toml +++ b/rust/xtask/Cargo.toml @@ -16,7 +16,7 @@ flate2 = "1" icns = "0.5" image = { version = "0.25", default-features = false, features = ["png", "ico"] } regex = "1" -sha2 = "0.10" +sha2 = "0.11" tar = "0.4" zip = { version = "9.0.5", default-features = false, features = ["deflate"] } diff --git a/rust/xtask/src/package.rs b/rust/xtask/src/package.rs index 9114321c5..a0a36394c 100644 --- a/rust/xtask/src/package.rs +++ b/rust/xtask/src/package.rs @@ -8,7 +8,7 @@ //! Each artifact gets a `.sha256` beside it. use std::fs; -use std::io::Write; +use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::process::Command; @@ -682,12 +682,25 @@ fn remove_file_if_exists(path: &Path) -> Result<()> { /// `.sha256` in `sha256sum` format. fn write_sha256(path: &Path) -> Result<()> { let mut hasher = Sha256::new(); - std::io::copy(&mut fs::File::open(path)?, &mut hasher)?; + let mut file = fs::File::open(path)?; + let mut buf = [0u8; 8192]; + loop { + let n = file.read(&mut buf)?; + if n == 0 { + break; + } + hasher.update(&buf[..n]); + } let name = path .file_name() .expect("artifact has a name") .to_string_lossy(); + let digest = hasher + .finalize() + .iter() + .map(|b| format!("{b:02x}")) + .collect::(); let mut sum = fs::File::create(format!("{}.sha256", path.display()))?; - writeln!(sum, "{:x} {name}", hasher.finalize())?; + writeln!(sum, "{digest} {name}")?; Ok(()) }