From bb0df4158ec200de8b50a44ed8ac683fa3ca2fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Thu, 24 Oct 2024 15:24:30 +0200 Subject: [PATCH] rust-src: ship original Cargo.lock file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit since 1.82.0, rust-analyzer unconditionally runs `cargo metadata` in sysroot_src (/usr/lib/rustlib/src/library) to discover its contents. since that directory is owned by root and not writable for regular users, the Cargo.lock file stored there needs to work "as-is". because vendored crates are heavily patched for building, but not part of rust-src, the Cargo.lock file generated as part of the build doesn't match the shipped rust-src contents. the original one does however, so ship that instead. Signed-off-by: Fabian Grünbichler --- debian/rules | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index 1a51db4d18..775f3e329a 100755 --- a/debian/rules +++ b/debian/rules @@ -274,10 +274,11 @@ debian/dh_auto_configure.stamp: debian/config.toml check-no-old-llvm extra-vendo # work around #842634 if test $$(grep "127.0.0.1\s*localhost" /etc/hosts | wc -l) -gt 1; then \ debian/ensure-patch -N debian/patches-unused/d-test-host-duplicates.patch; fi - # don't care about lock changes + + # allow lock changes during build, but keep originals around in case we need them for rust-src # keep in sync with d/prune-unused-deps for ws in . src/bootstrap library src/tools/rust-analyzer src/tools/cargo src/tools/rustbook; do \ - rm -f "$$ws/Cargo.lock"; \ + if [ -f "$$ws/Cargo.lock" ]; then mv "$$ws/Cargo.lock" "$$ws/Cargo.lock.orig"; fi \ done # We patched some crates so have to rm the checksums find vendor -name .cargo-checksum.json -execdir "$(CURDIR)/debian/prune-checksums" "{}" + @@ -489,6 +490,9 @@ endif override_dh_install-indep: dh_install $(RM) -rf $(SRC_CLEAN:%=debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION)/%) + + mv debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION)/library/Cargo.lock.orig \ + debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION)/library/Cargo.lock # Get rid of lintian warnings find debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION) -type f \ \( -name .gitignore \