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

Before creating multiple derivation - component instances

This commit is contained in:
Wouter den Breejen 2007-05-31 17:18:13 +00:00
parent 986a50ac78
commit 9c46444641
9 changed files with 120 additions and 97 deletions

View file

@ -764,7 +764,7 @@ void DerivationGoal::haveDerivation()
assert(store->isValidPath(drvPath));
/* Get the derivation. */
drv = derivationFromPath(drvPath); //wouter look here
drv = derivationFromPath(drvPath);
for (DerivationOutputs::iterator i = drv.outputs.begin();
i != drv.outputs.end(); ++i)
@ -773,6 +773,8 @@ void DerivationGoal::haveDerivation()
/* Check what outputs paths are not already valid. */
PathSet invalidOutputs = checkPathValidity(false);
/* If they are all valid, then we're done. */
if (invalidOutputs.size() == 0) {
amDone(ecSuccess);
@ -1377,6 +1379,7 @@ void DerivationGoal::startBuilder()
tmpDir = createTempDir();
/* Create the state directory where the component can store it's state files place */
//TODO MOVEEEEEEEEEEE
//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())
@ -2476,9 +2479,10 @@ void LocalStore::buildDerivations(const PathSet & drvPaths)
Worker worker;
Goals goals;
for (PathSet::const_iterator i = drvPaths.begin();
i != drvPaths.end(); ++i)
for (PathSet::const_iterator i = drvPaths.begin(); i != drvPaths.end(); ++i){
goals.insert(worker.makeDerivationGoal(*i));
printMsg(lvlError, format("No component build, but state check: %1%") % *i);
}
worker.run(goals);

View file

@ -54,9 +54,9 @@ struct DerivationStateOutput
}
DerivationStateOutput(Path statepath, string hashAlgo, string hash, string stateIdentifier, string enabled, string shared, string synchronization, string createDirsBeforeInstall, string runtimeStateParamters)
{
if(shared != "none" || shared != "full" || shared != "group")
if(shared != "none" && shared != "full" && shared != "group")
throw Error(format("shared '%1%' is not a correct type") % shared);
if(synchronization != "none" || synchronization != "exclusive-lock" || synchronization != "recursive-exclusive-lock")
if(synchronization != "none" && synchronization != "exclusive-lock" && synchronization != "recursive-exclusive-lock")
throw Error(format("synchronization '%1%' is not a correct type") % synchronization);
//TODO
@ -93,7 +93,7 @@ struct DerivationStateOutputDir
}
DerivationStateOutputDir(string path, string type, string interval)
{
if(type != "none" || type != "manual" || type != "interval" || type != "full")
if(type != "none" && type != "manual" && type != "interval" && type != "full")
throw Error(format("interval '%1%' is not a correct type") % type);
this->path = path;

View file

@ -1094,6 +1094,8 @@ void verifyStore(bool checkContents)
}
}
//TODO Check statecounters table....
txn.commit();
@ -1142,6 +1144,9 @@ vector<int> getStatePathsInterval(const PathSet & statePaths)
nixDB.queryString(txn, dbStateCounters, *i, data);
//TODO check if every key returns a value from the db
if(data == ""){
throw Error(format("Statepath `%1%' has returned no interval from the database") % *i);
}
int n;
if (!string2Int(data, n)) throw Error("number expected");

View file

@ -31,7 +31,7 @@ bool isStorePath(const Path & path)
void assertStorePath(const Path & path)
{
if (!isStorePath(path))
throw Error(format("path `%1%' is not in the Nix store") % path);
throw Error(format("path `%1%' is not in the Nix store") % path); //TODO bug: this prints an empty path ...
}

View file

@ -15,6 +15,14 @@
namespace nix {
void dsfsdfas()
{
}
void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const DerivationStateOutputs & stateOutputs, const StringPairs & env)
{
Path statePath = stateOutputs.find("state")->second.statepath;