diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index d67eee07d..c29956902 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -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. */ diff --git a/src/libstore/derivations-ast.def b/src/libstore/derivations-ast.def index dc13f53c9..d6f260094 100644 --- a/src/libstore/derivations-ast.def +++ b/src/libstore/derivations-ast.def @@ -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 | diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc index c4d5fe692..a23352d92 100644 --- a/src/libstore/derivations.cc +++ b/src/libstore/derivations.cc @@ -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) )); } diff --git a/src/libstore/derivations.hh b/src/libstore/derivations.hh index 6f4863152..2be00bf53 100644 --- a/src/libstore/derivations.hh +++ b/src/libstore/derivations.hh @@ -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(){ diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 87d891b96..4b2400b61 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -8,6 +8,9 @@ #include "aterm.hh" #include "derivations-ast.hh" #include "worker-protocol.hh" + +#include "derivations.hh" +#include "misc.hh" #include #include @@ -1107,7 +1110,7 @@ void setStatePathsInterval(const PathSet & statePaths, const vector & 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,19 +1130,21 @@ void LocalStore::setStatePathsInterval(const PathSet & statePaths, const vector< vector getStatePathsInterval(const PathSet & statePaths) { + Transaction txn(nixDB); //TODO should u do a transaction here? ... this might delay the process ... + string data; + Paths referers; + vector 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); - } - - txn.commit(); + printMsg(lvlError, format("Data %1%") % data); //TODO + } + txn.commit(); + return intervals; } @@ -1149,6 +1154,58 @@ vector 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() diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index f8c659e62..15466342f 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -79,6 +79,10 @@ public: void setStatePathsInterval(const PathSet & statePath, const vector & intervals, bool allZero = false); vector getStatePathsInterval(const PathSet & statePaths); + + Derivation getStateDerivation(const Path & path); + + PathSet getStateReferencesClosure(const Path & path); }; diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index 6de7617e8..ea4631b89 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -388,5 +388,19 @@ vector 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; +} + } diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh index 5ac39bf2d..7d3007d76 100644 --- a/src/libstore/remote-store.hh +++ b/src/libstore/remote-store.hh @@ -67,6 +67,11 @@ public: void setStatePathsInterval(const PathSet & statePath, const vector & intervals, bool allZero = false); vector getStatePathsInterval(const PathSet & statePaths); + + Derivation getStateDerivation(const Path & path); + + PathSet getStateReferencesClosure(const Path & path); + private: AutoCloseFD fdSocket; diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index a555b8051..900e273d7 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -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; - - checkStoreName(suffix); //should this be here? + + nixStoreState + ":" + suffix + ":" + stateIdentifier; + checkStoreName(suffix); + checkStoreName(stateIdentifier); + return nixStoreStateRepos + "/" + printHash32(compressHash(hashString(htSHA256, s), 20)) - + "-" + suffix; + + "-" + suffix + suffix_stateIdentifier; } Path makeFixedOutputPath(bool recursive, diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 7b2556bd2..4a683e2ce 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -8,6 +8,7 @@ #include "hash.hh" #include "serialise.hh" +#include "derivations.hh" namespace nix { @@ -185,6 +186,13 @@ public: /* TODO */ virtual vector 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(); diff --git a/src/libstore/store-state.cc b/src/libstore/store-state.cc index cbab7bb2e..6dc674af7 100644 --- a/src/libstore/store-state.cc +++ b/src/libstore/store-state.cc @@ -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 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){ @@ -66,7 +59,13 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De nonversionedpaths.push_back(fullstatedir); 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"; diff --git a/src/nix-state/help.txt.hh b/src/nix-state/help.txt.hh index 04e3850a5..5671798ca 100644 --- a/src/nix-state/help.txt.hh +++ b/src/nix-state/help.txt.hh @@ -1 +1 @@ -static unsigned char helpText[] = {0x55, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x20, 0x6e, 0x69, 0x78, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x5b, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x2e, 0x2e, 0x2e, 0x5d, 0x20, 0x5b, 0x41, 0x52, 0x47, 0x55, 0x4d, 0x45, 0x4e, 0x54, 0x53, 0x2e, 0x2e, 0x2e, 0x5d, 0x0a, 0x0a, 0x60, 0x6e, 0x69, 0x78, 0x2d, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x27, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x74, 0x6f, 0x6f, 0x6c, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x6e, 0x69, 0x70, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4e, 0x69, 0x78, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x0a, 0x0a, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x72, 0x65, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x20, 0x2f, 0x20, 0x2d, 0x72, 0x3a, 0x20, 0x65, 0x6e, 0x73, 0x75, 0x72, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x3b, 0x20, 0x69, 0x66, 0x20, 0x61, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x65, 0x6e, 0x73, 0x75, 0x72, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x61, 0x64, 0x64, 0x20, 0x2f, 0x20, 0x2d, 0x41, 0x3a, 0x20, 0x63, 0x6f, 0x70, 0x79, 0x20, 0x61, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4e, 0x69, 0x78, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x3a, 0x20, 0x73, 0x61, 0x66, 0x65, 0x6c, 0x79, 0x20, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4e, 0x69, 0x78, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x2f, 0x20, 0x2d, 0x71, 0x3a, 0x20, 0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x72, 0x65, 0x61, 0x64, 0x2d, 0x6c, 0x6f, 0x67, 0x20, 0x2f, 0x20, 0x2d, 0x6c, 0x3a, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x20, 0x6c, 0x6f, 0x67, 0x20, 0x6f, 0x66, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x2d, 0x73, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x73, 0x3a, 0x20, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x20, 0x61, 0x20, 0x73, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x20, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x64, 0x61, 0x6e, 0x67, 0x65, 0x72, 0x6f, 0x75, 0x73, 0x21, 0x29, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x2d, 0x73, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x73, 0x3a, 0x20, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x73, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x65, 0x73, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x2d, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x3a, 0x20, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x20, 0x28, 0x64, 0x61, 0x6e, 0x67, 0x65, 0x72, 0x6f, 0x75, 0x73, 0x21, 0x29, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x2d, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x3a, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x67, 0x63, 0x3a, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x61, 0x72, 0x62, 0x61, 0x67, 0x65, 0x20, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x64, 0x75, 0x6d, 0x70, 0x3a, 0x20, 0x64, 0x75, 0x6d, 0x70, 0x20, 0x61, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x61, 0x73, 0x20, 0x61, 0x20, 0x4e, 0x69, 0x78, 0x20, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x3a, 0x20, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x61, 0x20, 0x4e, 0x69, 0x78, 0x20, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x69, 0x6e, 0x69, 0x74, 0x3a, 0x20, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4e, 0x69, 0x78, 0x20, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x3a, 0x20, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x20, 0x4e, 0x69, 0x78, 0x20, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x73, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x68, 0x65, 0x6c, 0x70, 0x3a, 0x20, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x20, 0x68, 0x65, 0x6c, 0x70, 0x0a, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x20, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x3a, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x3a, 0x20, 0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x4e, 0x69, 0x78, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x29, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x72, 0x65, 0x71, 0x75, 0x69, 0x73, 0x69, 0x74, 0x65, 0x73, 0x20, 0x2f, 0x20, 0x2d, 0x52, 0x3a, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x6e, 0x65, 0x63, 0x65, 0x73, 0x73, 0x61, 0x72, 0x79, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x65, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x20, 0x61, 0x20, 0x70, 0x61, 0x74, 0x68, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x3a, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x70, 0x61, 0x74, 0x68, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x73, 0x3a, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6c, 0x79, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x70, 0x61, 0x74, 0x68, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x72, 0x73, 0x2d, 0x63, 0x6c, 0x6f, 0x73, 0x75, 0x72, 0x65, 0x3a, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x28, 0x69, 0x6e, 0x29, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6c, 0x79, 0x20, 0x72, 0x65, 0x66, 0x65, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x70, 0x61, 0x74, 0x68, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x74, 0x72, 0x65, 0x65, 0x3a, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20, 0x61, 0x20, 0x74, 0x72, 0x65, 0x65, 0x20, 0x73, 0x68, 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x20, 0x67, 0x72, 0x61, 0x70, 0x68, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x67, 0x72, 0x61, 0x70, 0x68, 0x3a, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20, 0x61, 0x20, 0x64, 0x6f, 0x74, 0x20, 0x67, 0x72, 0x61, 0x70, 0x68, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x65, 0x64, 0x20, 0x61, 0x74, 0x20, 0x67, 0x69, 0x76, 0x65, 0x6e, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x0a, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x20, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x65, 0x73, 0x20, 0x28, 0x6e, 0x6f, 0x74, 0x20, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x74, 0x6f, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x29, 0x3a, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x75, 0x73, 0x65, 0x2d, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x3a, 0x20, 0x70, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x71, 0x75, 0x65, 0x72, 0x79, 0x20, 0x6f, 0x6e, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x74, 0x73, 0x65, 0x6c, 0x66, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x2d, 0x72, 0x65, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x3a, 0x20, 0x72, 0x65, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x69, 0x6e, 0x67, 0x20, 0x74, 0x68, 0x65, 0x20, 0x71, 0x75, 0x65, 0x72, 0x79, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x2d, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x3a, 0x20, 0x69, 0x6e, 0x20, 0x60, 0x2d, 0x52, 0x27, 0x20, 0x6f, 0x6e, 0x20, 0x61, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x20, 0x72, 0x65, 0x71, 0x75, 0x69, 0x73, 0x69, 0x74, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x0a, 0x0a, 0x47, 0x61, 0x72, 0x62, 0x61, 0x67, 0x65, 0x20, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2d, 0x72, 0x6f, 0x6f, 0x74, 0x73, 0x3a, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20, 0x47, 0x43, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x65, 0x78, 0x69, 0x74, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2d, 0x6c, 0x69, 0x76, 0x65, 0x3a, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20, 0x6c, 0x69, 0x76, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x65, 0x78, 0x69, 0x74, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x2d, 0x64, 0x65, 0x61, 0x64, 0x3a, 0x20, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20, 0x64, 0x65, 0x61, 0x64, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x65, 0x78, 0x69, 0x74, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x3a, 0x20, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x64, 0x65, 0x61, 0x64, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x20, 0x28, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x29, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x0a, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x76, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x65, 0x20, 0x2f, 0x20, 0x2d, 0x76, 0x3a, 0x20, 0x76, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x65, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x28, 0x6d, 0x61, 0x79, 0x20, 0x62, 0x65, 0x20, 0x72, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x64, 0x29, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x6b, 0x65, 0x65, 0x70, 0x2d, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x20, 0x2f, 0x20, 0x2d, 0x4b, 0x3a, 0x20, 0x6b, 0x65, 0x65, 0x70, 0x20, 0x74, 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x61, 0x72, 0x79, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x20, 0x6f, 0x66, 0x20, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x20, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x61, 0x64, 0x64, 0x2d, 0x72, 0x6f, 0x6f, 0x74, 0x3a, 0x20, 0x61, 0x64, 0x64, 0x20, 0x67, 0x61, 0x72, 0x62, 0x61, 0x67, 0x65, 0x20, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x72, 0x6f, 0x6f, 0x74, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x0a, }; +static unsigned char helpText[] = {0x55, 0x73, 0x61, 0x67, 0x65, 0x3a, 0x20, 0x6e, 0x69, 0x78, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x65, 0x20, 0x5b, 0x4f, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x53, 0x2e, 0x2e, 0x2e, 0x5d, 0x20, 0x5b, 0x41, 0x52, 0x47, 0x55, 0x4d, 0x45, 0x4e, 0x54, 0x53, 0x2e, 0x2e, 0x2e, 0x5d, 0x0a, 0x0a, 0x60, 0x6e, 0x69, 0x78, 0x2d, 0x73, 0x74, 0x61, 0x74, 0x65, 0x27, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x74, 0x6f, 0x6f, 0x6c, 0x20, 0x74, 0x6f, 0x20, 0x6d, 0x61, 0x6e, 0x69, 0x70, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x4e, 0x69, 0x78, 0x20, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2d, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x0a, 0x0a, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x72, 0x65, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x20, 0x2f, 0x20, 0x2d, 0x72, 0x3a, 0x20, 0x65, 0x6e, 0x73, 0x75, 0x72, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x3b, 0x20, 0x69, 0x66, 0x20, 0x61, 0x20, 0x64, 0x65, 0x72, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x65, 0x6e, 0x73, 0x75, 0x72, 0x65, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x69, 0x74, 0x79, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x0a, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x20, 0x20, 0x2d, 0x2d, 0x68, 0x65, 0x6c, 0x70, 0x3a, 0x20, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x20, 0x68, 0x65, 0x6c, 0x70, 0x0a, 0x0a, }; diff --git a/src/nix-state/nix-state.cc b/src/nix-state/nix-state.cc index a302c7b4d..d63a09c8a 100644 --- a/src/nix-state/nix-state.cc +++ b/src/nix-state/nix-state.cc @@ -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"); @@ -49,25 +39,52 @@ 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(...){ + // + //} + }