aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2011-11-06 00:13:09 +0000
committerShea Levy <shea@shealevy.com>2011-11-06 00:13:09 +0000
commit2721e9f56f92f5bd630dcbb0104fc56159cb28d4 (patch)
treef46ac1a8807b81cc54d176e8fb72915aa057f0ac /src
parentbffe35acedafcd7c7237cb1415798362bff8a180 (diff)
parenta6a3f3a8c26fdd6900880c13e924e6879d6c714c (diff)
Merge from trunk
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/eval.cc9
-rw-r--r--src/libstore/derivations.cc3
-rw-r--r--src/libstore/local-store.cc6
-rw-r--r--src/libstore/local-store.hh2
4 files changed, 12 insertions, 8 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index c31ec261e..64e6cbe64 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -171,8 +171,8 @@ EvalState::EvalState()
size_t size = 32 * 1024 * 1024;
#if HAVE_SYSCONF && defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES)
long pageSize = sysconf(_SC_PAGESIZE);
- long pages = sysconf (_SC_PHYS_PAGES);
- if (pageSize != -1 && size != -1)
+ long pages = sysconf(_SC_PHYS_PAGES);
+ if (pageSize != -1)
size = (pageSize * pages) / 4; // 25% of RAM
if (size > maxSize) size = maxSize;
#endif
@@ -1109,7 +1109,10 @@ bool EvalState::isDerivation(Value & v)
{
if (v.type != tAttrs) return false;
Bindings::iterator i = v.attrs->find(sType);
- return i != v.attrs->end() && forceStringNoCtx(*i->value) == "derivation";
+ if (i == v.attrs->end()) return false;
+ forceValue(*i->value);
+ if (i->value->type != tString) return false;
+ return forceStringNoCtx(*i->value) == "derivation";
}
diff --git a/src/libstore/derivations.cc b/src/libstore/derivations.cc
index 5a0f4ecc6..97343d57d 100644
--- a/src/libstore/derivations.cc
+++ b/src/libstore/derivations.cc
@@ -239,7 +239,8 @@ Hash hashDerivationModulo(StoreAPI & store, Derivation drv)
foreach (DerivationInputs::const_iterator, i, drv.inputDrvs) {
Hash h = drvHashes[i->first];
if (h.type == htUnknown) {
- Derivation drv2 = derivationFromPath(store, i->first);
+ assert(store.isValidPath(i->first));
+ Derivation drv2 = parseDerivation(readFile(i->first));
h = hashDerivationModulo(store, drv2);
drvHashes[i->first] = h;
}
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 6ad4c84c6..702ff67e7 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -510,7 +510,7 @@ void LocalStore::checkDerivationOutputs(const Path & drvPath, const Derivation &
}
-unsigned long long LocalStore::addValidPath(const ValidPathInfo & info)
+unsigned long long LocalStore::addValidPath(const ValidPathInfo & info, bool checkOutputs)
{
SQLiteStmtUse use(stmtRegisterValidPath);
stmtRegisterValidPath.bind(info.path);
@@ -540,7 +540,7 @@ unsigned long long LocalStore::addValidPath(const ValidPathInfo & info)
derivations). Note that if this throws an error, then the
DB transaction is rolled back, so the path validity
registration above is undone. */
- checkDerivationOutputs(info.path, drv);
+ if (checkOutputs) checkDerivationOutputs(info.path, drv);
foreach (DerivationOutputs::iterator, i, drv.outputs) {
SQLiteStmtUse use(stmtAddDerivationOutput);
@@ -1521,7 +1521,7 @@ void LocalStore::upgradeStore6()
SQLiteTxn txn(db);
foreach (PathSet::iterator, i, validPaths) {
- addValidPath(queryPathInfoOld(*i));
+ addValidPath(queryPathInfoOld(*i), false);
std::cerr << ".";
}
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index 8cf6b6640..7ef01b264 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -226,7 +226,7 @@ private:
unsigned long long queryValidPathId(const Path & path);
- unsigned long long addValidPath(const ValidPathInfo & info);
+ unsigned long long addValidPath(const ValidPathInfo & info, bool checkOutputs = true);
void addReference(unsigned long long referrer, unsigned long long reference);