Copy Cargo.lock over in ./y.sh prepare

This makes it easier for ./x.py to vendor all dependencies
This commit is contained in:
bjorn3 2023-06-05 13:59:08 +00:00
parent bcac222013
commit 8c1c84d79e
2 changed files with 20 additions and 11 deletions

View File

@ -47,6 +47,10 @@ pub(crate) fn prepare_stdlib(dirs: &Dirs, rustc: &Path) {
"#, "#,
) )
.unwrap(); .unwrap();
let source_lockfile = RelPath::PATCHES.to_path(dirs).join("stdlib-lock.toml");
let target_lockfile = STDLIB_SRC.to_path(dirs).join("Cargo.lock");
fs::copy(source_lockfile, target_lockfile).unwrap();
} }
pub(crate) struct GitRepo { pub(crate) struct GitRepo {
@ -134,6 +138,15 @@ pub(crate) fn fetch(&self, dirs: &Dirs) {
} }
} }
let source_lockfile =
RelPath::PATCHES.to_path(dirs).join(format!("{}-lock.toml", self.patch_name));
let target_lockfile = download_dir.join("Cargo.lock");
if source_lockfile.exists() {
fs::copy(source_lockfile, target_lockfile).unwrap();
} else {
assert!(target_lockfile.exists());
}
let actual_hash = format!("{:016x}", hash_dir(&download_dir)); let actual_hash = format!("{:016x}", hash_dir(&download_dir));
if actual_hash != self.content_hash { if actual_hash != self.content_hash {
println!( println!(
@ -285,12 +298,4 @@ pub(crate) fn apply_patches(dirs: &Dirs, crate_name: &str, source_dir: &Path, ta
apply_patch_cmd.arg(patch).arg("-q"); apply_patch_cmd.arg(patch).arg("-q");
spawn_and_wait(apply_patch_cmd); spawn_and_wait(apply_patch_cmd);
} }
let source_lockfile = RelPath::PATCHES.to_path(dirs).join(format!("{crate_name}-lock.toml"));
let target_lockfile = target_dir.join("Cargo.lock");
if source_lockfile.exists() {
fs::copy(source_lockfile, target_lockfile).unwrap();
} else {
assert!(target_lockfile.exists());
}
} }

View File

@ -100,7 +100,7 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
"rust-random", "rust-random",
"rand", "rand",
"50b9a447410860af8d6db9a208c3576886955874", "50b9a447410860af8d6db9a208c3576886955874",
"98b2276210b30e43", "446203b96054891e",
"rand", "rand",
); );
@ -110,7 +110,7 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
"rust-lang", "rust-lang",
"regex", "regex",
"32fed9429eafba0ae92a64b01796a0c5a75b88c8", "32fed9429eafba0ae92a64b01796a0c5a75b88c8",
"d6af6507d565aa66", "fcc4df7c5b902633",
"regex", "regex",
); );
@ -120,7 +120,7 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
"rust-lang", "rust-lang",
"portable-simd", "portable-simd",
"ad8afa8c81273b3b49acbea38cd3bcf17a34cf2b", "ad8afa8c81273b3b49acbea38cd3bcf17a34cf2b",
"1ba291009510070b", "800548f8000e31bd",
"portable-simd", "portable-simd",
); );
@ -156,6 +156,10 @@ const fn jit_bin(config: &'static str, source: &'static str, args: &'static str)
&LIBCORE_TESTS_SRC.to_path(&runner.dirs), &LIBCORE_TESTS_SRC.to_path(&runner.dirs),
); );
let source_lockfile = RelPath::PATCHES.to_path(&runner.dirs).join("coretests-lock.toml");
let target_lockfile = LIBCORE_TESTS_SRC.to_path(&runner.dirs).join("Cargo.lock");
fs::copy(source_lockfile, target_lockfile).unwrap();
LIBCORE_TESTS.clean(&runner.dirs); LIBCORE_TESTS.clean(&runner.dirs);
if runner.is_native { if runner.is_native {