1
0
Fork 0
zynq-rs/xbuild_writable_lockfile.diff

28 lines
1005 B
Diff
Raw Normal View History

diff --git a/src/sysroot.rs b/src/sysroot.rs
index 1f3c8d1..422d3d0 100644
--- a/src/sysroot.rs
+++ b/src/sysroot.rs
@@ -85,10 +85,20 @@ fn build_crate(
}
util::write(&td.join("Cargo.toml"), &stoml)?;
- fs::copy(lockfile, &td.join("Cargo.lock")).chain_err(||
+ let dst_file = td.join("Cargo.lock");
+ fs::copy(lockfile, &dst_file).chain_err(||
format!("failed to copy Cargo.lock from `{}` to `{}`",
- lockfile.display(), &td.join("Cargo.lock").display())
+ lockfile.display(), &dst_file.display())
)?;
+ let mut perms = fs::metadata(&dst_file).chain_err(||
+ format!("failed to retrieve permissions for `{}`",
+ dst_file.display())
+ )?.permissions();
+ perms.set_readonly(false);
+ fs::set_permissions(&dst_file, perms).chain_err(||
+ format!("failed to update permissions for `{}`",
+ dst_file.display())
+ );
util::mkdir(&td.join("src"))?;
util::write(&td.join("src/lib.rs"), "")?;