forked from lix-project/lix
* Export the references graph to the build hook.
This commit is contained in:
parent
3f236f01ae
commit
0df9f08078
|
@ -806,36 +806,52 @@ DerivationGoal::HookReply DerivationGoal::tryBuildHook()
|
||||||
Path outputListFN = tmpDir + "/outputs";
|
Path outputListFN = tmpDir + "/outputs";
|
||||||
Path referencesFN = tmpDir + "/references";
|
Path referencesFN = tmpDir + "/references";
|
||||||
|
|
||||||
string s;
|
/* The `inputs' file lists all inputs that have to be copied
|
||||||
for (PathSet::iterator i = inputPaths.begin();
|
to the remote system. This unfortunately has to contain
|
||||||
i != inputPaths.end(); ++i)
|
the entire derivation closure to ensure that the validity
|
||||||
s += *i + "\n";
|
invariant holds on the remote system. (I.e., it's
|
||||||
for (DerivationInputs::iterator i = drv.inputDrvs.begin();
|
unfortunate that we have to list it since the remote system
|
||||||
i != drv.inputDrvs.end(); ++i)
|
*probably* already has it.) */
|
||||||
s += i->first + "\n";
|
PathSet allInputs;
|
||||||
writeStringToFile(inputListFN, s);
|
allInputs.insert(inputPaths.begin(), inputPaths.end());
|
||||||
|
computeFSClosure(drvPath, allInputs);
|
||||||
|
|
||||||
|
string s;
|
||||||
|
for (PathSet::iterator i = allInputs.begin();
|
||||||
|
i != allInputs.end(); ++i)
|
||||||
|
s += *i + "\n";
|
||||||
|
|
||||||
|
writeStringToFile(inputListFN, s);
|
||||||
|
|
||||||
|
/* The `outputs' file lists all outputs that have to be copied
|
||||||
|
from the remote system. */
|
||||||
s = "";
|
s = "";
|
||||||
for (DerivationOutputs::iterator i = drv.outputs.begin();
|
for (DerivationOutputs::iterator i = drv.outputs.begin();
|
||||||
i != drv.outputs.end(); ++i)
|
i != drv.outputs.end(); ++i)
|
||||||
s += i->second.path + "\n";
|
s += i->second.path + "\n";
|
||||||
writeStringToFile(outputListFN, s);
|
writeStringToFile(outputListFN, s);
|
||||||
|
|
||||||
|
/* The `references' file has exactly the format accepted by
|
||||||
|
`nix-store --register-validity'. */
|
||||||
s = "";
|
s = "";
|
||||||
for (PathSet::iterator i = inputPaths.begin();
|
for (PathSet::iterator i = allInputs.begin();
|
||||||
i != inputPaths.end(); ++i)
|
i != allInputs.end(); ++i)
|
||||||
{
|
{
|
||||||
s += *i;
|
s += *i + "\n";
|
||||||
|
|
||||||
|
Path deriver = queryDeriver(noTxn, *i);
|
||||||
|
s += deriver + "\n";
|
||||||
|
|
||||||
PathSet references;
|
PathSet references;
|
||||||
queryReferences(noTxn, *i, references);
|
queryReferences(noTxn, *i, references);
|
||||||
|
|
||||||
|
s += (format("%1%\n") % references.size()).str();
|
||||||
|
|
||||||
for (PathSet::iterator j = references.begin();
|
for (PathSet::iterator j = references.begin();
|
||||||
j != references.end(); ++j)
|
j != references.end(); ++j)
|
||||||
{
|
s += *j + "\n";
|
||||||
s += " ";
|
|
||||||
s += *j;
|
|
||||||
}
|
|
||||||
s += "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
writeStringToFile(referencesFN, s);
|
writeStringToFile(referencesFN, s);
|
||||||
|
|
||||||
/* Tell the hook to proceed. */
|
/* Tell the hook to proceed. */
|
||||||
|
|
Loading…
Reference in a new issue