From b80278613e4aa23ab4f016a5ec65cfcd5201e4ec Mon Sep 17 00:00:00 2001 From: El Mehdi YOUNES Date: Tue, 22 Apr 2025 09:47:37 +0200 Subject: [PATCH] package/pkg-download: switch from cargo2 to cargo3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Starting from rust 1.84.0 (cargo 1.84.0), published crates now always include a Cargo.lock file. Originally it was only included for packages that have executables or examples for use with cargo install. see [1] This behaviour change alters the contents of the .tar.gz archives, which causes SHA256 hash mistmatches when trying to build Rust packages. Example build failure with bat-0.24.0: ERROR: while checking hashes from package/bat/bat.hash ERROR: bat-0.24.0-cargo2.tar.gz has wrong sha256 hash: ERROR: expected: 45fcdd6076dc1b45698a7b6c0f4d1f5d9ae676f3ca3b155402ad24680d5b4df6 ERROR: got : 28b302b1aa325221796d4ebb25bacab19a8927ef32f4d56a965b32a7b1c102fc After using the ne hash to download the new archive tar.gz, we have the difference between the old archive and the new one using diffoscope: │ │ --rw-r--r-- 0 0 0 1529 2023-10-11 17:14:12.000000 bat-0.24.0/VENDOR/bincode/.cargo-checksum.json │ │ +-rw-r--r-- 0 0 0 1609 2023-10-11 17:14:12.000000 bat-0.24.0/VENDOR/bincode/.cargo-checksum.json │ │ +-rw-r--r-- 0 0 0 1766 2023-10-11 17:14:12.000000 bat-0.24.0/VENDOR/bincode/Cargo.lock │ │ -rw-r--r-- 0 0 0 1388 2023-10-11 17:14:12.000000 bat-0.24.0/VENDOR/bincode/Cargo.toml We can see that Cargo.lock has been added. To avoid hash mismatch issues and to clearly mark archives generated with the new Cargo behavior, we migrate the naming from 'cargo2.tar.gz' to 'cargo3.tar.gz'. We did not find any alternative to disable this new cargo-publish behavior, so this change is necessary to allow updating the hashes of Cargo-fetched packages. [1] https://github.com/rust-lang/cargo/pull/14815 https://doc.rust-lang.org/nightly/cargo/CHANGELOG.html Signed-off-by: El Mehdi YOUNES Signed-off-by: Thomas Petazzoni --- package/pkg-download.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/pkg-download.mk b/package/pkg-download.mk index cf5959ea95..bbb3501643 100644 --- a/package/pkg-download.mk +++ b/package/pkg-download.mk @@ -12,7 +12,7 @@ BR_FMT_VERSION_git = -git4 BR_FMT_VERSION_svn = -svn5 BR_FMT_VERSION_go = -go2 -BR_FMT_VERSION_cargo = -cargo2 +BR_FMT_VERSION_cargo = -cargo3 DL_WRAPPER = support/download/dl-wrapper