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

Fixed backwards compatible hack & added state creation call after build

This commit is contained in:
Wouter den Breejen 2007-05-22 13:19:27 +00:00
parent 73995157e3
commit 86b053dd80
5 changed files with 67 additions and 16 deletions

View file

@ -1377,14 +1377,11 @@ void DerivationGoal::startBuilder()
tmpDir = createTempDir();
/* Create the state directory where the component can store it's state files place */
//TODO
//TODO include addDirsBefore ...
//if(enableState){ ...
//stateDir = createStateDirs(drv.stateOutputDirs, drv.stateOutputs);
//}
//TODO create the startupscript
//printMsg(lvlError, format("STATE: `%1%'") % );
//We only create state dirs when state is enabled and when the dirs need to be created before the installation
if(drv.stateOutputs.size() != 0)
if(drv.stateOutputs.find("state")->second.getCreateDirsBeforeInstall())
createStateDirs(drv.stateOutputDirs, drv.stateOutputs);
/* For convenience, set an environment pointing to the top build
directory. */
@ -1616,6 +1613,11 @@ void DerivationGoal::computeClosure()
map<Path, PathSet> allReferences;
map<Path, Hash> contentHashes;
//We create state dirs only when state is enabled and when the dirs need to be created after the installation
if(drv.stateOutputs.size() != 0)
if(!drv.stateOutputs.find("state")->second.getCreateDirsBeforeInstall())
createStateDirs(drv.stateOutputDirs, drv.stateOutputs);
/* Check whether the output paths were created, and grep each
output path to determine what other paths it references. Also make all
output paths read-only. */

View file

@ -10,15 +10,14 @@ Derive | ATermList ATermList ATermList ATermList ATermList string string ATermLi
| 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
#Ive put this in because eelco requested it, and its easy to stay backwards compatible, but ultimately I thinks that it should be removed to prevent confusion & duplication
#!!!!!!!!Change the string "DeriveWithOutState" in derivations.ast-def.cc to "Derive"
#TODO, make this automatic..
DeriveWithOutState | ATermList ATermList ATermList string string ATermList ATermList | ATerm |
#Ive put this in because eelco requested it, and its easy to stay backwards compatible, but ultimately I think that it should be removed to prevent confusion & duplication
#The function will be called matchDerivateWithOutState, but it will match the Derive term to remain backwards compatible
Derive | ATermList ATermList ATermList string string ATermList ATermList | ATerm | DeriveWithOutState
| string string | ATerm | EnvBindingWithOutState |
| string ATermList | ATerm | DerivationInputWithOutState |
| string string string string | ATerm | DerivationOutputWithOutState |
Closure | ATermList ATermList | ATerm | OldClosure |
| string ATermList | ATerm | OldClosureElem |

View file

@ -4,6 +4,7 @@
typedef struct _ATerm * ATerm;
#include "hash.hh"
#include "util.hh"
#include <map>
@ -55,6 +56,14 @@ struct DerivationStateOutput
this->synchronization = synchronization;
this->createDirsBeforeInstall = createDirsBeforeInstall;
}
bool getEnabled(){
return string2bool(enabled);
}
bool getCreateDirsBeforeInstall(){
return string2bool(createDirsBeforeInstall);
}
};
struct DerivationStateOutputDir