mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-14 02:06:16 +02:00
* Simplify the context handling logic.
This commit is contained in:
parent
4be5a2c096
commit
b19a0f63db
1 changed files with 13 additions and 24 deletions
|
@ -347,8 +347,6 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v)
|
||||||
derivation. */
|
derivation. */
|
||||||
foreach (PathSet::iterator, i, context) {
|
foreach (PathSet::iterator, i, context) {
|
||||||
Path path = *i;
|
Path path = *i;
|
||||||
bool explicitlyPassed = false;
|
|
||||||
string output = "out";
|
|
||||||
|
|
||||||
/* Paths marked with `=' denote that the path of a derivation
|
/* Paths marked with `=' denote that the path of a derivation
|
||||||
is explicitly passed to the builder. Since that allows the
|
is explicitly passed to the builder. Since that allows the
|
||||||
|
@ -358,39 +356,30 @@ static void prim_derivationStrict(EvalState & state, Value * * args, Value & v)
|
||||||
inputs to ensure that they are available when the builder
|
inputs to ensure that they are available when the builder
|
||||||
runs. */
|
runs. */
|
||||||
if (path.at(0) == '=') {
|
if (path.at(0) == '=') {
|
||||||
path = string(path, 1);
|
PathSet refs; computeFSClosure(*store, string(path, 1), refs);
|
||||||
PathSet refs; computeFSClosure(*store, path, refs);
|
|
||||||
foreach (PathSet::iterator, j, refs) {
|
foreach (PathSet::iterator, j, refs) {
|
||||||
drv.inputSrcs.insert(*j);
|
drv.inputSrcs.insert(*j);
|
||||||
if (isDerivation(*j))
|
if (isDerivation(*j))
|
||||||
drv.inputDrvs[*j] = store->queryDerivationOutputNames(*j);
|
drv.inputDrvs[*j] = store->queryDerivationOutputNames(*j);
|
||||||
}
|
}
|
||||||
explicitlyPassed = true;
|
|
||||||
} else if (path.at(0) == '!') {
|
|
||||||
size_t index;
|
|
||||||
path = string(path, 1);
|
|
||||||
index = path.find("!");
|
|
||||||
output = path.substr(0, index);
|
|
||||||
path = string(path, index + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See prim_unsafeDiscardOutputDependency. */
|
/* See prim_unsafeDiscardOutputDependency. */
|
||||||
bool useDrvAsSrc = false;
|
else if (path.at(0) == '~')
|
||||||
if (path.at(0) == '~') {
|
drv.inputSrcs.insert(string(path, 1));
|
||||||
path = string(path, 1);
|
|
||||||
useDrvAsSrc = true;
|
/* Handle derivation outputs of the form ‘!<name>!<path>’. */
|
||||||
|
else if (path.at(0) == '!') {
|
||||||
|
size_t index = path.find("!", 1);
|
||||||
|
drv.inputDrvs[string(path, index + 1)].insert(string(path, 1, index - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(isStorePath(path));
|
/* Handle derivation contexts returned by
|
||||||
|
‘builtins.storePath’. */
|
||||||
|
else if (isDerivation(path))
|
||||||
|
drv.inputDrvs[path] = store->queryDerivationOutputNames(path);
|
||||||
|
|
||||||
debug(format("derivation uses `%1%'") % path);
|
/* Otherwise it's a source file. */
|
||||||
if (!useDrvAsSrc && isDerivation(path))
|
|
||||||
if (explicitlyPassed)
|
|
||||||
drv.inputDrvs[path] = store->queryDerivationOutputNames(path);
|
|
||||||
else if (drv.inputDrvs.find(path) == drv.inputDrvs.end())
|
|
||||||
drv.inputDrvs[path] = singleton<StringSet>(output);
|
|
||||||
else
|
|
||||||
drv.inputDrvs[path].insert(output);
|
|
||||||
else
|
else
|
||||||
drv.inputSrcs.insert(path);
|
drv.inputSrcs.insert(path);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue