mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 04:00:59 +01:00
Small fix
This commit is contained in:
parent
5cac336820
commit
802d7f40bd
6 changed files with 26 additions and 12 deletions
|
|
@ -389,6 +389,7 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
||||||
string shareState = "none";
|
string shareState = "none";
|
||||||
string syncState = "all";
|
string syncState = "all";
|
||||||
string stateIndentifier = "";
|
string stateIndentifier = "";
|
||||||
|
bool createDirsBeforeInstall = false;
|
||||||
|
|
||||||
for (ATermMap::const_iterator i = attrs.begin(); i != attrs.end(); ++i) {
|
for (ATermMap::const_iterator i = attrs.begin(); i != attrs.end(); ++i) {
|
||||||
string key = aterm2String(i->key);
|
string key = aterm2String(i->key);
|
||||||
|
|
@ -462,7 +463,8 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
||||||
else if(key == "synchronization") { string s = coerceToString(state, value, context, true); syncState = s; }
|
else if(key == "synchronization") { string s = coerceToString(state, value, context, true); syncState = s; }
|
||||||
else if(key == "enableState") { bool b = evalBool(state, value); disableState = true; }
|
else if(key == "enableState") { bool b = evalBool(state, value); disableState = true; }
|
||||||
else if(key == "indentifier"){ string s = coerceToString(state, value, context, true); stateIndentifier = s; }
|
else if(key == "indentifier"){ string s = coerceToString(state, value, context, true); stateIndentifier = s; }
|
||||||
|
else if(key == "createDirsBeforeInstall"){ bool b = evalBool(state, value); createDirsBeforeInstall = b; }
|
||||||
|
|
||||||
/* All other attributes are passed to the builder through
|
/* All other attributes are passed to the builder through
|
||||||
the environment. */
|
the environment. */
|
||||||
else {
|
else {
|
||||||
|
|
@ -559,10 +561,10 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
||||||
Path stateOutPath = makeStatePath("stateOutput:statepath", statehash, drvName); //
|
Path stateOutPath = makeStatePath("stateOutput:statepath", statehash, drvName); //
|
||||||
|
|
||||||
drv.env["statepath"] = stateOutPath;
|
drv.env["statepath"] = stateOutPath;
|
||||||
string enableStateS = "false";
|
string enableStateS = bool2string(enableState && disableState);
|
||||||
if(enableState && disableState == false)
|
string createDirsBeforeInstallS = bool2string(createDirsBeforeInstall);
|
||||||
enableStateS = "true";
|
|
||||||
drv.stateOutputs["state"] = DerivationStateOutput(stateOutPath, outputHashAlgo, outputHash, enableStateS, shareState, syncState);
|
drv.stateOutputs["state"] = DerivationStateOutput(stateOutPath, outputHashAlgo, outputHash, enableStateS, shareState, syncState, createDirsBeforeInstallS);
|
||||||
|
|
||||||
/* Write the resulting term into the Nix store directory. */
|
/* Write the resulting term into the Nix store directory. */
|
||||||
Path drvPath = writeDerivation(drv, drvName);
|
Path drvPath = writeDerivation(drv, drvName);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ Derive | ATermList ATermList ATermList ATermList ATermList string string ATermLi
|
||||||
| string string | ATerm | EnvBinding |
|
| string string | ATerm | EnvBinding |
|
||||||
| string ATermList | ATerm | DerivationInput |
|
| string ATermList | ATerm | DerivationInput |
|
||||||
| string string string string | ATerm | DerivationOutput |
|
| string string string string | ATerm | DerivationOutput |
|
||||||
| string string string string string string string | ATerm | DerivationStateOutput |
|
| string string string string string string string string | ATerm | DerivationStateOutput |
|
||||||
| string string string | ATerm | DerivationStateOutputDir |
|
| string string string | ATerm | DerivationStateOutputDir |
|
||||||
|
|
||||||
Closure | ATermList ATermList | ATerm | OldClosure |
|
Closure | ATermList ATermList | ATerm | OldClosure |
|
||||||
|
|
|
||||||
|
|
@ -85,8 +85,8 @@ Derivation parseDerivation(ATerm t)
|
||||||
|
|
||||||
//parse state part
|
//parse state part
|
||||||
for (ATermIterator i(stateOuts); i; ++i) {
|
for (ATermIterator i(stateOuts); i; ++i) {
|
||||||
ATerm id, statepath, hashAlgo, hash, enabled, shared, synchronization;
|
ATerm id, statepath, hashAlgo, hash, enabled, shared, synchronization, createDirsBeforeInstall;
|
||||||
if (!matchDerivationStateOutput(*i, id, statepath, hashAlgo, hash, enabled, shared, synchronization))
|
if (!matchDerivationStateOutput(*i, id, statepath, hashAlgo, hash, enabled, shared, synchronization, createDirsBeforeInstall))
|
||||||
throwBadDrv(t);
|
throwBadDrv(t);
|
||||||
DerivationStateOutput stateOut;
|
DerivationStateOutput stateOut;
|
||||||
stateOut.statepath = aterm2String(statepath);
|
stateOut.statepath = aterm2String(statepath);
|
||||||
|
|
@ -96,6 +96,7 @@ Derivation parseDerivation(ATerm t)
|
||||||
stateOut.enabled = aterm2String(enabled);
|
stateOut.enabled = aterm2String(enabled);
|
||||||
stateOut.shared = aterm2String(shared);
|
stateOut.shared = aterm2String(shared);
|
||||||
stateOut.synchronization = aterm2String(synchronization);
|
stateOut.synchronization = aterm2String(synchronization);
|
||||||
|
stateOut.createDirsBeforeInstall = aterm2String(createDirsBeforeInstall);
|
||||||
drv.stateOutputs[aterm2String(id)] = stateOut;
|
drv.stateOutputs[aterm2String(id)] = stateOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -168,7 +169,8 @@ ATerm unparseDerivation(const Derivation & drv)
|
||||||
toATerm(i->second.hash),
|
toATerm(i->second.hash),
|
||||||
toATerm(i->second.enabled),
|
toATerm(i->second.enabled),
|
||||||
toATerm(i->second.shared),
|
toATerm(i->second.shared),
|
||||||
toATerm(i->second.synchronization)
|
toATerm(i->second.synchronization),
|
||||||
|
toATerm(i->second.createDirsBeforeInstall)
|
||||||
));
|
));
|
||||||
|
|
||||||
ATermList stateOutputDirs = ATempty;
|
ATermList stateOutputDirs = ATempty;
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,11 @@ struct DerivationStateOutput
|
||||||
string enabled;
|
string enabled;
|
||||||
string shared;
|
string shared;
|
||||||
string synchronization;
|
string synchronization;
|
||||||
string createStateDirsBeforeInstall;
|
string createDirsBeforeInstall;
|
||||||
DerivationStateOutput()
|
DerivationStateOutput()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
DerivationStateOutput(Path statepath, string hashAlgo, string hash, string enabled, string shared, string synchronization, string createStateDirsBeforeInstall)
|
DerivationStateOutput(Path statepath, string hashAlgo, string hash, string enabled, string shared, string synchronization, string createDirsBeforeInstall)
|
||||||
{
|
{
|
||||||
this->statepath = statepath;
|
this->statepath = statepath;
|
||||||
this->hashAlgo = hashAlgo;
|
this->hashAlgo = hashAlgo;
|
||||||
|
|
@ -53,7 +53,7 @@ struct DerivationStateOutput
|
||||||
this->enabled = enabled;
|
this->enabled = enabled;
|
||||||
this->shared = shared;
|
this->shared = shared;
|
||||||
this->synchronization = synchronization;
|
this->synchronization = synchronization;
|
||||||
this->createStateDirsBeforeInstall = createStateDirsBeforeInstall;
|
this->createDirsBeforeInstall = createDirsBeforeInstall;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -966,5 +966,13 @@ bool string2Int(const string & s, int & n)
|
||||||
return str && str.get() == EOF;
|
return str && str.get() == EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string bool2string(const bool b)
|
||||||
|
{
|
||||||
|
if(b == true)
|
||||||
|
return "true";
|
||||||
|
else
|
||||||
|
return "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -279,6 +279,8 @@ bool statusOk(int status);
|
||||||
string int2String(int n);
|
string int2String(int n);
|
||||||
bool string2Int(const string & s, int & n);
|
bool string2Int(const string & s, int & n);
|
||||||
|
|
||||||
|
/* Parse a bool to a string */
|
||||||
|
string bool2string(const bool b);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue