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-store/nix-store.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/nix-store/nix-store.cc') diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index c182dbe49c..d7b998faeb 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -64,15 +64,19 @@ static PathSet realisePath(const Path & path) if (isDerivation(path)) { store->buildPaths(singleton(path)); Derivation drv = derivationFromPath(*store, path); + rootNr++; PathSet outputs; foreach (DerivationOutputs::iterator, i, drv.outputs) { Path outPath = i->second.path; if (gcRoot == "") printGCWarning(); - else - outPath = addPermRoot(*store, outPath, - makeRootName(gcRoot, rootNr), indirectRoot); + else { + Path rootName = gcRoot; + if (rootNr > 1) rootName += "-" + int2String(rootNr); + if (i->first != "out") rootName += "-" + i->first; + outPath = addPermRoot(*store, outPath, rootName, indirectRoot); + } outputs.insert(outPath); } return outputs; -- cgit 1.4.1