Skip to content

Commit 74ca354

Browse files
committed
[V2][bugfix] create missing dir in preInstallLinks script
Fixes the node-modules-attributes-are-passed-through unit test for the lockfiles v2 implementation. The directories only containing symlinked are getting deleted during the tarball unpack process. In that particular test case, we symlink cwebp to `./vendor/cwebp`. `./vendor` gets deleted after unpackaging, meaning the build fails when trying to symlink nixpkgs's cwebp to `./vendor/cwebp`: we need to re-create the vendor directory first.
1 parent d935c31 commit 74ca354

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal-v2.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,15 @@ rec {
9393
packTgz = nodejs: pname: version: src: stdenv.mkDerivation (
9494
let
9595
preInstallLinks = writeShellScript "preInstallLinks" ''
96+
# preinstalled.links is a space separated text file in the
97+
# form of:
98+
# $symlink-target $symlink-location
9699
for link in "$(<preinstalled.links)"; do
97100
if [ ! -z "$link" ]; then
98-
ln -sf $link
101+
target="$(echo "$link" | cut -d ' ' -f 1)"
102+
location="$(echo "$link" | cut -d ' ' -f 2)"
103+
mkdir -p "$(dirname "$location")"
104+
ln -sf "$target" "$location"
99105
fi
100106
done
101107
'';

0 commit comments

Comments
 (0)