From 315cd183371b784c8e104f3c5f9a2a9618fe263e Mon Sep 17 00:00:00 2001 From: Wouter den Breejen Date: Mon, 17 Sep 2007 15:38:13 +0000 Subject: [PATCH] --- src/libexpr/primops.cc | 11 +++++++++-- src/libstore/local-store.cc | 4 +++- src/libstore/store-api.cc | 6 ++++++ src/libstore/worker-protocol.hh | 2 +- src/nix-env/nix-env.cc | 14 ++++++++++++-- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index fbe6f1d94..819c0eac1 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -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 * 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) 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); outAttrs.set(toATerm("outPath"), makeAttrRHS(makeStr(outPath, singleton(drvPath)), makeNoPos())); outAttrs.set(toATerm("drvPath"), makeAttrRHS(makeStr(drvPath, singleton(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(drvPath)), makeNoPos())); return makeAttrs(outAttrs); diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 77583d130..9cb64cbab 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -728,8 +728,10 @@ PathSet mergeNewDerivationIntoListTxn(const Transaction & txn, const Path & stor void addStateDeriver(const Transaction & txn, const Path & storePath, const Path & deriver) { assertStorePath(storePath); - if (deriver == "") return; + if (deriver == "") + return; assertStorePath(deriver); + if (!isRealisablePath(txn, storePath)) throw Error(format("path `%1%' is not valid") % storePath); diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 622fa2222..ebe5d36bc 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -143,6 +143,12 @@ void checkStatePath(const Derivation & drv) string componentHash = drv.stateOutputs.find("state")->second.componentHash; string suffix = drv.env.find("name")->second; string stateIdentifier = drv.stateOutputs.find("state")->second.stateIdentifier; + + + //TODO Name check + + + Path calculatedPath = makeStatePath(componentHash, suffix, stateIdentifier); //TODO INCLUDE USER !!!!!!!!!!!! //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! calculatedPath IS NOT CORRECT ANYMORE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh index a386c42ca..4499bc15c 100644 --- a/src/libstore/worker-protocol.hh +++ b/src/libstore/worker-protocol.hh @@ -24,7 +24,7 @@ typedef enum { wopQueryStateReferrers, wopAddToStore, wopAddTextToStore, - wopBuildDerivations, //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! HANGS SOMETIMES !!!!! + wopBuildDerivations, //14 TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! HANGS SOMETIMES !!!!! wopEnsurePath, wopAddTempRoot, wopAddIndirectRoot, diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index a7915b48e..0be385bbe 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -564,10 +564,15 @@ static void installDerivations(Globals & globals, //if it doesnt need to share state with some other component //&& the identifiers are equal + + //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + //TODO && (the users are equal || OR SHARED BETWEEN USERS) + //TODO if( newSharedState == "" && (oldStateIdentifier == newStateIdentifier - || (oldStateIdentifier == "__EMTPY__" && newStateIdentifier == "")) + || (oldStateIdentifier == "__EMTPY__" && newStateIdentifier == "")) + ){ string oldStatePath; @@ -604,10 +609,14 @@ static void installDerivations(Globals & globals, return; } + printMsg(lvlError, format("DONE!!!!!!!!")); + createUserEnv(globals.state, allElems, profile, globals.keepDerivations); - //After all components have been built succesfully, share their state paths with the old ones + printMsg(lvlError, format("DONE!!!!!!!!")); + + //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){ printMsg(lvlError, format("Sharing state from old <-- new component '%1%' <-- '%2%'") % i->first % i->second); @@ -618,6 +627,7 @@ static void installDerivations(Globals & globals, //Set in database store->setSharedState(i->first, i->second); } + //Let the stateDirs in /nix/state point to the solidStateDependencies for (StringPairs::iterator i = externalStates.begin(); i != externalStates.end(); ++i){