From 83778cb227e7c6b10f9eaac352676124236872e2 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 15 Nov 2019 13:07:46 +0100 Subject: [PATCH] Allow writing `Cargo.toml` in project directory. --- README.md | 4 ---- src/docker.rs | 12 +----------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/README.md b/README.md index c5068d92e..773b01962 100644 --- a/README.md +++ b/README.md @@ -284,10 +284,6 @@ $ QEMU_STRACE=1 cross run --target aarch64-unknown-linux-gnu work because `cross` use docker containers only mounts the Cargo project so the container doesn't have access to the rest of the filesystem. -- `cross` will mount the Cargo project as READ ONLY. Thus, if any crate attempts - to modify its “source”, the build will fail. Well behaved crates should only - ever write to `$OUT_DIR` and never modify `$CARGO_MANIFEST_DIR` though. - ## License Licensed under either of diff --git a/src/docker.rs b/src/docker.rs index 79c5554bf..662089248 100644 --- a/src/docker.rs +++ b/src/docker.rs @@ -78,18 +78,8 @@ pub fn run(target: &Target, }; cmd.args(args); - // We create/regenerate the lockfile on the host system because the Docker - // container doesn't have write access to the root of the Cargo project - let cargo_toml = root.join("Cargo.toml"); - let runner = None; - Command::new("cargo").args(&["fetch", - "--manifest-path", - &cargo_toml.display().to_string()]) - .run(verbose) - .chain_err(|| "couldn't generate Cargo.lock")?; - let mut docker = docker_command("run")?; if let Some(toml) = toml { @@ -144,7 +134,7 @@ pub fn run(target: &Target, .args(&["-v", &format!("{}:/cargo:Z", cargo_dir.display())]) // Prevent `bin` from being mounted inside the Docker container. .args(&["-v", "/cargo/bin"]) - .args(&["-v", &format!("{}:/project:Z,ro", root.display())]) + .args(&["-v", &format!("{}:/project:Z", root.display())]) .args(&["-v", &format!("{}:/rust:Z,ro", sysroot.display())]) .args(&["-v", &format!("{}:/target:Z", target_dir.display())]) .args(&["-w", "/project"]);