about summary refs log tree commit diff
path: root/src/nix-instantiate/nix-instantiate.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-24T20·58-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-24T20·58-0400
commita9e6752bbd888ab8fbc1cda6e4d539b2858c4cef (patch)
tree6d5ac4f9e784b91fe4382293eb84684038990dc1 /src/nix-instantiate/nix-instantiate.cc
parent4aa1e5c55484ac02d28883292ee5c5806f5e4664 (diff)
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.
Diffstat (limited to 'src/nix-instantiate/nix-instantiate.cc')
-rw-r--r--src/nix-instantiate/nix-instantiate.cc8
1 files changed, 5 insertions, 3 deletions
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;
                 }
             }