From 13b632ca575caafd144b0bfe0ed092f8aecdae9d Mon Sep 17 00:00:00 2001 From: Wouter den Breejen Date: Mon, 8 Oct 2007 12:24:02 +0000 Subject: [PATCH] Fixes to decodeValidPathInfo and cleanups --- src/libstore/build.cc | 25 ++++++++++++++++++++++--- src/libstore/local-store.cc | 37 ------------------------------------- src/libstore/store-api.cc | 2 -- 3 files changed, 22 insertions(+), 42 deletions(-) diff --git a/src/libstore/build.cc b/src/libstore/build.cc index b1c01abb2..4bd4e4de1 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -1096,17 +1096,36 @@ static string makeValidityRegistration(const PathSet & paths, for (PathSet::iterator i = paths.begin(); i != paths.end(); ++i) { 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"; + //store 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(); for (PathSet::iterator j = references.begin(); j != references.end(); ++j) 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; @@ -2495,7 +2514,7 @@ void Worker::getInfo() std::istringstream str(res); 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; /* !!! inefficient */ diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 756a59f71..338def8d6 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -392,43 +392,6 @@ bool LocalStore::isValidComponentOrStatePath(const Path & 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 */ diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 4c8f85809..a937f80be 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -208,7 +208,6 @@ Path computeStorePathForText(const string & suffix, const string & s, return makeStorePath(type, hash, suffix); } -//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ValidPathInfo decodeValidPathInfo(std::istream & str) { ValidPathInfo info; @@ -245,7 +244,6 @@ ValidPathInfo decodeValidPathInfo(std::istream & str) if (!str || str.eof()) throw Error("missing input"); return info; } -//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! }