diff options
author | Michael Raskin <7c6f434c@mail.ru> | 2019-02-10 14:43:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-10 14:43:22 +0000 |
commit | f4a8ac84fc85e215317e65a912fed7058d84f8b7 (patch) | |
tree | d59e1e0c2a26859c147ad278d00c732c1bc26e82 | |
parent | c40f2114992f7387013a6113ebfd99ae63ec4f91 (diff) | |
parent | f07c113ddc44c474cc16aa264e6731c872f26fad (diff) | |
download | nixlib-f4a8ac84fc85e215317e65a912fed7058d84f8b7.tar nixlib-f4a8ac84fc85e215317e65a912fed7058d84f8b7.tar.gz nixlib-f4a8ac84fc85e215317e65a912fed7058d84f8b7.tar.bz2 nixlib-f4a8ac84fc85e215317e65a912fed7058d84f8b7.tar.lz nixlib-f4a8ac84fc85e215317e65a912fed7058d84f8b7.tar.xz nixlib-f4a8ac84fc85e215317e65a912fed7058d84f8b7.tar.zst nixlib-f4a8ac84fc85e215317e65a912fed7058d84f8b7.zip |
Merge pull request #55003 from volth/patch-303
linkFarm: hacky quoting -> escapeShellArg
-rw-r--r-- | pkgs/build-support/trivial-builders.nix | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index 7543433640a3..454ef8912b3b 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -258,15 +258,17 @@ rec { * Example: * * # Symlinks hello path in store to current $out/hello - * linkFarm "hello" entries = [ { name = "hello"; path = pkgs.hello; } ]; + * linkFarm "hello" [ { name = "hello"; path = pkgs.hello; } ]; * */ - linkFarm = name: entries: runCommand name { preferLocalBuild = true; } - ("mkdir -p $out; cd $out; \n" + - (lib.concatMapStrings (x: '' - mkdir -p "$(dirname '${x.name}')" - ln -s '${x.path}' '${x.name}' - '') entries)); + linkFarm = name: entries: runCommand name { preferLocalBuild = true; allowSubstitutes = false; } + ''mkdir -p $out + cd $out + ${lib.concatMapStrings (x: '' + mkdir -p "$(dirname ${lib.escapeShellArg x.name})" + ln -s ${lib.escapeShellArg x.path} ${lib.escapeShellArg x.name} + '') entries} + ''; /* Print an error message if the file with the specified name and |