mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 20:20:58 +01:00
First commit
This commit is contained in:
parent
1a793c60ce
commit
b712f0f019
7 changed files with 164 additions and 13 deletions
|
|
@ -65,10 +65,10 @@ void throwBadDrv(ATerm t)
|
|||
Derivation parseDerivation(ATerm t)
|
||||
{
|
||||
Derivation drv;
|
||||
ATermList outs, inDrvs, inSrcs, args, bnds;
|
||||
ATermList outs, stateOuts, inDrvs, inSrcs, args, bnds;
|
||||
ATerm builder, platform;
|
||||
|
||||
if (!matchDerive(t, outs, inDrvs, inSrcs, platform, builder, args, bnds))
|
||||
if (!matchDerive(t, outs, stateOuts, inDrvs, inSrcs, platform, builder, args, bnds))
|
||||
throwBadDrv(t);
|
||||
|
||||
for (ATermIterator i(outs); i; ++i) {
|
||||
|
|
@ -129,6 +129,15 @@ ATerm unparseDerivation(const Derivation & drv)
|
|||
toATerm(i->second.hashAlgo),
|
||||
toATerm(i->second.hash)));
|
||||
|
||||
ATermList stateOutputs = ATempty;
|
||||
for (DerivationStateOutputs::const_reverse_iterator i = drv.stateOutputs.rbegin(); i != drv.stateOutputs.rend(); ++i)
|
||||
stateOutputs = ATinsert(stateOutputs,
|
||||
makeDerivationOutput(
|
||||
toATerm(i->first),
|
||||
toATerm(i->second.statepath),
|
||||
toATerm(i->second.hashAlgo),
|
||||
toATerm(i->second.hash)));
|
||||
|
||||
ATermList inDrvs = ATempty;
|
||||
for (DerivationInputs::const_reverse_iterator i = drv.inputDrvs.rbegin();
|
||||
i != drv.inputDrvs.rend(); ++i)
|
||||
|
|
@ -152,6 +161,7 @@ ATerm unparseDerivation(const Derivation & drv)
|
|||
|
||||
return makeDerive(
|
||||
outputs,
|
||||
stateOutputs,
|
||||
inDrvs,
|
||||
toATermList(drv.inputSrcs),
|
||||
toATerm(drv.platform),
|
||||
|
|
|
|||
|
|
@ -33,17 +33,44 @@ struct DerivationOutput
|
|||
}
|
||||
};
|
||||
|
||||
struct DerivationStateOutput
|
||||
{
|
||||
Path statepath;
|
||||
string hashAlgo;
|
||||
string hash;
|
||||
bool enabled;
|
||||
string shared;
|
||||
string synchronization;
|
||||
StringSet dirs;
|
||||
DerivationStateOutput()
|
||||
{
|
||||
}
|
||||
DerivationStateOutput(Path statepath, string hashAlgo, string hash, bool enabled, string shared, string synchronization, StringSet dirs)
|
||||
{
|
||||
this->statepath = statepath;
|
||||
this->hashAlgo = hashAlgo;
|
||||
this->hash = hash;
|
||||
this->enabled = enabled;
|
||||
this->shared = shared;
|
||||
this->synchronization = synchronization;
|
||||
this->dirs = dirs;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef std::map<string, DerivationOutput> DerivationOutputs;
|
||||
typedef std::map<string, DerivationStateOutput> DerivationStateOutputs;
|
||||
|
||||
/* For inputs that are sub-derivations, we specify exactly which
|
||||
output IDs we are interested in. */
|
||||
typedef std::map<Path, StringSet> DerivationInputs;
|
||||
|
||||
typedef std::map<string, string> StringPairs;
|
||||
|
||||
struct Derivation
|
||||
{
|
||||
DerivationOutputs outputs; /* keyed on symbolic IDs */
|
||||
DerivationStateOutputs stateOutputs; /* */
|
||||
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