about summary refs log tree commit diff
path: root/src/libstore/derivations.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-11-26T16·15+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-11-26T16·15+0100
commit8d8d47abd2a66898aa5d8999fcd75b29991e529d (patch)
tree01ff64266efd7b5bf00f9e763b43f0b0fe469219 /src/libstore/derivations.cc
parent46a369ad9558939bc2c6ee588df483ca503bbb5a (diff)
Only substitute wanted outputs of a derivation
If a derivation has multiple outputs, then we only want to download
those outputs that are actuallty needed.  So if we do "nix-build -A
openssl.man", then only the "man" output should be downloaded.
Likewise if another package depends on ${openssl.man}.

The tricky part is that different derivations can depend on different
outputs of a given derivation, so we may need to restart the
corresponding derivation goal if that happens.
Diffstat (limited to 'src/libstore/derivations.cc')
-rw-r--r--src/libstore/derivations.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc
index 1551ae28a81a..d91e42784ca5 100644
--- a/src/libstore/derivations.cc
+++ b/src/libstore/derivations.cc
@@ -261,7 +261,7 @@ DrvPathWithOutputs parseDrvPathWithOutputs(const string & s)
 }
 
 
-Path makeDrvPathWithOutputs(const Path & drvPath, std::set<string> outputs)
+Path makeDrvPathWithOutputs(const Path & drvPath, const std::set<string> & outputs)
 {
     return outputs.empty()
         ? drvPath
@@ -269,4 +269,10 @@ Path makeDrvPathWithOutputs(const Path & drvPath, std::set<string> outputs)
 }
 
 
+bool wantOutput(const string & output, const std::set<string> & wanted)
+{
+    return wanted.empty() || wanted.find(output) != wanted.end();
+}
+
+
 }