From 8d8d47abd2a66898aa5d8999fcd75b29991e529d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 26 Nov 2012 17:15:09 +0100 Subject: 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. --- src/libstore/derivations.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/libstore/derivations.cc') 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 outputs) +Path makeDrvPathWithOutputs(const Path & drvPath, const std::set & outputs) { return outputs.empty() ? drvPath @@ -269,4 +269,10 @@ Path makeDrvPathWithOutputs(const Path & drvPath, std::set outputs) } +bool wantOutput(const string & output, const std::set & wanted) +{ + return wanted.empty() || wanted.find(output) != wanted.end(); +} + + } -- cgit 1.4.1