diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-01-20T14·10+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-01-20T14·10+0000 |
commit | 05f0430de1d8eeae222a1306d4d0f7f407c8ce7d (patch) | |
tree | 2bd947476885025bd52f61430c269398008fb093 /src/libstore/build.cc | |
parent | 6ff48e77f6da3c523a29c254b315d83e310290b3 (diff) |
* Another change to low-level derivations. The last one this year, I
promise :-) This allows derivations to specify on *what* output paths of input derivations they are dependent. This helps to prevent unnecessary downloads. For instance, a build might be dependent on the `devel' and `lib' outputs of some library component, but not the `docs' output.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r-- | src/libstore/build.cc | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 60e72c9dc195..9e984a5b3fd9 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -448,9 +448,10 @@ void DerivationGoal::haveStoreExpr() } /* Inputs must be built before we can build this goal. */ - for (PathSet::iterator i = drv.inputDrvs.begin(); + /* !!! but if possible, only install the paths that we need */ + for (DerivationInputs::iterator i = drv.inputDrvs.begin(); i != drv.inputDrvs.end(); ++i) - addWaitee(worker.makeDerivationGoal(*i)); + addWaitee(worker.makeDerivationGoal(i->first)); for (PathSet::iterator i = drv.inputSrcs.begin(); i != drv.inputSrcs.end(); ++i) @@ -812,18 +813,23 @@ bool DerivationGoal::prepareBuild() /* Determine the full set of input paths. */ /* First, the input derivations. */ - for (PathSet::iterator i = drv.inputDrvs.begin(); + for (DerivationInputs::iterator i = drv.inputDrvs.begin(); i != drv.inputDrvs.end(); ++i) { - /* Add all the output closures of the input derivation `*i' as - input paths. !!! there should be a way to indicate - specific outputs. */ + /* Add the relevant output closures of the input derivation + `*i' as input paths. Only add the closures of output paths + that are specified as inputs. */ /* !!! is `*i' present? */ - assert(isValidPath(*i)); - Derivation inDrv = derivationFromPath(*i); - for (DerivationOutputs::iterator j = inDrv.outputs.begin(); - j != inDrv.outputs.end(); ++j) - computeFSClosure(j->second.path, inputPaths); + assert(isValidPath(i->first)); + Derivation inDrv = derivationFromPath(i->first); + for (StringSet::iterator j = i->second.begin(); + j != i->second.begin(); ++j) + if (inDrv.outputs.find(*j) != inDrv.outputs.end()) + computeFSClosure(inDrv.outputs[*j].path, inputPaths); + else + throw Error( + format("derivation `%1%' requires non-existent output `%2%' from input derivation `%3%'") + % drvPath % *j % i->first); } for (PathSet::iterator i = inputPaths.begin(); i != inputPaths.end(); ++i) |