mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 04:00:59 +01:00
nixstate is now backwards comptible (because of some ugly hack ..)
This commit is contained in:
parent
09b8b7efbc
commit
73995157e3
2 changed files with 11 additions and 10 deletions
|
|
@ -384,8 +384,8 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
||||||
bool outputHashRecursive = false;
|
bool outputHashRecursive = false;
|
||||||
|
|
||||||
//state vars
|
//state vars
|
||||||
bool enableState = false;
|
bool enableState = false; //We dont do state by default, but if a user defines stateDirs for example, than this becomes true.
|
||||||
bool disableState = false;
|
bool disableState = false; //Becomes true if the user explicitly says: no state
|
||||||
string shareState = "none";
|
string shareState = "none";
|
||||||
string syncState = "all";
|
string syncState = "all";
|
||||||
string stateIndentifier = "";
|
string stateIndentifier = "";
|
||||||
|
|
@ -417,7 +417,7 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//state variables
|
//Add specific state variables
|
||||||
else if(key == "stateDirs") {
|
else if(key == "stateDirs") {
|
||||||
|
|
||||||
enableState = true;
|
enableState = true;
|
||||||
|
|
@ -454,14 +454,12 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
||||||
}
|
}
|
||||||
|
|
||||||
drv.stateOutputDirs[dir.path] = dir;
|
drv.stateOutputDirs[dir.path] = dir;
|
||||||
//Expr e = queryAttr(v, "dir");
|
|
||||||
//printMsg(lvlError, format("DIRS3 `%1%'") % e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(key == "shareState") { string s = coerceToString(state, value, context, true); shareState = s; }
|
else if(key == "shareState") { string s = coerceToString(state, value, context, true); shareState = s; }
|
||||||
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 == "disableState") { bool b = evalBool(state, value); disableState = b; }
|
||||||
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; }
|
else if(key == "createDirsBeforeInstall"){ bool b = evalBool(state, value); createDirsBeforeInstall = b; }
|
||||||
|
|
||||||
|
|
@ -489,7 +487,6 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
||||||
% drvName % showPos(posDrvName));
|
% drvName % showPos(posDrvName));
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Everything in the context of the strings in the derivation
|
/* Everything in the context of the strings in the derivation
|
||||||
|
|
@ -555,15 +552,16 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
||||||
drv.outputs["out"] = DerivationOutput(outPath, outputHashAlgo, outputHash);
|
drv.outputs["out"] = DerivationOutput(outPath, outputHashAlgo, outputHash);
|
||||||
|
|
||||||
//only add state when we have to to keep compitibilty with the 'old' format.
|
//only add state when we have to to keep compitibilty with the 'old' format.
|
||||||
if(enableState){
|
//We add state when it's enbaled by the keywords, and NOT disabled by the user
|
||||||
|
if(enableState && !disableState){
|
||||||
/* Add the state path based on the outPath */
|
/* Add the state path based on the outPath */
|
||||||
string callingUser = "wouterdb"; //TODO: Change into variable
|
string callingUser = "wouterdb"; //TODO: Change into variable
|
||||||
string componentHash = printHash(hashDerivationModulo(state, drv)); //hash of the component path
|
string componentHash = printHash(hashDerivationModulo(state, drv)); //hash of the component path
|
||||||
Hash statehash = hashString(htSHA256, stateIndentifier + callingUser + componentHash); //hash of the state path
|
Hash statehash = hashString(htSHA256, stateIndentifier + callingUser + componentHash); //hash of the state path
|
||||||
Path stateOutPath = makeStatePath("stateOutput:statepath", statehash, drvName); //
|
Path stateOutPath = makeStatePath("stateOutput:statepath", statehash, drvName); //State path
|
||||||
|
|
||||||
drv.env["statepath"] = stateOutPath;
|
drv.env["statepath"] = stateOutPath;
|
||||||
string enableStateS = bool2string(enableState && disableState);
|
string enableStateS = bool2string("true");
|
||||||
string createDirsBeforeInstallS = bool2string(createDirsBeforeInstall);
|
string createDirsBeforeInstallS = bool2string(createDirsBeforeInstall);
|
||||||
|
|
||||||
drv.stateOutputs["state"] = DerivationStateOutput(stateOutPath, outputHashAlgo, outputHash, enableStateS, shareState, syncState, createDirsBeforeInstallS);
|
drv.stateOutputs["state"] = DerivationStateOutput(stateOutPath, outputHashAlgo, outputHash, enableStateS, shareState, syncState, createDirsBeforeInstallS);
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@ Derive | ATermList ATermList ATermList ATermList ATermList string string ATermLi
|
||||||
#We use DeriveWithOutState to create derivations that dont use state, and thus dont have the stateDerivationStateOutput and DerivationStateOutputDir in their derivation
|
#We use DeriveWithOutState to create derivations that dont use state, and thus dont have the stateDerivationStateOutput and DerivationStateOutputDir in their derivation
|
||||||
#Ive put this in because eelco requested it, and its easy to stay backwards compatible, but ultimately I thinks that it should be removed to prevent confusion & duplication
|
#Ive put this in because eelco requested it, and its easy to stay backwards compatible, but ultimately I thinks that it should be removed to prevent confusion & duplication
|
||||||
|
|
||||||
|
#!!!!!!!!Change the string "DeriveWithOutState" in derivations.ast-def.cc to "Derive"
|
||||||
|
#TODO, make this automatic..
|
||||||
|
|
||||||
DeriveWithOutState | ATermList ATermList ATermList string string ATermList ATermList | ATerm |
|
DeriveWithOutState | ATermList ATermList ATermList string string ATermList ATermList | ATerm |
|
||||||
| string string | ATerm | EnvBindingWithOutState |
|
| string string | ATerm | EnvBindingWithOutState |
|
||||||
| string ATermList | ATerm | DerivationInputWithOutState |
|
| string ATermList | ATerm | DerivationInputWithOutState |
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue