mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 04:00:59 +01:00
Fixes to decodeValidPathInfo and cleanups
This commit is contained in:
parent
dacf2e0e87
commit
13b632ca57
3 changed files with 22 additions and 42 deletions
|
|
@ -1096,17 +1096,36 @@ static string makeValidityRegistration(const PathSet & paths,
|
||||||
for (PathSet::iterator i = paths.begin(); i != paths.end(); ++i) {
|
for (PathSet::iterator i = paths.begin(); i != paths.end(); ++i) {
|
||||||
s += *i + "\n";
|
s += *i + "\n";
|
||||||
|
|
||||||
Path deriver = showDerivers ? store->queryDeriver(*i) : "";
|
Path deriver = showDerivers ? store->queryDeriver(*i) : ""; //TODO HOW ABOUT MULTIPLE STATE-STORE DERIVERS? take last one ??!!
|
||||||
s += deriver + "\n";
|
s += deriver + "\n";
|
||||||
|
|
||||||
|
//store references
|
||||||
|
|
||||||
PathSet references;
|
PathSet references;
|
||||||
store->queryStoreReferences(*i, references, 0); //TODO check if this is ok
|
store->queryStoreReferences(*i, references, 0);
|
||||||
|
|
||||||
s += (format("%1%\n") % references.size()).str();
|
s += (format("%1%\n") % references.size()).str();
|
||||||
|
|
||||||
for (PathSet::iterator j = references.begin();
|
for (PathSet::iterator j = references.begin();
|
||||||
j != references.end(); ++j)
|
j != references.end(); ++j)
|
||||||
s += *j + "\n";
|
s += *j + "\n";
|
||||||
|
|
||||||
|
//state references
|
||||||
|
|
||||||
|
PathSet stateReferences;
|
||||||
|
store->queryStateReferences(*i, stateReferences, 0);
|
||||||
|
|
||||||
|
s += (format("%1%\n") % stateReferences.size()).str();
|
||||||
|
|
||||||
|
for (PathSet::iterator j = stateReferences.begin();
|
||||||
|
j != stateReferences.end(); ++j)
|
||||||
|
s += *j + "\n";
|
||||||
|
|
||||||
|
//revision
|
||||||
|
|
||||||
|
string revision = unsignedInt2String(0);
|
||||||
|
s += revision + "\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
@ -2495,7 +2514,7 @@ void Worker::getInfo()
|
||||||
std::istringstream str(res);
|
std::istringstream str(res);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
ValidPathInfo info = decodeValidPathInfo(str);
|
ValidPathInfo info = decodeValidPathInfo(str); //TODO Test is this is ok with the state-brand extension to struct ValidPath
|
||||||
if (info.path == "") break;
|
if (info.path == "") break;
|
||||||
|
|
||||||
/* !!! inefficient */
|
/* !!! inefficient */
|
||||||
|
|
|
||||||
|
|
@ -392,43 +392,6 @@ bool LocalStore::isValidComponentOrStatePath(const Path & path)
|
||||||
return isValidComponentOrStatePathTxn(noTxn, path);
|
return isValidComponentOrStatePathTxn(noTxn, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO REMOVE BLOCK
|
|
||||||
/*
|
|
||||||
static bool isRealisablePath(const Transaction & txn, const Path & path)
|
|
||||||
{
|
|
||||||
return isValidPathTxn(txn, path) || readSubstitutes(txn, path).size() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool isRealisableStatePath(const Transaction & txn, const Path & path)
|
|
||||||
{
|
|
||||||
return isValidStatePathTxn(txn, path) || readSubstitutes(txn, path).size() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static bool isRealisableComponentOrStatePath(const Transaction & txn, const Path & path)
|
|
||||||
{
|
|
||||||
return isValidComponentOrStatePathTxn(txn, path) || readSubstitutes(txn, path).size() > 0; //TODO State paths are not yet in substitutes !!!!!!!!!!!!!! ??
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
static string addPrefix(const string & prefix, const string & s)
|
|
||||||
{
|
|
||||||
return prefix + string(1, (char) 0) + s;
|
|
||||||
}
|
|
||||||
|
|
||||||
static string stripPrefix(const string & prefix, const string & s)
|
|
||||||
{
|
|
||||||
if (s.size() <= prefix.size() ||
|
|
||||||
string(s, 0, prefix.size()) != prefix ||
|
|
||||||
s[prefix.size()] != 0)
|
|
||||||
throw Error(format("string `%1%' is missing prefix `%2%'")
|
|
||||||
% s % prefix);
|
|
||||||
return string(s, prefix.size() + 1);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The revision can be omitted for normal store paths
|
* The revision can be omitted for normal store paths
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,6 @@ Path computeStorePathForText(const string & suffix, const string & s,
|
||||||
return makeStorePath(type, hash, suffix);
|
return makeStorePath(type, hash, suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
ValidPathInfo decodeValidPathInfo(std::istream & str)
|
ValidPathInfo decodeValidPathInfo(std::istream & str)
|
||||||
{
|
{
|
||||||
ValidPathInfo info;
|
ValidPathInfo info;
|
||||||
|
|
@ -245,7 +244,6 @@ ValidPathInfo decodeValidPathInfo(std::istream & str)
|
||||||
if (!str || str.eof()) throw Error("missing input");
|
if (!str || str.eof()) throw Error("missing input");
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue