nixpkgs-suyu/pkgs/build-support
Alexey Shmalko 0172558e82 buildEnv: build the whole tree of directories to pathsToLink
This patch fixes #16614 and #16741.

The first issue was caused by the fact that both `/share` and
`/share/fish/vendor_completions.d` end in the `pathsToLink`. The
`pkgs/build-support/buildenv/builder.pl` creates `/share`, then links
`/share/fish` under `/share` and then tries to create the directory
`/share/fish/vendor_completions.d` and fails because it already exists.

The simplest way to reproduce the issue is to build the next Nix
expression:

```nix
let pkgs = import <nixpkgs> { };
in pkgs.buildEnv {
  name = "buildenv-issue";

  paths = [
    pkgs.fish
    pkgs.vim
  ];

  pathsToLink = [
    "/share"
    "/share/fish/vendor_completions.d"
  ];
}
```

The second issue is more critical and was caused by the fact findFiles
doesn't recurse deep enough. It stops at first unique directory for the
package (e.g., "/share" or even "/") and later the scripts decides it
shouldn't link it as it doesn't match pathsToLink (e.g., "/share/fish"),
so the result is empty.

The test:
```nix
let pkgs = import <nixpkgs> { };
in pkgs.buildEnv {
  name = "buildenv-issue";

  paths = [
    pkgs.fish
    pkgs.vim
  ];

  pathsToLink = [
    "/share/fish/functions"
  ];
}
```

or

```nix
let pkgs = import <nixpkgs> { };
in pkgs.buildEnv {
  name = "buildenv-issue";

  paths = [
    pkgs.vim
  ];

  pathsToLink = [
    "/share"
  ];
}
```
2016-07-13 03:54:11 +03:00
..
agda agda: Remove unused/uneeded abstractions, including postprocess 2015-05-31 01:55:10 +00:00
build-dotnet-package build-dotnet-package: add optional makeWrapperArgs argument 2015-10-29 06:02:18 +03:00
build-fhs-userenv fhs-user-env: keep DBUS_SESSION_BUS_ADDRESS env 2016-06-28 23:55:43 +02:00
buildenv buildEnv: build the whole tree of directories to pathsToLink 2016-07-13 03:54:11 +03:00
builder-defs Don't fail if env-vars cannot be written to 2015-11-04 16:32:59 +01:00
cc-wrapper Revert "Merge branch 'staging'" due to glibc 2016-06-23 09:25:10 +02:00
docker no more goPackages 2016-06-09 13:08:00 +02:00
dotnetbuildhelpers Remove all-packages.nix helperFunctions dependency. 2016-03-20 16:41:20 +00:00
dotnetenv
emacs emacs: hide wrapper dependencies 2016-05-12 22:43:30 +02:00
fetchadc
fetchbower bower2nix: 2.1.0 -> 3.0.1 2016-03-28 08:23:06 +01:00
fetchbzr nix-prefetch-bzr: match path name to fetchbzr name 2015-12-19 09:32:22 -06:00
fetchcvs
fetchdarcs
fetchegg
fetchfile Update builder.sh 2015-11-25 17:14:03 +08:00
fetchgit nix-prefetch-git: unbreak JSON output 2016-07-04 14:39:47 +02:00
fetchgitlocal fetchgitlocal: be less chatty 2016-02-01 10:57:01 -08:00
fetchgitrevision
fetchhg nix-prefetch-hg: Various bash style improvements, fixes #9511 2016-02-17 00:35:30 +01:00
fetchmtn
fetchnuget fetchnuget: run fixupPhase to honor propagatedBuildInputs 2015-06-12 17:13:21 +02:00
fetchpatch fetchpatch: Allow to pass a postFetch attribute. 2015-06-23 03:35:30 +02:00
fetchsvn fetchsvn: correctly handle trailing slashes 2015-12-06 11:49:51 -06:00
fetchsvnrevision
fetchsvnssh
fetchurl fetchurl mirrors: fix gnupg URLs 2016-05-17 11:35:49 +02:00
fetchzip fetchzip: improve error message 2016-05-17 17:32:53 +01:00
gcc-cross-wrapper Revert "Merge branch 'staging'" due to glibc 2016-06-23 09:25:10 +02:00
gcc-wrapper-old gcc-wrapper-old: fix binutils and coreutils' paths 2016-04-25 14:27:51 +03:00
grsecurity grsecurity: implement a single NixOS kernel 2016-06-14 00:08:20 +02:00
icon-conv-tools icon-conv-tools: init at 0.0.0 (#13905) 2016-04-25 13:16:47 +02:00
kdewrapper
kernel makeModulesClosure: Small cleanup 2016-02-01 18:19:23 +01:00
libredirect xl2tpd: add nixos module for service 2016-06-20 21:41:59 +01:00
make-desktopitem chromium: add StartupWMClass to desktop file. Fixes #12433 2016-02-29 20:42:58 +01:00
make-startupitem
make-symlinks
mono-dll-fixer
nuke-references nuke-references: support -e option 2015-10-18 18:41:11 +03:00
ocaml Ensure that we can evaluate the platform attribute of ocaml packages. 2016-03-13 19:08:26 +00:00
release debian-build: fix checkinstall invocation (#15538) 2016-05-19 09:41:10 +01:00
rust rust: Refactoring of rust and cargo packages 2016-06-15 12:47:13 +02:00
setup-hooks patchShebangs: quote variable assignment 2016-07-09 03:05:11 +03:00
src-only
substitute doc/stdenv.xml document substitution env variables 2016-04-23 21:41:35 +02:00
substitute-files substituteAllFiles: support postInstall 2016-01-10 06:03:26 +03:00
templaterpm
upstream-updater update-walker: add a minimal description 2016-01-01 19:07:38 +01:00
vm Revert "stdenv: introduce baseHash() to replace stripHash()" 2016-06-25 14:25:58 +01:00
vsenv
build-maven.nix build-maven: use lib.importJSON 2016-02-29 13:49:29 +00:00
build-pecl.nix
replace-dependency.nix nix: Add a "dev" output 2016-04-18 21:13:18 +02:00
source-from-head-fun.nix
trivial-builders.nix Revert "Merge branch 'staging'" due to glibc 2016-06-23 09:25:10 +02:00