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:
parent
fbd1b78a9d
commit
cbd0d39583
13 changed files with 210 additions and 79 deletions
|
|
@ -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
|
||||
string shareState = "none";
|
||||
string syncState = "all";
|
||||
string stateIndentifier = "";
|
||||
string stateIdentifier = "";
|
||||
bool createDirsBeforeInstall = false;
|
||||
string runtimeStateParamters = "";
|
||||
|
||||
for (ATermMap::const_iterator i = attrs.begin(); i != attrs.end(); ++i) {
|
||||
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 == "synchronization") { string s = coerceToString(state, value, context, true); syncState = s; }
|
||||
else if(key == "disableState") { bool b = evalBool(state, value); disableState = b; }
|
||||
else if(key == "indentifier"){ string s = coerceToString(state, value, context, true); stateIndentifier = s; }
|
||||
else if(key == "createDirsBeforeInstall"){ bool b = evalBool(state, value); createDirsBeforeInstall = b; }
|
||||
else if(key == "shareState") { shareState = coerceToString(state, value, context, true); }
|
||||
else if(key == "synchronization") { syncState = coerceToString(state, value, context, true); }
|
||||
else if(key == "disableState") { disableState = evalBool(state, value); }
|
||||
else if(key == "identifier"){ stateIdentifier = coerceToString(state, value, context, true); }
|
||||
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
|
||||
the environment. */
|
||||
|
|
@ -565,16 +567,16 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
|||
//We add state when it's enbaled by the keywords, and NOT disabled by the user
|
||||
if(enableState && !disableState){
|
||||
/* Add the state path based on the outPath */
|
||||
string callingUser = "wouterdb"; //TODO: Change into variable
|
||||
string componentHash = printHash(hashDerivationModulo(state, drv)); //hash of the component path
|
||||
Hash statehash = hashString(htSHA256, stateIndentifier + callingUser + componentHash); //hash of the state path
|
||||
Path stateOutPath = makeStatePath("stateOutput:statepath", statehash, drvName); //State path
|
||||
string callingUser = "wouterdb"; //TODO: Change into variable
|
||||
string componentHash = printHash(hashDerivationModulo(state, drv)); //hash of the component path
|
||||
Hash statehash = hashString(htSHA256, callingUser + componentHash); //hash of the state path
|
||||
Path stateOutPath = makeStatePath("stateOutput:statepath", statehash, drvName, stateIdentifier); //State path
|
||||
|
||||
drv.env["statepath"] = stateOutPath;
|
||||
string enableStateS = bool2string("true");
|
||||
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. */
|
||||
|
|
|
|||
|
|
@ -6,18 +6,19 @@ Derive | ATermList ATermList ATermList ATermList ATermList string string ATermLi
|
|||
| string string | ATerm | EnvBinding |
|
||||
| string ATermList | ATerm | DerivationInput |
|
||||
| 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 |
|
||||
|
||||
#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
|
||||
#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 |
|
||||
|
||||
|
||||
#end drv without state
|
||||
|
||||
Closure | ATermList ATermList | ATerm | OldClosure |
|
||||
| string ATermList | ATerm | OldClosureElem |
|
||||
|
|
|
|||
|
|
@ -92,18 +92,20 @@ Derivation parseDerivation(ATerm t)
|
|||
if(withState){
|
||||
//parse state part
|
||||
for (ATermIterator i(stateOuts); i; ++i) {
|
||||
ATerm id, statepath, hashAlgo, hash, enabled, shared, synchronization, createDirsBeforeInstall;
|
||||
if (!matchDerivationStateOutput(*i, 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, stateIdentifier, enabled, shared, synchronization, createDirsBeforeInstall, runtimeStateParamters))
|
||||
throwBadDrv(t);
|
||||
DerivationStateOutput stateOut;
|
||||
stateOut.statepath = aterm2String(statepath);
|
||||
//checkPath(stateOut.path); //should we check the statpath .... ???
|
||||
stateOut.hashAlgo = aterm2String(hashAlgo);
|
||||
stateOut.hash = aterm2String(hash);
|
||||
stateOut.stateIdentifier = aterm2String(stateIdentifier);
|
||||
stateOut.enabled = aterm2String(enabled);
|
||||
stateOut.shared = aterm2String(shared);
|
||||
stateOut.synchronization = aterm2String(synchronization);
|
||||
stateOut.createDirsBeforeInstall = aterm2String(createDirsBeforeInstall);
|
||||
stateOut.runtimeStateParamters = aterm2String(runtimeStateParamters);
|
||||
drv.stateOutputs[aterm2String(id)] = stateOut;
|
||||
}
|
||||
}
|
||||
|
|
@ -182,10 +184,12 @@ ATerm unparseDerivation(const Derivation & drv)
|
|||
toATerm(i->second.statepath),
|
||||
toATerm(i->second.hashAlgo),
|
||||
toATerm(i->second.hash),
|
||||
toATerm(i->second.stateIdentifier),
|
||||
toATerm(i->second.enabled),
|
||||
toATerm(i->second.shared),
|
||||
toATerm(i->second.synchronization),
|
||||
toATerm(i->second.createDirsBeforeInstall)
|
||||
toATerm(i->second.createDirsBeforeInstall),
|
||||
toATerm(i->second.runtimeStateParamters)
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,22 +39,30 @@ struct DerivationStateOutput
|
|||
Path statepath;
|
||||
string hashAlgo;
|
||||
string hash;
|
||||
string enabled;
|
||||
string stateIdentifier; //the identifier
|
||||
string enabled; //enable or disable state
|
||||
string shared; //none, full, group
|
||||
string synchronization; //none, exclusive-lock-on-own-state-dir, exclusive-lock-on-all-(sub)-states-dir
|
||||
string createDirsBeforeInstall;
|
||||
string synchronization; //none (no locks), exclusive-lock-on-own-state-dir, exclusive-lock-on-all-(sub)-states-dir
|
||||
|
||||
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(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->hashAlgo = hashAlgo;
|
||||
this->hash = hash;
|
||||
this->stateIdentifier = stateIdentifier;
|
||||
this->enabled = enabled;
|
||||
this->shared = shared;
|
||||
this->synchronization = synchronization;
|
||||
this->createDirsBeforeInstall = createDirsBeforeInstall;
|
||||
this->runtimeStateParamters = runtimeStateParamters;
|
||||
}
|
||||
|
||||
bool getEnabled(){
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
#include "derivations-ast.hh"
|
||||
#include "worker-protocol.hh"
|
||||
|
||||
#include "derivations.hh"
|
||||
#include "misc.hh"
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
|
|
@ -1107,7 +1110,7 @@ void setStatePathsInterval(const PathSet & statePaths, const vector<int> & inter
|
|||
int n=0;
|
||||
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;
|
||||
if(!allZero)
|
||||
|
|
@ -1127,17 +1130,19 @@ void LocalStore::setStatePathsInterval(const PathSet & statePaths, const vector<
|
|||
|
||||
vector<int> getStatePathsInterval(const PathSet & statePaths)
|
||||
{
|
||||
|
||||
Transaction txn(nixDB); //TODO should u do a transaction here? ... this might delay the process ...
|
||||
|
||||
string data;
|
||||
Paths referers;
|
||||
|
||||
vector<int> intervals;
|
||||
string data;
|
||||
|
||||
for (PathSet::iterator i = statePaths.begin(); i != statePaths.end(); ++i){
|
||||
|
||||
for (PathSet::iterator i = statePaths.begin(); i != statePaths.end(); ++i)
|
||||
{
|
||||
nixDB.queryString(txn, dbStateCounters, *i, data);
|
||||
printMsg(lvlError, format("Data %1%") % data);
|
||||
}
|
||||
printMsg(lvlError, format("Data %1%") % data); //TODO
|
||||
|
||||
}
|
||||
txn.commit();
|
||||
|
||||
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). */
|
||||
static void upgradeStore07()
|
||||
|
|
|
|||
|
|
@ -79,6 +79,10 @@ public:
|
|||
void setStatePathsInterval(const PathSet & statePath, const vector<int> & intervals, bool allZero = false);
|
||||
|
||||
vector<int> getStatePathsInterval(const PathSet & statePaths);
|
||||
|
||||
Derivation getStateDerivation(const Path & path);
|
||||
|
||||
PathSet getStateReferencesClosure(const Path & path);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -388,5 +388,19 @@ vector<int> RemoteStore::getStatePathsInterval(const PathSet & statePaths)
|
|||
return intervals;
|
||||
}
|
||||
|
||||
//TODO
|
||||
Derivation RemoteStore::getStateDerivation(const Path & path)
|
||||
{
|
||||
Derivation d;
|
||||
return d;
|
||||
}
|
||||
|
||||
//TODO
|
||||
PathSet RemoteStore::getStateReferencesClosure(const Path & path)
|
||||
{
|
||||
PathSet empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,11 @@ public:
|
|||
|
||||
vector<int> getStatePathsInterval(const PathSet & statePaths);
|
||||
|
||||
Derivation getStateDerivation(const Path & path);
|
||||
|
||||
PathSet getStateReferencesClosure(const Path & path);
|
||||
|
||||
|
||||
private:
|
||||
AutoCloseFD fdSocket;
|
||||
FdSink to;
|
||||
|
|
|
|||
|
|
@ -75,34 +75,44 @@ Path makeStorePath(const string & type, const Hash & hash, const string & suffix
|
|||
checkStoreName(suffix);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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" */
|
||||
string s = type + ":sha256:" + printHash(hash) + ":"
|
||||
+ nixStoreState + ":" + suffix;
|
||||
+ nixStoreState + ":" + suffix + ":" + stateIdentifier;
|
||||
|
||||
checkStoreName(suffix); //should this be here?
|
||||
checkStoreName(suffix);
|
||||
checkStoreName(stateIdentifier);
|
||||
|
||||
return nixStoreState + "/"
|
||||
+ 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" */
|
||||
string s = type + ":sha256:" + printHash(hash) + ":"
|
||||
+ nixStoreState + ":" + suffix;
|
||||
+ nixStoreState + ":" + suffix + ":" + stateIdentifier;
|
||||
|
||||
checkStoreName(suffix); //should this be here?
|
||||
checkStoreName(suffix);
|
||||
checkStoreName(stateIdentifier);
|
||||
|
||||
return nixStoreStateRepos + "/"
|
||||
+ printHash32(compressHash(hashString(htSHA256, s), 20))
|
||||
+ "-" + suffix;
|
||||
+ "-" + suffix + suffix_stateIdentifier;
|
||||
}
|
||||
|
||||
Path makeFixedOutputPath(bool recursive,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "hash.hh"
|
||||
#include "serialise.hh"
|
||||
#include "derivations.hh"
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
|
@ -185,6 +186,13 @@ public:
|
|||
|
||||
/* TODO */
|
||||
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);
|
||||
|
||||
/* 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. */
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
|
|||
Path statePath = stateOutputs.find("state")->second.statepath;
|
||||
string stateDir = statePath;
|
||||
string drvName = env.find("name")->second;
|
||||
string stateIdentifier = stateOutputs.find("state")->second.stateIdentifier;
|
||||
|
||||
//Convert the map into a sortable vector
|
||||
vector<DerivationStateOutputDir> stateDirsVector;
|
||||
|
|
@ -49,15 +50,7 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
|
|||
string fullstatedir = stateDir + "/" + thisdir;
|
||||
Path statePath = fullstatedir; //TODO call coerce function
|
||||
|
||||
//calc create repos for this state location
|
||||
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
|
||||
|
||||
//TODO REPLACE TRUE INTO VAR OF CREATEING DIRS BEFORE OR AFTER INSTALL
|
||||
//Check if and how this dir needs to be versioned
|
||||
if(d.type == "none"){
|
||||
if(true){
|
||||
|
|
@ -67,6 +60,12 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
|
|||
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;
|
||||
checkoutcommands.push_back(checkoutcommand);
|
||||
subversionedpaths.push_back(fullstatedir);
|
||||
|
|
@ -78,6 +77,7 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
|
|||
else
|
||||
subversionedpathsInterval.push_back(0);
|
||||
|
||||
//TODO REPLACE TRUE INTO VAR OF CREATEING DIRS BEFORE OR AFTER INSTALL
|
||||
if(true){
|
||||
printMsg(lvlError, format("Adding state subdir: %1% to %2% from repository %3%") % thisdir % fullstatedir % repos);
|
||||
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)
|
||||
{
|
||||
string tempoutput = "svnoutput.txt";
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -9,7 +9,7 @@
|
|||
#include "util.hh"
|
||||
#include "help.txt.hh"
|
||||
#include "local-store.hh"
|
||||
|
||||
#include "derivations.hh"
|
||||
|
||||
using namespace nix;
|
||||
using std::cin;
|
||||
|
|
@ -30,16 +30,6 @@ void printHelp()
|
|||
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;
|
||||
Transaction txn(nixDB);
|
||||
TableId dbReferences = nixDB.openTable("statecounters");
|
||||
|
|
@ -50,24 +40,51 @@ static void opCommitReferencesClosure(Strings opFlags, Strings opArgs)
|
|||
printMsg(lvlError, format("NIX-STATE: `%1%'") % *i);
|
||||
}*/
|
||||
|
||||
PathSet a;
|
||||
a.insert("/nix/state/m3h15msjdv1cliqdc3ijj906dzhsf6p0-hellohardcodedstateworld-1.0/log/");
|
||||
store->getStatePathsInterval(a);
|
||||
//Data from user / profile
|
||||
string component = "/nix/store/1hyp7iiiig3rdf99y74yqhi2jkfpa8pf-hellohardcodedstateworld-1.0";
|
||||
Path componentPath = component; //TODO call coerce function
|
||||
string identifier = "test";
|
||||
string binary = "hello";
|
||||
|
||||
//Wait for locks?
|
||||
|
||||
//Run the component
|
||||
|
||||
|
||||
/*
|
||||
Transaction txn;
|
||||
createStoreTransaction(txn);
|
||||
for (DerivationOutputs::iterator i = drv.outputs.begin();
|
||||
i != drv.outputs.end(); ++i)
|
||||
{
|
||||
registerValidPath(txn, i->second.path,
|
||||
contentHashes[i->second.path],
|
||||
allReferences[i->second.path],
|
||||
drvPath);
|
||||
}
|
||||
txn.commit();
|
||||
*/
|
||||
//********************* Commit state *********************
|
||||
|
||||
//get the derivation
|
||||
Derivation drv = store->getStateDerivation(componentPath);
|
||||
|
||||
DerivationStateOutputDirs stateOutputDirs;
|
||||
DerivationStateOutputs stateOutputs;
|
||||
|
||||
//get dependecies (if neccecary) of all state components that need to be updated
|
||||
PathSet paths = store->getStateReferencesClosure(componentPath);
|
||||
|
||||
//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(...){
|
||||
//
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue