From 364f8515042e03b8593386d94411f7a4f388e89d Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Fri, 9 Feb 2024 23:44:12 -0500 Subject: [PATCH] don't allow upstream's bootstrap.py to delete .cargo/ directory. When we call bootstrap.bootstrap(args), the check_vendored_status() upstream function will happily delete .cargo/. This is a problem because the quilt source package wants .cargo/config.toml to not be modified without a patch. Without this, after running 'debian/rules source_orig-stage0', further builds will fail with: dpkg-source: warning: ignoring deletion of directory .cargo dpkg-source: info: local changes detected, the modified files are: rustc-1.70.0+dfsg1/.cargo/config.toml dpkg-source: info: Hint: make sure the version in debian/changelog matches the unpacked source tree dpkg-source: info: you can integrate the local changes with dpkg-source --commit dpkg-source: error: aborting due to unexpected upstream changes, see /tmp/rustc_1.70.0+dfsg1-6.diff.nkvdQ1 Rather than patching the upstream bootstrap.py, we just move .cargo out of the way temporarily and move it back after the bootstrap() function finishes. --- debian/changelog | 1 + debian/get-stage0.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 0dc0fb3533..daa9edc808 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ rustc (1.70.0+dfsg1-6) UNRELEASED; urgency=medium architectures (closes: #1021711). * Run 'd/rules clean' after running make_orig-stage0_tarball.sh so that the suggestion to rebuild the .dsc actually works. + * Don't allow upstream's bootstrap.py to delete .cargo/ directory. -- Fabian Grünbichler Mon, 15 Jan 2024 08:16:35 +0100 diff --git a/debian/get-stage0.py b/debian/get-stage0.py index 499f841938..49f8066ca0 100755 --- a/debian/get-stage0.py +++ b/debian/get-stage0.py @@ -3,6 +3,7 @@ # In that case, you probably just need to override the failing step in our # DownloadOnlyRustBuild class below. +import shutil import sys import bootstrap @@ -26,7 +27,12 @@ def main(argv): DownloadOnlyRustBuild.triple = triple bootstrap.RustBuild = DownloadOnlyRustBuild args = bootstrap.parse_args() - bootstrap.bootstrap(args) + # bootstrap.py likes to delete our .cargo directory out from under us + shutil.move(".cargo", ".cargo-bak") + try: + bootstrap.bootstrap(args) + finally: + shutil.move(".cargo-bak", ".cargo") if __name__ == '__main__': main(sys.argv) -- 2.39.5