From a9e6752bbd888ab8fbc1cda6e4d539b2858c4cef Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Aug 2012 16:58:11 -0400 Subject: Include the output name in the GC root link Output names are now appended to resulting GC symlinks, e.g. by nix-build. For backwards compatibility, if the output is named "out", nothing is appended. E.g. doing "nix-build -A foo" on a derivation that produces outputs "out", "bin" and "dev" will produce symlinks "./result", "./result-bin" and "./result-dev", respectively. --- src/nix-instantiate/nix-instantiate.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/nix-instantiate') diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index d86c9fc84572..bca65d0728f5 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -64,9 +64,11 @@ void processExpr(EvalState & state, const Strings & attrPaths, Path drvPath = i->queryDrvPath(state); if (gcRoot == "") printGCWarning(); - else - drvPath = addPermRoot(*store, drvPath, - makeRootName(gcRoot, rootNr), indirectRoot); + else { + Path rootName = gcRoot; + if (++rootNr > 1) rootName += "-" + int2String(rootNr); + drvPath = addPermRoot(*store, drvPath, rootName, indirectRoot); + } std::cout << format("%1%\n") % drvPath; } } -- cgit 1.4.1