1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 04:00:59 +01:00

before adjusting derivers table

This commit is contained in:
Wouter den Breejen 2007-06-12 12:48:35 +00:00
parent 95ce7e04b7
commit fe04276aef
5 changed files with 12 additions and 12 deletions

View file

@ -601,7 +601,7 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
if(enableState && !disableState){ if(enableState && !disableState){
if(runtimeStateParamters == ""){ if(runtimeStateParamters == ""){
string enableStateS = bool2string("true"); 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 enableStateS = bool2string("true");
string createDirsBeforeInstallS = bool2string(createDirsBeforeInstall); string createDirsBeforeInstallS = bool2string(createDirsBeforeInstall);
string username = getCallingUserName(); drv.stateOutputs["state"] = DerivationStateOutput(stateOutPath, printHash(componentHash), outputHashAlgo, outputHash, stateIdentifier, enableStateS, shareState, syncState, createDirsBeforeInstallS, runtimeStateParamters, getCallingUserName());
drv.stateOutputs["state"] = DerivationStateOutput(stateOutPath, printHash(componentHash), outputHashAlgo, outputHash, stateIdentifier, enableStateS, shareState, syncState, createDirsBeforeInstallS, runtimeStateParamters, username);
for(vector<DerivationStateOutputDir>::iterator i = stateDirs.begin(); i != stateDirs.end(); ++i) for(vector<DerivationStateOutputDir>::iterator i = stateDirs.begin(); i != stateDirs.end(); ++i)
drv.stateOutputDirs[(*i).path] = *(i); drv.stateOutputDirs[(*i).path] = *(i);

View file

@ -775,9 +775,6 @@ void DerivationGoal::haveDerivation()
/* If they are all valid, then we're done. */ /* If they are all valid, then we're done. */
if (invalidOutputs.size() == 0) { if (invalidOutputs.size() == 0) {
printMsg(lvlError, format("Check State VALIDITY BEFORE: `%1%'") % drvPath);
amDone(ecSuccess); amDone(ecSuccess);
return; return;
} }

View file

@ -1170,7 +1170,7 @@ vector<int> LocalStore::getStatePathsInterval(const PathSet & statePaths)
return nix::getStatePathsInterval(statePaths); return nix::getStatePathsInterval(statePaths);
} }
//TODO INCLUDE USERNAME + IDENTIFIER!!!!!
Derivation getStateDerivation(const Path & path) Derivation getStateDerivation(const Path & path)
{ {
Transaction txn(nixDB); //TODO should u do a transaction here? ... this might delay the process ... 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); nix::addUpdatedStateDerivation(newdrv, storepath);
} }
//TODO INCLUDE USERNAME + IDENTIFIER, the can be multiple derivations for the same component
void updateAllStateDerivations() void updateAllStateDerivations()
{ {
Transaction txn(nixDB); Transaction txn(nixDB);
@ -1295,7 +1296,7 @@ void LocalStore::updateAllStateDerivations()
nix::updateAllStateDerivations(); nix::updateAllStateDerivations();
} }
//TODO INCLUDE USERNAME + IDENTIFIER, the can be multiple derivations for the same component
void updateStateDerivation(const Transaction & txn, const Path & storepath) void updateStateDerivation(const Transaction & txn, const Path & storepath)
{ {
Path drvPath = queryDeriver(txn, storepath); Path drvPath = queryDeriver(txn, storepath);

View file

@ -1114,7 +1114,7 @@ string getCallingUserName()
int pos = username.find("\n",0); int pos = username.find("\n",0);
username.erase(pos,1); username.erase(pos,1);
//return "root3"; //return "root6";
return username; return username;
} }

View file

@ -49,7 +49,6 @@ Derivation getDerivation_andCheckArgs(Strings opFlags, Strings opArgs, Path & co
binary = fullPath.substr(pos + nixStore.size() + 1, fullPath.size()); binary = fullPath.substr(pos + nixStore.size() + 1, fullPath.size());
//TODO REAL CHECK for validity of componentPath ... ? //TODO REAL CHECK for validity of componentPath ... ?
//printMsg(lvlError, format("%1% - %2% - %3% - %4%") % componentPath % statePath % stateIdentifier % binary);
if(componentPath == "/nix/store") if(componentPath == "/nix/store")
throw UsageError("You must specify the full! binary path"); throw UsageError("You must specify the full! binary path");
@ -59,12 +58,17 @@ Derivation getDerivation_andCheckArgs(Strings opFlags, Strings opArgs, Path & co
stateIdentifier = opArgs.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 !!!!!!!!!!! //TODO check if this identifier exists !!!!!!!!!!!
Derivation drv = store->getStateDerivation(componentPath); Derivation drv = store->getStateDerivation(componentPath);
DerivationStateOutputs stateOutputs = drv.stateOutputs; 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; return drv;
} }
@ -262,7 +266,6 @@ void run(Strings args)
string a = makeStatePathFromGolbalHash("8f3b56a9a985fce54fd88c3e95a81a4b6b11fb98da12b977aee7f278c73ad3d7-hellohardcodedstateworld-1.0-test2", "kaaz"); string a = makeStatePathFromGolbalHash("8f3b56a9a985fce54fd88c3e95a81a4b6b11fb98da12b977aee7f278c73ad3d7-hellohardcodedstateworld-1.0-test2", "kaaz");
printMsg(lvlError, format("%1%") % a); printMsg(lvlError, format("%1%") % a);
return; return;
*/
printMsg(lvlError, format("Result: \"%1%\"") % getCallingUserName()); printMsg(lvlError, format("Result: \"%1%\"") % getCallingUserName());
return; return;