rust-src: ship original Cargo.lock file

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 <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2024-10-24 15:24:30 +02:00
parent c9da2be6c3
commit bb0df4158e

8
debian/rules vendored
View File

@ -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 \