mirror of
https://github.com/nix-community/naersk
synced 2024-11-10 06:04:17 +00:00
Fix detection of symlinked Cargo.tomls
This commit fixes a bug introduced in #276 where symlinked Cargo.tomls wouldn't get detected due to readDir() reporting them as - well - _symlinks_ instead of regular files. Note that we continue to keep the `if type == "directory"` condition for recursion which means that we'll fail to detect "nested" Cargo.tomls if someone decides to go wild and create workspace with symlinked crates. That I'm not 100% sure on how to approach, but fortunately cases like those seem to be practically non-existent (and Crane apparently not supporting them builds a bit of confidence here as well). Closes #280.
This commit is contained in:
parent
5c8dbab3d9
commit
88cd223801
6 changed files with 24 additions and 1 deletions
|
@ -306,7 +306,7 @@ let
|
|||
path = "${root}/${dir}/${name}";
|
||||
|
||||
in
|
||||
if type == "regular" && name == "Cargo.toml" then
|
||||
if name == "Cargo.toml" then
|
||||
[{ name = dir; toml = readTOML path; }]
|
||||
else if type == "directory" then
|
||||
findCargoTomls "${dir}/${name}"
|
||||
|
|
|
@ -13,6 +13,7 @@ args: {
|
|||
readme = import ./readme args;
|
||||
simple-dep = import ./simple-dep args;
|
||||
simple-dep-patched = import ./simple-dep-patched args;
|
||||
symlinks = import ./symlinks args;
|
||||
workspace = import ./workspace args;
|
||||
workspace-build-rs = import ./workspace-build-rs args;
|
||||
workspace-patched = import ./workspace-patched args;
|
||||
|
|
8
test/fast/symlinks/default.nix
Normal file
8
test/fast/symlinks/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ naersk, pkgs, ... }: {
|
||||
default = naersk.buildPackage {
|
||||
src = pkgs.symlinkJoin {
|
||||
name = "src";
|
||||
paths = [ ./fixtures ];
|
||||
};
|
||||
};
|
||||
}
|
7
test/fast/symlinks/fixtures/Cargo.lock
generated
Normal file
7
test/fast/symlinks/fixtures/Cargo.lock
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "app"
|
||||
version = "0.1.0"
|
4
test/fast/symlinks/fixtures/Cargo.toml
Normal file
4
test/fast/symlinks/fixtures/Cargo.toml
Normal file
|
@ -0,0 +1,4 @@
|
|||
[package]
|
||||
name = "app"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
3
test/fast/symlinks/fixtures/src/main.rs
Normal file
3
test/fast/symlinks/fixtures/src/main.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
Loading…
Reference in a new issue