mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 20:20:58 +01:00
added state options and state locations into drv
This commit is contained in:
parent
b712f0f019
commit
4c63f18dcc
7 changed files with 120 additions and 14 deletions
|
|
@ -1,10 +1,14 @@
|
|||
init initDerivationsHelpers
|
||||
|
||||
Derive | ATermList ATermList ATermList string string ATermList ATermList | ATerm |
|
||||
#wouter added 2 ATermList
|
||||
|
||||
Derive | ATermList ATermList ATermList ATermList ATermList string string ATermList ATermList | ATerm |
|
||||
|
||||
| string string | ATerm | EnvBinding |
|
||||
| string ATermList | ATerm | DerivationInput |
|
||||
| string string string string | ATerm | DerivationOutput |
|
||||
| string string string string string string string | ATerm | DerivationStateOutput |
|
||||
| string string string string | ATerm | DerivationStateOutputDir |
|
||||
|
||||
Closure | ATermList ATermList | ATerm | OldClosure |
|
||||
| string ATermList | ATerm | OldClosureElem |
|
||||
|
|
|
|||
|
|
@ -65,10 +65,10 @@ void throwBadDrv(ATerm t)
|
|||
Derivation parseDerivation(ATerm t)
|
||||
{
|
||||
Derivation drv;
|
||||
ATermList outs, stateOuts, inDrvs, inSrcs, args, bnds;
|
||||
ATermList outs, stateOuts, stateOutDirs, inDrvs, inSrcs, args, bnds;
|
||||
ATerm builder, platform;
|
||||
|
||||
if (!matchDerive(t, outs, stateOuts, inDrvs, inSrcs, platform, builder, args, bnds))
|
||||
if (!matchDerive(t, outs, stateOuts, stateOutDirs, inDrvs, inSrcs, platform, builder, args, bnds))
|
||||
throwBadDrv(t);
|
||||
|
||||
for (ATermIterator i(outs); i; ++i) {
|
||||
|
|
@ -132,11 +132,28 @@ ATerm unparseDerivation(const Derivation & drv)
|
|||
ATermList stateOutputs = ATempty;
|
||||
for (DerivationStateOutputs::const_reverse_iterator i = drv.stateOutputs.rbegin(); i != drv.stateOutputs.rend(); ++i)
|
||||
stateOutputs = ATinsert(stateOutputs,
|
||||
makeDerivationOutput(
|
||||
makeDerivationStateOutput(
|
||||
toATerm(i->first),
|
||||
toATerm(i->second.statepath),
|
||||
toATerm(i->second.hashAlgo),
|
||||
toATerm(i->second.hash)));
|
||||
toATerm(i->second.hash),
|
||||
toATerm(i->second.enabled),
|
||||
toATerm(i->second.shared),
|
||||
toATerm(i->second.synchronization)
|
||||
));
|
||||
|
||||
ATermList stateOutputDirs = ATempty;
|
||||
for (DerivationStateOutputDirs::const_reverse_iterator i = drv.stateOutputDirs.rbegin(); i != drv.stateOutputDirs.rend(); ++i)
|
||||
stateOutputDirs = ATinsert(stateOutputDirs,
|
||||
makeDerivationStateOutputDir(
|
||||
toATerm(i->first),
|
||||
toATerm(i->second.path),
|
||||
toATerm(i->second.type),
|
||||
toATerm(i->second.interval)
|
||||
));
|
||||
|
||||
//toATermList(i->second.dirs)
|
||||
|
||||
|
||||
ATermList inDrvs = ATempty;
|
||||
for (DerivationInputs::const_reverse_iterator i = drv.inputDrvs.rbegin();
|
||||
|
|
@ -162,6 +179,7 @@ ATerm unparseDerivation(const Derivation & drv)
|
|||
return makeDerive(
|
||||
outputs,
|
||||
stateOutputs,
|
||||
stateOutputDirs,
|
||||
inDrvs,
|
||||
toATermList(drv.inputSrcs),
|
||||
toATerm(drv.platform),
|
||||
|
|
|
|||
|
|
@ -38,14 +38,13 @@ struct DerivationStateOutput
|
|||
Path statepath;
|
||||
string hashAlgo;
|
||||
string hash;
|
||||
bool enabled;
|
||||
string enabled;
|
||||
string shared;
|
||||
string synchronization;
|
||||
StringSet dirs;
|
||||
DerivationStateOutput()
|
||||
{
|
||||
}
|
||||
DerivationStateOutput(Path statepath, string hashAlgo, string hash, bool enabled, string shared, string synchronization, StringSet dirs)
|
||||
DerivationStateOutput(Path statepath, string hashAlgo, string hash, string enabled, string shared, string synchronization)
|
||||
{
|
||||
this->statepath = statepath;
|
||||
this->hashAlgo = hashAlgo;
|
||||
|
|
@ -53,14 +52,30 @@ struct DerivationStateOutput
|
|||
this->enabled = enabled;
|
||||
this->shared = shared;
|
||||
this->synchronization = synchronization;
|
||||
this->dirs = dirs;
|
||||
}
|
||||
};
|
||||
|
||||
struct DerivationStateOutputDir
|
||||
{
|
||||
string path;
|
||||
string type;
|
||||
string interval;
|
||||
DerivationStateOutputDir()
|
||||
{
|
||||
}
|
||||
DerivationStateOutputDir(string path, string type, string interval)
|
||||
{
|
||||
this->path = path;
|
||||
this->type = type;
|
||||
this->interval = interval;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef std::map<string, DerivationOutput> DerivationOutputs;
|
||||
typedef std::map<string, DerivationStateOutput> DerivationStateOutputs;
|
||||
typedef std::map<string, DerivationStateOutputDir> DerivationStateOutputDirs;
|
||||
|
||||
|
||||
/* For inputs that are sub-derivations, we specify exactly which
|
||||
output IDs we are interested in. */
|
||||
|
|
@ -71,6 +86,7 @@ struct Derivation
|
|||
{
|
||||
DerivationOutputs outputs; /* keyed on symbolic IDs */
|
||||
DerivationStateOutputs stateOutputs; /* */
|
||||
DerivationStateOutputDirs stateOutputDirs; /* */
|
||||
DerivationInputs inputDrvs; /* inputs that are sub-derivations */
|
||||
PathSet inputSrcs; /* inputs that are sources */
|
||||
string platform;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue