diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index c32f440d2..210b3e44f 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -601,7 +601,7 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args) if(enableState && !disableState){ if(runtimeStateParamters == ""){ string enableStateS = bool2string("true"); - drv.stateOutputs["state"] = DerivationStateOutput("", "", "", "", stateIdentifier, enableStateS, "", "", "", runtimeStateParamters, "", false); + drv.stateOutputs["state"] = DerivationStateOutput("", "", "", "", stateIdentifier, enableStateS, "", "", "", runtimeStateParamters, getCallingUserName(), false); } } @@ -628,8 +628,7 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args) string enableStateS = bool2string("true"); string createDirsBeforeInstallS = bool2string(createDirsBeforeInstall); - string username = getCallingUserName(); - drv.stateOutputs["state"] = DerivationStateOutput(stateOutPath, printHash(componentHash), outputHashAlgo, outputHash, stateIdentifier, enableStateS, shareState, syncState, createDirsBeforeInstallS, runtimeStateParamters, username); + drv.stateOutputs["state"] = DerivationStateOutput(stateOutPath, printHash(componentHash), outputHashAlgo, outputHash, stateIdentifier, enableStateS, shareState, syncState, createDirsBeforeInstallS, runtimeStateParamters, getCallingUserName()); for(vector::iterator i = stateDirs.begin(); i != stateDirs.end(); ++i) drv.stateOutputDirs[(*i).path] = *(i); diff --git a/src/libstore/build.cc b/src/libstore/build.cc index dec9dad5e..690e1f6df 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -775,9 +775,6 @@ void DerivationGoal::haveDerivation() /* If they are all valid, then we're done. */ if (invalidOutputs.size() == 0) { - - printMsg(lvlError, format("Check State VALIDITY BEFORE: `%1%'") % drvPath); - amDone(ecSuccess); return; } diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 8e3762914..7717aba69 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -1170,7 +1170,7 @@ vector LocalStore::getStatePathsInterval(const PathSet & statePaths) return nix::getStatePathsInterval(statePaths); } - +//TODO INCLUDE USERNAME + IDENTIFIER!!!!! Derivation getStateDerivation(const Path & path) { Transaction txn(nixDB); //TODO should u do a transaction here? ... this might delay the process ... @@ -1252,6 +1252,7 @@ void LocalStore::addUpdatedStateDerivation(const Path & newdrv, const Path & sto nix::addUpdatedStateDerivation(newdrv, storepath); } +//TODO INCLUDE USERNAME + IDENTIFIER, the can be multiple derivations for the same component void updateAllStateDerivations() { Transaction txn(nixDB); @@ -1295,7 +1296,7 @@ void LocalStore::updateAllStateDerivations() nix::updateAllStateDerivations(); } - +//TODO INCLUDE USERNAME + IDENTIFIER, the can be multiple derivations for the same component void updateStateDerivation(const Transaction & txn, const Path & storepath) { Path drvPath = queryDeriver(txn, storepath); diff --git a/src/libutil/util.cc b/src/libutil/util.cc index f340cec31..f6bb21acc 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -1114,7 +1114,7 @@ string getCallingUserName() int pos = username.find("\n",0); username.erase(pos,1); - //return "root3"; + //return "root6"; return username; } diff --git a/src/nix-state/nix-state.cc b/src/nix-state/nix-state.cc index c03787e81..ea2cbc54d 100644 --- a/src/nix-state/nix-state.cc +++ b/src/nix-state/nix-state.cc @@ -49,7 +49,6 @@ Derivation getDerivation_andCheckArgs(Strings opFlags, Strings opArgs, Path & co binary = fullPath.substr(pos + nixStore.size() + 1, fullPath.size()); //TODO REAL CHECK for validity of componentPath ... ? - //printMsg(lvlError, format("%1% - %2% - %3% - %4%") % componentPath % statePath % stateIdentifier % binary); if(componentPath == "/nix/store") throw UsageError("You must specify the full! binary path"); @@ -58,13 +57,18 @@ Derivation getDerivation_andCheckArgs(Strings opFlags, Strings opArgs, Path & co opArgs.pop_front(); stateIdentifier = opArgs.front(); } + + string username = getCallingUserName(); + + //printMsg(lvlError, format("%1% - %2% - %3% - %4% - %5%") % componentPath % statePath % stateIdentifier % binary % username); + //TODO check if this identifier exists !!!!!!!!!!! Derivation drv = store->getStateDerivation(componentPath); DerivationStateOutputs stateOutputs = drv.stateOutputs; - statePath = stateOutputs.find("state")->second.statepath; + statePath = stateOutputs.find("state")->second.statepath; //TODO STATEPATH BASED ON USERNAME AND INDENTIFIER !!!!!!!!!!!!!!! return drv; } @@ -262,7 +266,6 @@ void run(Strings args) string a = makeStatePathFromGolbalHash("8f3b56a9a985fce54fd88c3e95a81a4b6b11fb98da12b977aee7f278c73ad3d7-hellohardcodedstateworld-1.0-test2", "kaaz"); printMsg(lvlError, format("%1%") % a); return; - */ printMsg(lvlError, format("Result: \"%1%\"") % getCallingUserName()); return;