mirror of
https://github.com/NixOS/nix.git
synced 2025-11-27 04:30:59 +01:00
Changed the [solid-state-dependencies] list in the derivation to a single variable 'externalState' (since we also have a single state path) which can, for instance, be set to ~/.mozilla-test in the case of firefox (not bugfree yet)
This commit is contained in:
parent
68cb244c90
commit
89ab441fd2
10 changed files with 118 additions and 56 deletions
|
|
@ -1704,8 +1704,17 @@ void DerivationGoal::computeClosure()
|
|||
/* Get rid of all weird permissions. */
|
||||
canonicalisePathMetaData(path);
|
||||
|
||||
/* Just before the very first scanForReferences, we insert the solid state references in its table so its references will show up in the scan*/
|
||||
setSolidStateReferencesTxn(noTxn, path, drv.solidStateDeps);
|
||||
/* In case we have an externalState:
|
||||
* Just before the very first scanForReferences, we insert the solid state references
|
||||
* in its table so its references will show up in the scan
|
||||
*/
|
||||
if(isStateDrv(drv)){
|
||||
if(drv.stateOutputs.find("state")->second.externalState != ""){
|
||||
PathSet singStatePath;
|
||||
singStatePath.insert(drv.stateOutputs.find("state")->second.statepath);
|
||||
setSolidStateReferencesTxn(noTxn, path, singStatePath);
|
||||
}
|
||||
}
|
||||
|
||||
/* For this output path, find the component references to other paths contained in it. */
|
||||
PathSet references = scanForReferences(path, allPaths);
|
||||
|
|
|
|||
|
|
@ -664,13 +664,6 @@ void Database::setStateRevisions(const Transaction & txn, TableId revisions_tabl
|
|||
|
||||
//get all paths that point to the same state (using shareing) and check if one of them equals the rootStatePath
|
||||
PathSet sharedWith = getSharedWithPathSetRecTxn(txn, statePath);
|
||||
|
||||
/*
|
||||
printMsg(lvlError, format("SP RootSP '%1%' - '%2%'") % statePath % rootStatePath);
|
||||
for (PathSet::const_iterator j = sharedWith.begin(); j != sharedWith.end(); ++j)
|
||||
printMsg(lvlError, format("SP SW '%1%'") % *j);
|
||||
*/
|
||||
|
||||
if(statePath == rootStatePath || sharedWith.find(rootStatePath) != sharedWith.end())
|
||||
metadata.push_back(comment);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
init initDerivationsHelpers
|
||||
|
||||
Derive | ATermList ATermList ATermList ATermList ATermList ATermList string string ATermList ATermList | ATerm |
|
||||
Derive | ATermList ATermList ATermList ATermList ATermList string string ATermList ATermList | ATerm |
|
||||
| string string | ATerm | EnvBinding |
|
||||
| string ATermList | ATerm | DerivationInput |
|
||||
| string string string string | ATerm | DerivationOutput |
|
||||
| string string string string string string string string string string string string string | ATerm | DerivationStateOutput |
|
||||
| string string string string string string string string string string string string string string | ATerm | DerivationStateOutput |
|
||||
| string string string | ATerm | DerivationStateOutputDir |
|
||||
|
||||
#We use DeriveWithOutState to create derivations that dont use state, and thus dont have the stateDerivationStateOutput and DerivationStateOutputDir in their derivation
|
||||
|
|
|
|||
|
|
@ -67,12 +67,12 @@ Derivation parseDerivation(ATerm t)
|
|||
{
|
||||
Derivation drv;
|
||||
ATermList outs, inDrvs, inSrcs, args, bnds;
|
||||
ATermList stateOuts = ATempty, stateOutDirs = ATempty, solidStateDeps = ATempty;
|
||||
ATermList stateOuts = ATempty, stateOutDirs = ATempty;
|
||||
|
||||
ATerm builder, platform;
|
||||
|
||||
bool withState;
|
||||
if (matchDerive(t, outs, stateOuts, stateOutDirs, solidStateDeps, inDrvs, inSrcs, platform, builder, args, bnds) ) { withState = true; }
|
||||
if (matchDerive(t, outs, stateOuts, stateOutDirs, inDrvs, inSrcs, platform, builder, args, bnds) ) { withState = true; }
|
||||
else if (matchDeriveWithOutState(t, outs, inDrvs, inSrcs, platform, builder, args, bnds) ) { withState = false; }
|
||||
else
|
||||
throwBadDrv(t);
|
||||
|
|
@ -93,8 +93,8 @@ Derivation parseDerivation(ATerm t)
|
|||
{
|
||||
//parse state part
|
||||
for (ATermIterator i(stateOuts); i; ++i) {
|
||||
ATerm id, statepath, componentHash, hashAlgo, hash, stateIdentifier, enabled, shareType, synchronization, createDirsBeforeInstall, runtimeStateArgs, username, sharedState;
|
||||
if (!matchDerivationStateOutput(*i, id, statepath, componentHash, hashAlgo, hash, stateIdentifier, enabled, shareType, synchronization, createDirsBeforeInstall, runtimeStateArgs, username, sharedState))
|
||||
ATerm id, statepath, componentHash, hashAlgo, hash, stateIdentifier, enabled, shareType, synchronization, createDirsBeforeInstall, runtimeStateArgs, username, sharedState, externalState; //TODO unitialized warning
|
||||
if (!matchDerivationStateOutput(*i, id, statepath, componentHash, hashAlgo, hash, stateIdentifier, enabled, shareType, synchronization, createDirsBeforeInstall, runtimeStateArgs, username, sharedState, externalState))
|
||||
throwBadDrv(t);
|
||||
DerivationStateOutput stateOut;
|
||||
stateOut.statepath = aterm2String(statepath);
|
||||
|
|
@ -109,7 +109,8 @@ Derivation parseDerivation(ATerm t)
|
|||
stateOut.createDirsBeforeInstall = aterm2String(createDirsBeforeInstall);
|
||||
stateOut.runtimeStateArgs = aterm2String(runtimeStateArgs);
|
||||
stateOut.username = aterm2String(username);
|
||||
stateOut.sharedState = aterm2String(sharedState);
|
||||
stateOut.sharedState = aterm2String(sharedState);
|
||||
stateOut.externalState = aterm2String(externalState);
|
||||
drv.stateOutputs[aterm2String(id)] = stateOut;
|
||||
}
|
||||
|
||||
|
|
@ -126,12 +127,6 @@ Derivation parseDerivation(ATerm t)
|
|||
drv.stateOutputDirs[aterm2String(id)] = stateOutDirs;
|
||||
}
|
||||
|
||||
//parse solid state dependencies
|
||||
for (ATermIterator i(solidStateDeps); i; ++i) {
|
||||
if (ATgetType(*i) != AT_APPL)
|
||||
throw badTerm("string expected", *i);
|
||||
drv.solidStateDeps.insert(aterm2String(*i));
|
||||
}
|
||||
}
|
||||
|
||||
for (ATermIterator i(inDrvs); i; ++i) {
|
||||
|
|
@ -201,7 +196,8 @@ ATerm unparseDerivation(const Derivation & drv)
|
|||
toATerm(i->second.createDirsBeforeInstall),
|
||||
toATerm(i->second.runtimeStateArgs),
|
||||
toATerm(i->second.username),
|
||||
toATerm(i->second.sharedState)
|
||||
toATerm(i->second.sharedState),
|
||||
toATerm(i->second.externalState)
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -214,11 +210,6 @@ ATerm unparseDerivation(const Derivation & drv)
|
|||
toATerm(i->second.interval)
|
||||
));
|
||||
|
||||
ATermList solidStateDeps = ATempty;
|
||||
for (StringSet::const_reverse_iterator i = drv.solidStateDeps.rbegin();
|
||||
i != drv.solidStateDeps.rend(); ++i)
|
||||
solidStateDeps = ATinsert(solidStateDeps, toATerm(*i));
|
||||
|
||||
ATermList inDrvs = ATempty;
|
||||
for (DerivationInputs::const_reverse_iterator i = drv.inputDrvs.rbegin();
|
||||
i != drv.inputDrvs.rend(); ++i)
|
||||
|
|
@ -245,7 +236,6 @@ ATerm unparseDerivation(const Derivation & drv)
|
|||
outputs,
|
||||
stateOutputs,
|
||||
stateOutputDirs,
|
||||
solidStateDeps,
|
||||
inDrvs,
|
||||
toATermList(drv.inputSrcs),
|
||||
toATerm(drv.platform),
|
||||
|
|
|
|||
|
|
@ -55,12 +55,14 @@ struct DerivationStateOutput
|
|||
|
||||
string sharedState; //Path to share state From
|
||||
|
||||
string externalState; //a statePath not not in the stateStore (Official hack)
|
||||
|
||||
DerivationStateOutput()
|
||||
{
|
||||
}
|
||||
|
||||
//TODO add const ??
|
||||
DerivationStateOutput(Path statepath, string componentHash, string hashAlgo, string hash, string stateIdentifier, string enabled, string shareType, string synchronization, string createDirsBeforeInstall, string runtimeStateArgs, string username, string sharedState, bool check=true)
|
||||
DerivationStateOutput(Path statepath, string componentHash, string hashAlgo, string hash, string stateIdentifier, string enabled, string shareType, string synchronization, string createDirsBeforeInstall, string runtimeStateArgs, string username, string sharedState, string externalState, bool check=true)
|
||||
{
|
||||
if(check){
|
||||
if(shareType != "none" && shareType != "full" && shareType != "group")
|
||||
|
|
@ -73,8 +75,8 @@ struct DerivationStateOutput
|
|||
throw Error(format("the stateIdenfier cannot be this value '%1%'") % stateIdentifier);
|
||||
if(runtimeStateArgs == "__NOARGS__")
|
||||
throw Error(format("the runtimeStateArgs cannot be this value '%1%'") % runtimeStateArgs);
|
||||
|
||||
|
||||
if(externalState != "" && sharedState != "")
|
||||
throw Error(format("You cannot have an externalState and sharedState at the same time"));
|
||||
}
|
||||
|
||||
//TODO
|
||||
|
|
@ -93,6 +95,7 @@ struct DerivationStateOutput
|
|||
this->runtimeStateArgs = runtimeStateArgs;
|
||||
this->username = username;
|
||||
this->sharedState = sharedState;
|
||||
this->externalState = externalState;
|
||||
}
|
||||
|
||||
bool getEnabled(){
|
||||
|
|
@ -119,6 +122,7 @@ struct DerivationStateOutput
|
|||
this->runtimeStateArgs = "";
|
||||
//this->username; //Changes the statepath directly
|
||||
this->sharedState = "";
|
||||
this->externalState = "";
|
||||
|
||||
}
|
||||
};
|
||||
|
|
@ -171,7 +175,6 @@ struct Derivation
|
|||
DerivationOutputs outputs; /* keyed on symbolic IDs */
|
||||
DerivationStateOutputs stateOutputs; /* TODO */
|
||||
DerivationStateOutputDirs stateOutputDirs; /* TODO */
|
||||
StringSet solidStateDeps; /* TODO */
|
||||
DerivationInputs inputDrvs; /* inputs that are sub-derivations */
|
||||
PathSet inputSrcs; /* inputs that are sources */
|
||||
string platform;
|
||||
|
|
|
|||
|
|
@ -1813,20 +1813,14 @@ PathSet getSharedWithPathSetRecTxn_private(const Transaction & txn, const Path &
|
|||
{
|
||||
//Get all paths pointing to statePath
|
||||
PathSet newStatePaths = getDirectlySharedWithPathSetTxn(txn, statePath);
|
||||
|
||||
/*
|
||||
printMsg(lvlError, format("getSharedWithPathSetRecTxn_private: '%1%'") % statePath);
|
||||
for (PathSet::const_iterator j = newStatePaths.begin(); j != newStatePaths.end(); ++j)
|
||||
printMsg(lvlError, format("newStatePaths '%1%'") % *j);
|
||||
*/
|
||||
|
||||
//go into recursion to see if there are more paths indirectly pointing to statePath
|
||||
for (PathSet::iterator i = newStatePaths.begin(); i != newStatePaths.end(); ++i){
|
||||
|
||||
//Only recurse on the really new statePaths to prevent infinite recursion
|
||||
if(statePaths.find(*i) == statePaths.end())
|
||||
{
|
||||
if(statePaths.find(*i) == statePaths.end()) {
|
||||
statePaths.insert(*i);
|
||||
statePaths = pathSets_union(statePaths, getSharedWithPathSetRecTxn_private(txn, *i, statePaths)); //TODO !!!!!!!!!!!!!!!!!!!!!!
|
||||
statePaths = pathSets_union(statePaths, getSharedWithPathSetRecTxn_private(txn, *i, statePaths));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue