mirror of
https://github.com/NixOS/nix
synced 2025-06-29 06:21:14 +02:00
* Maintain the references/referers relation also for derivations.
This simplifies garbage collection and `nix-store --query --requisites' since we no longer need to treat derivations specially. * Better maintaining of the invariants, e.g., setReferences() can only be called on a valid/substitutable path.
This commit is contained in:
parent
2a2756b856
commit
a24b78e9f1
8 changed files with 84 additions and 82 deletions
|
@ -14,8 +14,16 @@ Hash hashTerm(ATerm t)
|
|||
|
||||
Path writeDerivation(const Derivation & drv, const string & name)
|
||||
{
|
||||
PathSet references;
|
||||
references.insert(drv.inputSrcs.begin(), drv.inputSrcs.end());
|
||||
for (DerivationInputs::const_iterator i = drv.inputDrvs.begin();
|
||||
i != drv.inputDrvs.end(); ++i)
|
||||
references.insert(i->first);
|
||||
/* Note that the outputs of a derivation are *not* references
|
||||
(that can be missing (of course) and should not necessarily be
|
||||
held during a garbage collection). */
|
||||
return addTextToStore(name + drvExtension,
|
||||
atPrint(unparseDerivation(drv)));
|
||||
atPrint(unparseDerivation(drv)), references);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue