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

Added beginnnings of getStatePathClosure and GetDrv in local-store.cc, next: setting up variables in nix-state to recursively commit state

This commit is contained in:
Wouter den Breejen 2007-05-29 15:42:44 +00:00
parent fbd1b78a9d
commit cbd0d39583
13 changed files with 210 additions and 79 deletions

View file

@ -388,8 +388,9 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
bool disableState = false; //Becomes true if the user explicitly says: no state bool disableState = false; //Becomes true if the user explicitly says: no state
string shareState = "none"; string shareState = "none";
string syncState = "all"; string syncState = "all";
string stateIndentifier = ""; string stateIdentifier = "";
bool createDirsBeforeInstall = false; bool createDirsBeforeInstall = false;
string runtimeStateParamters = "";
for (ATermMap::const_iterator i = attrs.begin(); i != attrs.end(); ++i) { for (ATermMap::const_iterator i = attrs.begin(); i != attrs.end(); ++i) {
string key = aterm2String(i->key); string key = aterm2String(i->key);
@ -467,11 +468,12 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
} }
} }
else if(key == "shareState") { string s = coerceToString(state, value, context, true); shareState = s; } else if(key == "shareState") { shareState = coerceToString(state, value, context, true); }
else if(key == "synchronization") { string s = coerceToString(state, value, context, true); syncState = s; } else if(key == "synchronization") { syncState = coerceToString(state, value, context, true); }
else if(key == "disableState") { bool b = evalBool(state, value); disableState = b; } else if(key == "disableState") { disableState = evalBool(state, value); }
else if(key == "indentifier"){ string s = coerceToString(state, value, context, true); stateIndentifier = s; } else if(key == "identifier"){ stateIdentifier = coerceToString(state, value, context, true); }
else if(key == "createDirsBeforeInstall"){ bool b = evalBool(state, value); createDirsBeforeInstall = b; } else if(key == "createDirsBeforeInstall"){ createDirsBeforeInstall = evalBool(state, value); }
else if(key == "runtimeStateParamters"){ runtimeStateParamters = coerceToString(state, value, context, true); }
/* All other attributes are passed to the builder through /* All other attributes are passed to the builder through
the environment. */ the environment. */
@ -567,14 +569,14 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
/* Add the state path based on the outPath */ /* Add the state path based on the outPath */
string callingUser = "wouterdb"; //TODO: Change into variable string callingUser = "wouterdb"; //TODO: Change into variable
string componentHash = printHash(hashDerivationModulo(state, drv)); //hash of the component path string componentHash = printHash(hashDerivationModulo(state, drv)); //hash of the component path
Hash statehash = hashString(htSHA256, stateIndentifier + callingUser + componentHash); //hash of the state path Hash statehash = hashString(htSHA256, callingUser + componentHash); //hash of the state path
Path stateOutPath = makeStatePath("stateOutput:statepath", statehash, drvName); //State path Path stateOutPath = makeStatePath("stateOutput:statepath", statehash, drvName, stateIdentifier); //State path
drv.env["statepath"] = stateOutPath; drv.env["statepath"] = stateOutPath;
string enableStateS = bool2string("true"); string enableStateS = bool2string("true");
string createDirsBeforeInstallS = bool2string(createDirsBeforeInstall); string createDirsBeforeInstallS = bool2string(createDirsBeforeInstall);
drv.stateOutputs["state"] = DerivationStateOutput(stateOutPath, outputHashAlgo, outputHash, enableStateS, shareState, syncState, createDirsBeforeInstallS); drv.stateOutputs["state"] = DerivationStateOutput(stateOutPath, outputHashAlgo, outputHash, stateIdentifier, enableStateS, shareState, syncState, createDirsBeforeInstallS, runtimeStateParamters);
} }
/* Write the resulting term into the Nix store directory. */ /* Write the resulting term into the Nix store directory. */

View file

@ -6,18 +6,19 @@ Derive | ATermList ATermList ATermList ATermList ATermList string string ATermLi
| string string | ATerm | EnvBinding | | string string | ATerm | EnvBinding |
| string ATermList | ATerm | DerivationInput | | string ATermList | ATerm | DerivationInput |
| string string string string | ATerm | DerivationOutput | | string string string string | ATerm | DerivationOutput |
| string string string string string string string string | ATerm | DerivationStateOutput | | string string string string string string string string string string | ATerm | DerivationStateOutput |
| string string string | ATerm | DerivationStateOutputDir | | 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 #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 think that it should be removed to prevent confusion & duplication #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 #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 Derive | ATermList ATermList ATermList string string ATermList ATermList | ATerm | DeriveWithOutState
| string string | ATerm | EnvBindingWithOutState | | string string | ATerm | EnvBindingWithOutState |
| string ATermList | ATerm | DerivationInputWithOutState | | string ATermList | ATerm | DerivationInputWithOutState |
| string string string string | ATerm | DerivationOutputWithOutState | | string string string string | ATerm | DerivationOutputWithOutState |
#end drv without state
Closure | ATermList ATermList | ATerm | OldClosure | Closure | ATermList ATermList | ATerm | OldClosure |
| string ATermList | ATerm | OldClosureElem | | string ATermList | ATerm | OldClosureElem |

View file

@ -92,18 +92,20 @@ Derivation parseDerivation(ATerm t)
if(withState){ if(withState){
//parse state part //parse state part
for (ATermIterator i(stateOuts); i; ++i) { for (ATermIterator i(stateOuts); i; ++i) {
ATerm id, statepath, hashAlgo, hash, enabled, shared, synchronization, createDirsBeforeInstall; ATerm id, statepath, hashAlgo, hash, stateIdentifier, enabled, shared, synchronization, createDirsBeforeInstall, runtimeStateParamters;
if (!matchDerivationStateOutput(*i, id, statepath, hashAlgo, hash, enabled, shared, synchronization, createDirsBeforeInstall)) if (!matchDerivationStateOutput(*i, id, statepath, hashAlgo, hash, stateIdentifier, enabled, shared, synchronization, createDirsBeforeInstall, runtimeStateParamters))
throwBadDrv(t); throwBadDrv(t);
DerivationStateOutput stateOut; DerivationStateOutput stateOut;
stateOut.statepath = aterm2String(statepath); stateOut.statepath = aterm2String(statepath);
//checkPath(stateOut.path); //should we check the statpath .... ??? //checkPath(stateOut.path); //should we check the statpath .... ???
stateOut.hashAlgo = aterm2String(hashAlgo); stateOut.hashAlgo = aterm2String(hashAlgo);
stateOut.hash = aterm2String(hash); stateOut.hash = aterm2String(hash);
stateOut.stateIdentifier = aterm2String(stateIdentifier);
stateOut.enabled = aterm2String(enabled); stateOut.enabled = aterm2String(enabled);
stateOut.shared = aterm2String(shared); stateOut.shared = aterm2String(shared);
stateOut.synchronization = aterm2String(synchronization); stateOut.synchronization = aterm2String(synchronization);
stateOut.createDirsBeforeInstall = aterm2String(createDirsBeforeInstall); stateOut.createDirsBeforeInstall = aterm2String(createDirsBeforeInstall);
stateOut.runtimeStateParamters = aterm2String(runtimeStateParamters);
drv.stateOutputs[aterm2String(id)] = stateOut; drv.stateOutputs[aterm2String(id)] = stateOut;
} }
} }
@ -182,10 +184,12 @@ ATerm unparseDerivation(const Derivation & drv)
toATerm(i->second.statepath), toATerm(i->second.statepath),
toATerm(i->second.hashAlgo), toATerm(i->second.hashAlgo),
toATerm(i->second.hash), toATerm(i->second.hash),
toATerm(i->second.stateIdentifier),
toATerm(i->second.enabled), toATerm(i->second.enabled),
toATerm(i->second.shared), toATerm(i->second.shared),
toATerm(i->second.synchronization), toATerm(i->second.synchronization),
toATerm(i->second.createDirsBeforeInstall) toATerm(i->second.createDirsBeforeInstall),
toATerm(i->second.runtimeStateParamters)
)); ));
} }

View file

@ -39,22 +39,30 @@ struct DerivationStateOutput
Path statepath; Path statepath;
string hashAlgo; string hashAlgo;
string hash; string hash;
string enabled; string stateIdentifier; //the identifier
string enabled; //enable or disable state
string shared; //none, full, group string shared; //none, full, group
string synchronization; //none, exclusive-lock-on-own-state-dir, exclusive-lock-on-all-(sub)-states-dir string synchronization; //none (no locks), exclusive-lock-on-own-state-dir, exclusive-lock-on-all-(sub)-states-dir
string createDirsBeforeInstall;
string commitReferences; //TODO none, direct, recursive-all
string commitBinaries; //TODO list of binaries that need (or not) to be committed when these binaries are called
string createDirsBeforeInstall; //if true: creates state dirs before installation
string runtimeStateParamters; //if not empty: these are the runtime parameters where state can be found (you can use $statepath here)
DerivationStateOutput() DerivationStateOutput()
{ {
} }
DerivationStateOutput(Path statepath, string hashAlgo, string hash, string enabled, string shared, string synchronization, string createDirsBeforeInstall) DerivationStateOutput(Path statepath, string hashAlgo, string hash, string stateIdentifier, string enabled, string shared, string synchronization, string createDirsBeforeInstall, string runtimeStateParamters)
{ {
this->statepath = statepath; this->statepath = statepath;
this->hashAlgo = hashAlgo; this->hashAlgo = hashAlgo;
this->hash = hash; this->hash = hash;
this->stateIdentifier = stateIdentifier;
this->enabled = enabled; this->enabled = enabled;
this->shared = shared; this->shared = shared;
this->synchronization = synchronization; this->synchronization = synchronization;
this->createDirsBeforeInstall = createDirsBeforeInstall; this->createDirsBeforeInstall = createDirsBeforeInstall;
this->runtimeStateParamters = runtimeStateParamters;
} }
bool getEnabled(){ bool getEnabled(){

View file

@ -9,6 +9,9 @@
#include "derivations-ast.hh" #include "derivations-ast.hh"
#include "worker-protocol.hh" #include "worker-protocol.hh"
#include "derivations.hh"
#include "misc.hh"
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
@ -1107,7 +1110,7 @@ void setStatePathsInterval(const PathSet & statePaths, const vector<int> & inter
int n=0; int n=0;
for (PathSet::iterator i = statePaths.begin(); i != statePaths.end(); ++i) for (PathSet::iterator i = statePaths.begin(); i != statePaths.end(); ++i)
{ {
printMsg(lvlError, format("PATH: %1%") % *i); printMsg(lvlError, format("Set interval of PATH: %1%") % *i);
int interval=0; int interval=0;
if(!allZero) if(!allZero)
@ -1127,17 +1130,19 @@ void LocalStore::setStatePathsInterval(const PathSet & statePaths, const vector<
vector<int> getStatePathsInterval(const PathSet & statePaths) vector<int> getStatePathsInterval(const PathSet & statePaths)
{ {
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 ...
vector<int> intervals;
string data; string data;
Paths referers;
for (PathSet::iterator i = statePaths.begin(); i != statePaths.end(); ++i){ vector<int> intervals;
for (PathSet::iterator i = statePaths.begin(); i != statePaths.end(); ++i)
{
nixDB.queryString(txn, dbStateCounters, *i, data); nixDB.queryString(txn, dbStateCounters, *i, data);
printMsg(lvlError, format("Data %1%") % data); printMsg(lvlError, format("Data %1%") % data); //TODO
}
}
txn.commit(); txn.commit();
return intervals; return intervals;
@ -1149,6 +1154,58 @@ vector<int> LocalStore::getStatePathsInterval(const PathSet & statePaths)
} }
Derivation getStateDerivation(const Path & path)
{
Transaction txn(nixDB); //TODO should u do a transaction here? ... this might delay the process ...
string data;
//Get derivations of references
nixDB.queryString(txn, dbDerivers, path, data);
printMsg(lvlError, format("DERIVERS %1%") % data);
txn.commit();
Derivation drv = derivationFromPath(data);
if(drv.stateOutputs.size() == 0)
throw Error(format("This path is not a state derivation: `%1%'") % path);
return drv;
}
Derivation LocalStore::getStateDerivation(const Path & path)
{
return nix::getStateDerivation(path);
}
//TODO direct or all recursive parameter
//TODO check if these are state components
PathSet getStateReferencesClosure(const Path & path)
{
Transaction txn(nixDB); //TODO should u do a transaction here? ... this might delay the process ...
Strings data;
PathSet paths;
Paths referencesKeys;
nixDB.queryStrings(txn, dbReferences, path, data);
for (Strings::iterator i = data.begin(); i != data.end(); ++i)
{
//printMsg(lvlError, format("References: `%1%'") % *i);
paths.insert(*i);
}
txn.commit();
return paths;
}
PathSet LocalStore::getStateReferencesClosure(const Path & path)
{
return nix::getStateReferencesClosure(path);
}
/* Upgrade from schema 1 (Nix <= 0.7) to schema 2 (Nix >= 0.8). */ /* Upgrade from schema 1 (Nix <= 0.7) to schema 2 (Nix >= 0.8). */
static void upgradeStore07() static void upgradeStore07()

View file

@ -79,6 +79,10 @@ public:
void setStatePathsInterval(const PathSet & statePath, const vector<int> & intervals, bool allZero = false); void setStatePathsInterval(const PathSet & statePath, const vector<int> & intervals, bool allZero = false);
vector<int> getStatePathsInterval(const PathSet & statePaths); vector<int> getStatePathsInterval(const PathSet & statePaths);
Derivation getStateDerivation(const Path & path);
PathSet getStateReferencesClosure(const Path & path);
}; };

View file

@ -388,5 +388,19 @@ vector<int> RemoteStore::getStatePathsInterval(const PathSet & statePaths)
return intervals; return intervals;
} }
//TODO
Derivation RemoteStore::getStateDerivation(const Path & path)
{
Derivation d;
return d;
}
//TODO
PathSet RemoteStore::getStateReferencesClosure(const Path & path)
{
PathSet empty;
return empty;
}
} }

View file

@ -68,6 +68,11 @@ public:
vector<int> getStatePathsInterval(const PathSet & statePaths); vector<int> getStatePathsInterval(const PathSet & statePaths);
Derivation getStateDerivation(const Path & path);
PathSet getStateReferencesClosure(const Path & path);
private: private:
AutoCloseFD fdSocket; AutoCloseFD fdSocket;
FdSink to; FdSink to;

View file

@ -75,34 +75,44 @@ Path makeStorePath(const string & type, const Hash & hash, const string & suffix
checkStoreName(suffix); checkStoreName(suffix);
return nixStore + "/" return nixStore + "/"
+ printHash32(compressHash(hashString(htSHA256, s), 20)) + printHash32(compressHash(hashString(htSHA256, s), 20)) //TODO maybe also add a suffix_stateIdentifier when: there is state & no runtime state args & ... ?
+ "-" + suffix; + "-" + suffix;
} }
Path makeStatePath(const string & type, const Hash & hash, const string & suffix) Path makeStatePath(const string & type, const Hash & hash, const string & suffix, const string & stateIdentifier)
{ {
string suffix_stateIdentifier = stateIdentifier;
if(suffix_stateIdentifier != "")
suffix_stateIdentifier = "-" + suffix_stateIdentifier;
/* e.g., "source:sha256:1abc...:/nix/store:foo.tar.gz" */ /* e.g., "source:sha256:1abc...:/nix/store:foo.tar.gz" */
string s = type + ":sha256:" + printHash(hash) + ":" string s = type + ":sha256:" + printHash(hash) + ":"
+ nixStoreState + ":" + suffix; + nixStoreState + ":" + suffix + ":" + stateIdentifier;
checkStoreName(suffix); //should this be here? checkStoreName(suffix);
checkStoreName(stateIdentifier);
return nixStoreState + "/" return nixStoreState + "/"
+ printHash32(compressHash(hashString(htSHA256, s), 20)) + printHash32(compressHash(hashString(htSHA256, s), 20))
+ "-" + suffix; + "-" + suffix + suffix_stateIdentifier;
} }
Path makeStateReposPath(const string & type, const Hash & hash, const string & suffix) Path makeStateReposPath(const string & type, const Hash & hash, const string & suffix, const string & stateIdentifier)
{ {
string suffix_stateIdentifier = stateIdentifier;
if(suffix_stateIdentifier != "")
suffix_stateIdentifier = "-" + suffix_stateIdentifier;
/* e.g., "source:sha256:1abc...:/nix/store:foo.tar.gz" */ /* e.g., "source:sha256:1abc...:/nix/store:foo.tar.gz" */
string s = type + ":sha256:" + printHash(hash) + ":" string s = type + ":sha256:" + printHash(hash) + ":"
+ nixStoreState + ":" + suffix; + nixStoreState + ":" + suffix + ":" + stateIdentifier;
checkStoreName(suffix); //should this be here? checkStoreName(suffix);
checkStoreName(stateIdentifier);
return nixStoreStateRepos + "/" return nixStoreStateRepos + "/"
+ printHash32(compressHash(hashString(htSHA256, s), 20)) + printHash32(compressHash(hashString(htSHA256, s), 20))
+ "-" + suffix; + "-" + suffix + suffix_stateIdentifier;
} }
Path makeFixedOutputPath(bool recursive, Path makeFixedOutputPath(bool recursive,

View file

@ -8,6 +8,7 @@
#include "hash.hh" #include "hash.hh"
#include "serialise.hh" #include "serialise.hh"
#include "derivations.hh"
namespace nix { namespace nix {
@ -185,6 +186,13 @@ public:
/* TODO */ /* TODO */
virtual vector<int> getStatePathsInterval(const PathSet & statePaths) = 0; virtual vector<int> getStatePathsInterval(const PathSet & statePaths) = 0;
/* TODO */
virtual Derivation getStateDerivation(const Path & path) = 0;
/* TODO */
virtual PathSet getStateReferencesClosure(const Path & path) = 0;
}; };
@ -211,10 +219,10 @@ Path makeFixedOutputPath(bool recursive,
string hashAlgo, Hash hash, string name); string hashAlgo, Hash hash, string name);
/* Constructs a unique store state path name. */ /* Constructs a unique store state path name. */
Path makeStatePath(const string & type, const Hash & hash, const string & suffix); Path makeStatePath(const string & type, const Hash & hash, const string & suffix, const string & stateIdentifier);
/* Constructs a unique store state repos path name. */ /* Constructs a unique store state repos path name. */
Path makeStateReposPath(const string & type, const Hash & hash, const string & suffix); Path makeStateReposPath(const string & type, const Hash & hash, const string & suffix, const string & stateIdentifier);
/* This is the preparatory part of addToStore() and addToStoreFixed(); /* This is the preparatory part of addToStore() and addToStoreFixed();

View file

@ -20,6 +20,7 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
Path statePath = stateOutputs.find("state")->second.statepath; Path statePath = stateOutputs.find("state")->second.statepath;
string stateDir = statePath; string stateDir = statePath;
string drvName = env.find("name")->second; string drvName = env.find("name")->second;
string stateIdentifier = stateOutputs.find("state")->second.stateIdentifier;
//Convert the map into a sortable vector //Convert the map into a sortable vector
vector<DerivationStateOutputDir> stateDirsVector; vector<DerivationStateOutputDir> stateDirsVector;
@ -49,15 +50,7 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
string fullstatedir = stateDir + "/" + thisdir; string fullstatedir = stateDir + "/" + thisdir;
Path statePath = fullstatedir; //TODO call coerce function Path statePath = fullstatedir; //TODO call coerce function
//calc create repos for this state location //TODO REPLACE TRUE INTO VAR OF CREATEING DIRS BEFORE OR AFTER INSTALL
Hash hash = hashString(htSHA256, stateDir + thisdir);
string repos = makeStateReposPath("stateOutput:staterepospath", hash, drvName);
//Were going to execute svn shell commands
executeAndPrintShellCommand(svnadminbin + " create " + repos, "svnadmin"); //TODO create as nixbld.nixbld chmod 700
//TODO REPLACE TRUE INTO VAR
//Check if and how this dir needs to be versioned //Check if and how this dir needs to be versioned
if(d.type == "none"){ if(d.type == "none"){
if(true){ if(true){
@ -67,6 +60,12 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
continue; continue;
} }
//Create a repository for this state location
Hash hash = hashString(htSHA256, stateDir + thisdir);
string repos = makeStateReposPath("stateOutput:staterepospath", hash, drvName, stateIdentifier);
executeAndPrintShellCommand(svnadminbin + " create " + repos, "svnadmin"); //TODO create as nixbld.nixbld chmod 700
//
string checkoutcommand = svnbin + " checkout file://" + repos + " " + fullstatedir; string checkoutcommand = svnbin + " checkout file://" + repos + " " + fullstatedir;
checkoutcommands.push_back(checkoutcommand); checkoutcommands.push_back(checkoutcommand);
subversionedpaths.push_back(fullstatedir); subversionedpaths.push_back(fullstatedir);
@ -78,6 +77,7 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
else else
subversionedpathsInterval.push_back(0); subversionedpathsInterval.push_back(0);
//TODO REPLACE TRUE INTO VAR OF CREATEING DIRS BEFORE OR AFTER INSTALL
if(true){ if(true){
printMsg(lvlError, format("Adding state subdir: %1% to %2% from repository %3%") % thisdir % fullstatedir % repos); printMsg(lvlError, format("Adding state subdir: %1% to %2% from repository %3%") % thisdir % fullstatedir % repos);
executeAndPrintShellCommand(checkoutcommand, "svn"); //TODO checkout as user executeAndPrintShellCommand(checkoutcommand, "svn"); //TODO checkout as user
@ -121,6 +121,7 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
} }
} }
//executes a shell command and captures and prints the output.
void executeAndPrintShellCommand(const string & command, const string & commandName) void executeAndPrintShellCommand(const string & command, const string & commandName)
{ {
string tempoutput = "svnoutput.txt"; string tempoutput = "svnoutput.txt";

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,7 @@
#include "util.hh" #include "util.hh"
#include "help.txt.hh" #include "help.txt.hh"
#include "local-store.hh" #include "local-store.hh"
#include "derivations.hh"
using namespace nix; using namespace nix;
using std::cin; using std::cin;
@ -30,16 +30,6 @@ void printHelp()
static void opCommitReferencesClosure(Strings opFlags, Strings opArgs) static void opCommitReferencesClosure(Strings opFlags, Strings opArgs)
{ {
/* /*
Database nixDB;
try {
nixDB.open(nixDBPath);
} catch (DbNoPermission & e) {
printMsg(lvlTalkative, "cannot access Nix database; continuing anyway");
//readOnlyMode = true;
return;
}
Paths referencesKeys; Paths referencesKeys;
Transaction txn(nixDB); Transaction txn(nixDB);
TableId dbReferences = nixDB.openTable("statecounters"); TableId dbReferences = nixDB.openTable("statecounters");
@ -50,24 +40,51 @@ static void opCommitReferencesClosure(Strings opFlags, Strings opArgs)
printMsg(lvlError, format("NIX-STATE: `%1%'") % *i); printMsg(lvlError, format("NIX-STATE: `%1%'") % *i);
}*/ }*/
PathSet a; //Data from user / profile
a.insert("/nix/state/m3h15msjdv1cliqdc3ijj906dzhsf6p0-hellohardcodedstateworld-1.0/log/"); string component = "/nix/store/1hyp7iiiig3rdf99y74yqhi2jkfpa8pf-hellohardcodedstateworld-1.0";
store->getStatePathsInterval(a); Path componentPath = component; //TODO call coerce function
string identifier = "test";
string binary = "hello";
//Wait for locks?
//Run the component
/* //********************* Commit state *********************
Transaction txn;
createStoreTransaction(txn); //get the derivation
for (DerivationOutputs::iterator i = drv.outputs.begin(); Derivation drv = store->getStateDerivation(componentPath);
i != drv.outputs.end(); ++i)
{ DerivationStateOutputDirs stateOutputDirs;
registerValidPath(txn, i->second.path, DerivationStateOutputs stateOutputs;
contentHashes[i->second.path],
allReferences[i->second.path], //get dependecies (if neccecary) of all state components that need to be updated
drvPath); PathSet paths = store->getStateReferencesClosure(componentPath);
}
txn.commit(); //get their derivations
*/ //...
//Get and update the intervals
//store->getStatePathsInterval(a);
//store->setStatePathsInterval(a);
//call the bash script on all the the store-state components
string svnbin = nixSVNPath + "/svn";
string svnadminbin = nixSVNPath + "/svnadmin";
//svnbin=/nix/var/nix/profiles/per-user/root/profile/bin/svn
//subversionedpaths=( /nix/state/v6rr3yi5ilgn3k0kwxkk633ap4z0m1zi-hellohardcodedstateworld-1.0/ /nix/state/v6rr3yi5ilgn3k0kwxkk633ap4z0m1zi-hellohardcodedstateworld-1.0/log/ )
//subversionedpathsInterval=( 0 0 )
//nonversionedpaths=( /nix/state/v6rr3yi5ilgn3k0kwxkk633ap4z0m1zi-hellohardcodedstateworld-1.0/cache/ /nix/state/v6rr3yi5ilgn3k0kwxkk633ap4z0m1zi-hellohardcodedstateworld-1.0/log/test/ /nix/state/v6rr3yi5ilgn3k0kwxkk633ap4z0m1zi-hellohardcodedstateworld-1.0/log/test2/test2/ /nix/state/v6rr3yi5ilgn3k0kwxkk633ap4z0m1zi-hellohardcodedstateworld-1.0/logging/ )
//checkouts=( "/nix/var/nix/profiles/per-user/root/profile/bin/svn checkout file:///nix/staterepos/99dj5zg1ginj5as75nkb0psnp02krv2s-hellohardcodedstateworld-1.0 /nix/state/v6rr3yi5ilgn3k0kwxkk633ap4z0m1zi-hellohardcodedstateworld-1.0/" "/nix/var/nix/profiles/per-user/root/profile/bin/svn checkout file:///nix/staterepos/9ph3nd4irpvgs66h24xjvxrwpnrwy9n0-hellohardcodedstateworld-1.0 /nix/state/v6rr3yi5ilgn3k0kwxkk633ap4z0m1zi-hellohardcodedstateworld-1.0/log/" )
//for(...){
//
//}
} }