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

State is now maintained (their paths are automatically shared), unless sharedState is set in the nix-expr, when a new version with the same drv-name of the component is installed

This commit is contained in:
Wouter den Breejen 2007-08-13 15:35:12 +00:00
parent 7424d72098
commit 4089bd5f19
9 changed files with 110 additions and 75 deletions

View file

@ -1821,16 +1821,10 @@ void DerivationGoal::computeClosure()
if(sharedState != ""){
//Remove state path
deletePathWrapped(statePath);
//Symlink link to the share path
Strings p_args;
p_args.push_back("-sf");
p_args.push_back(sharedState);
p_args.push_back(statePath);
runProgram_AndPrintOutput("ln", true, p_args, "ln"); //run
sharePath(sharedState, statePath);
//Set in database
setSharedStateTxn(txn, statePath, sharedState);
setSharedStateTxn(txn, sharedState, statePath);
}
}
@ -2587,9 +2581,7 @@ void LocalStore::buildDerivations(const PathSet & drvPaths)
Worker worker;
Goals goals;
for (PathSet::const_iterator i = drvPaths.begin(); i != drvPaths.end(); ++i){
printMsg(lvlError, format("BUILD: '%1%'") % *i);
//printMsg(lvlError, format("BUILD: '%1%'") % *i);
goals.insert(worker.makeDerivationGoal(*i));
}

View file

@ -1729,13 +1729,13 @@ bool querySolidStateReferencesTxn(const Transaction & txn, const Path & statePat
return notempty;
}
void setSharedStateTxn(const Transaction & txn, const Path & statePath, const Path & shared_with)
void setSharedStateTxn(const Transaction & txn, const Path & fromExisting, const Path & toNew)
{
//Remove earlier entries
nixDB.delPair(txn, dbSharedState, statePath);
nixDB.delPair(txn, dbSharedState, toNew);
//Set new entry
nixDB.setString(txn, dbSharedState, statePath, shared_with);
nixDB.setString(txn, dbSharedState, toNew, fromExisting);
}
bool querySharedStateTxn(const Transaction & txn, const Path & statePath, Path & shared_with)

View file

@ -239,7 +239,7 @@ bool isValidStatePathTxn(const Transaction & txn, const Path & path);
void setSolidStateReferencesTxn(const Transaction & txn, const Path & statePath, const PathSet & paths);
bool querySolidStateReferencesTxn(const Transaction & txn, const Path & statePath, PathSet & paths);
void setSharedStateTxn(const Transaction & txn, const Path & statePath, const Path & shared_with);
void setSharedStateTxn(const Transaction & txn, const Path & fromExisting, const Path & toNew);
PathSet toNonSharedPathSetTxn(const Transaction & txn, const PathSet & statePaths);
Path toNonSharedPathTxn(const Transaction & txn, const Path & statePath);