1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 04:00:59 +01:00
This commit is contained in:
Wouter den Breejen 2007-09-17 15:38:13 +00:00
parent e80c7bda4c
commit 315cd18337
5 changed files with 31 additions and 6 deletions

View file

@ -340,7 +340,7 @@ static Hash hashDerivationModulo(EvalState & state, Derivation drv)
* If this drv doesnt have runtime paramters: The state indentifier and thus statepath may change, and thus the componentPath changes since it is build with another identifier * If this drv doesnt have runtime paramters: The state indentifier and thus statepath may change, and thus the componentPath changes since it is build with another identifier
* In both cases: Other runtime state parameters like stateDirs, synchronisation and shareState never change the out or statepath so always need to be out of the hash * In both cases: Other runtime state parameters like stateDirs, synchronisation and shareState never change the out or statepath so always need to be out of the hash
*/ */
if(drv.stateOutputs.size() != 0){ if(isStateDrv(drv)){
if(drv.stateOutputs.size() != 1) if(drv.stateOutputs.size() != 1)
throw EvalError(format("There are more then one stateOutputs in the derviation.....")); throw EvalError(format("There are more then one stateOutputs in the derviation....."));
@ -655,7 +655,14 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
ATermMap outAttrs(2); ATermMap outAttrs(2);
outAttrs.set(toATerm("outPath"), makeAttrRHS(makeStr(outPath, singleton<PathSet>(drvPath)), makeNoPos())); outAttrs.set(toATerm("outPath"), makeAttrRHS(makeStr(outPath, singleton<PathSet>(drvPath)), makeNoPos()));
outAttrs.set(toATerm("drvPath"), makeAttrRHS(makeStr(drvPath, singleton<PathSet>(drvPath)), makeNoPos())); outAttrs.set(toATerm("drvPath"), makeAttrRHS(makeStr(drvPath, singleton<PathSet>(drvPath)), makeNoPos()));
if(enableState && !disableState)
/* TODO !!!!!!!!!!!!!!!!!!!! Recheck this !!!!!!!!!!!!!!!!!!!!
* We now always set the statePath since someone might 'convert' and old non-state expression into a state expression like this:
* let oldDrv = import ../../applications/networking/mailreaders/thunderbird-2.x;
* newDrv = stdenv.mkDerivation( oldDrv { ... } // { name = "x-state-v"; stateDirs = [ ... ]; } );
* in newDrv
*/
//if(enableState && !disableState)
outAttrs.set(toATerm("statePath"), makeAttrRHS(makeStr(stateOutPath, singleton<PathSet>(drvPath)), makeNoPos())); outAttrs.set(toATerm("statePath"), makeAttrRHS(makeStr(stateOutPath, singleton<PathSet>(drvPath)), makeNoPos()));
return makeAttrs(outAttrs); return makeAttrs(outAttrs);

View file

@ -728,8 +728,10 @@ PathSet mergeNewDerivationIntoListTxn(const Transaction & txn, const Path & stor
void addStateDeriver(const Transaction & txn, const Path & storePath, const Path & deriver) void addStateDeriver(const Transaction & txn, const Path & storePath, const Path & deriver)
{ {
assertStorePath(storePath); assertStorePath(storePath);
if (deriver == "") return; if (deriver == "")
return;
assertStorePath(deriver); assertStorePath(deriver);
if (!isRealisablePath(txn, storePath)) if (!isRealisablePath(txn, storePath))
throw Error(format("path `%1%' is not valid") % storePath); throw Error(format("path `%1%' is not valid") % storePath);

View file

@ -143,6 +143,12 @@ void checkStatePath(const Derivation & drv)
string componentHash = drv.stateOutputs.find("state")->second.componentHash; string componentHash = drv.stateOutputs.find("state")->second.componentHash;
string suffix = drv.env.find("name")->second; string suffix = drv.env.find("name")->second;
string stateIdentifier = drv.stateOutputs.find("state")->second.stateIdentifier; string stateIdentifier = drv.stateOutputs.find("state")->second.stateIdentifier;
//TODO Name check
Path calculatedPath = makeStatePath(componentHash, suffix, stateIdentifier); //TODO INCLUDE USER !!!!!!!!!!!! Path calculatedPath = makeStatePath(componentHash, suffix, stateIdentifier); //TODO INCLUDE USER !!!!!!!!!!!!
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! calculatedPath IS NOT CORRECT ANYMORE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! calculatedPath IS NOT CORRECT ANYMORE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

View file

@ -24,7 +24,7 @@ typedef enum {
wopQueryStateReferrers, wopQueryStateReferrers,
wopAddToStore, wopAddToStore,
wopAddTextToStore, wopAddTextToStore,
wopBuildDerivations, //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! HANGS SOMETIMES !!!!! wopBuildDerivations, //14 TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! HANGS SOMETIMES !!!!!
wopEnsurePath, wopEnsurePath,
wopAddTempRoot, wopAddTempRoot,
wopAddIndirectRoot, wopAddIndirectRoot,

View file

@ -564,10 +564,15 @@ static void installDerivations(Globals & globals,
//if it doesnt need to share state with some other component //if it doesnt need to share state with some other component
//&& the identifiers are equal //&& the identifiers are equal
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//TODO && (the users are equal || OR SHARED BETWEEN USERS)
//TODO
if( newSharedState == "" if( newSharedState == ""
&& &&
(oldStateIdentifier == newStateIdentifier (oldStateIdentifier == newStateIdentifier
|| (oldStateIdentifier == "__EMTPY__" && newStateIdentifier == "")) || (oldStateIdentifier == "__EMTPY__" && newStateIdentifier == ""))
){ ){
string oldStatePath; string oldStatePath;
@ -604,9 +609,13 @@ static void installDerivations(Globals & globals,
return; return;
} }
printMsg(lvlError, format("DONE!!!!!!!!"));
createUserEnv(globals.state, allElems, createUserEnv(globals.state, allElems,
profile, globals.keepDerivations); profile, globals.keepDerivations);
printMsg(lvlError, format("DONE!!!!!!!!"));
//After all components have been built succesfully, share their state paths with the old ones //After all components have been built succesfully, share their state paths with the old ones
for (StringPairs::iterator i = toBeShared.begin(); i != toBeShared.end(); ++i){ for (StringPairs::iterator i = toBeShared.begin(); i != toBeShared.end(); ++i){
@ -619,6 +628,7 @@ static void installDerivations(Globals & globals,
store->setSharedState(i->first, i->second); store->setSharedState(i->first, i->second);
} }
//Let the stateDirs in /nix/state point to the solidStateDependencies //Let the stateDirs in /nix/state point to the solidStateDependencies
for (StringPairs::iterator i = externalStates.begin(); i != externalStates.end(); ++i){ for (StringPairs::iterator i = externalStates.begin(); i != externalStates.end(); ++i){