forked from M-Labs/zynq-rs
patch cargo-xbuild to ensure copied Cargo.lock is writable
https://github.com/rust-osdev/cargo-xbuild/issues/96
This commit is contained in:
parent
34a63d7732
commit
56c94b0855
@ -8,7 +8,9 @@ let
|
||||
src = ./.;
|
||||
cargoSha256 = "1f2psa1g41pl2j8n60hhik2s2pqdfjhr5capimvajf81kxrnn2ck";
|
||||
|
||||
nativeBuildInputs = [ pkgs.cargo-xbuild ];
|
||||
nativeBuildInputs = [
|
||||
(pkgs.cargo-xbuild.overrideAttrs(oa: { patches = oa.patches ++ [ ./xbuild_writable_lockfile.diff ]; } ))
|
||||
];
|
||||
buildPhase = ''
|
||||
export XARGO_RUST_SRC="${rustPlatform.rust.rustc.src}/library"
|
||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||
|
@ -8,7 +8,7 @@ in
|
||||
rustPlatform.rust.rustc
|
||||
rustPlatform.rust.cargo
|
||||
pkgs.cacert
|
||||
pkgs.cargo-xbuild
|
||||
(pkgs.cargo-xbuild.overrideAttrs(oa: { patches = oa.patches ++ [ ./xbuild_writable_lockfile.diff ]; } ))
|
||||
|
||||
pkgs.openocd pkgs.gdb
|
||||
pkgs.openssh pkgs.rsync
|
||||
|
27
xbuild_writable_lockfile.diff
Normal file
27
xbuild_writable_lockfile.diff
Normal file
@ -0,0 +1,27 @@
|
||||
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"), "")?;
|
||||
|
Loading…
Reference in New Issue
Block a user