aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-06-17 14:04:46 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2020-06-17 14:04:46 -0400
commit8974755d1958824e732640f8131b0ed22ebd703b (patch)
treeeeb9b190e348b43655e24f10083a58383fb07d7b /src/libstore
parent7bd88cc1dc746ed2883e1eaebb3230ec2c2bb035 (diff)
Add assert for replaced storePath
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build.cc10
-rw-r--r--src/libstore/local-store.cc2
-rw-r--r--src/libstore/store-api.cc6
3 files changed, 16 insertions, 2 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 9753db7b1..bc67ae31e 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -4409,8 +4409,11 @@ void SubstitutionGoal::tryNext()
subs.pop_front();
auto subPath = storePath;
- if (ca && (hasPrefix(*ca, "fixed:") || hasPrefix(*ca, "text:")))
+ if (ca && (hasPrefix(*ca, "fixed:") || hasPrefix(*ca, "text:"))) {
subPath = sub->makeFixedOutputPathFromCA(storePath.name(), *ca);
+ if (sub->storeDir == worker.store.storeDir)
+ assert(subPath == storePath);
+ }
try {
// FIXME: make async
@@ -4535,8 +4538,11 @@ void SubstitutionGoal::tryToRun()
PushActivity pact(act.id);
auto subPath = storePath;
- if (ca && (hasPrefix(*ca, "fixed:") || hasPrefix(*ca, "text:")))
+ if (ca && (hasPrefix(*ca, "fixed:") || hasPrefix(*ca, "text:"))) {
subPath = sub->makeFixedOutputPathFromCA(storePath.name(), *ca);
+ if (sub->storeDir == worker.store.storeDir)
+ assert(subPath == storePath);
+ }
copyStorePath(ref<Store>(sub), ref<Store>(worker.store.shared_from_this()),
subPath, repair, sub->isTrusted ? NoCheckSigs : CheckSigs);
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index a80026258..d08c7dc6a 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -853,6 +853,8 @@ void LocalStore::querySubstitutablePathInfos(const StorePathSet & paths,
// recompute store path so that we can use a different store root
if (ca != pathsCA.end() && (hasPrefix(ca->second, "fixed:") || hasPrefix(ca->second, "text:"))) {
subPath = makeFixedOutputPathFromCA(path.name(), ca->second);
+ if (sub->storeDir == storeDir)
+ assert(subPath == path);
if (subPath != path)
debug("replaced path '%s' with '%s' for substituter '%s'", printStorePath(path), sub->printStorePath(subPath), sub->getUri());
} else if (sub->storeDir != storeDir) continue;
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index a28895086..80a69717e 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -598,6 +598,8 @@ void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
if (info->isContentAddressed(*srcStore)) {
auto info2 = make_ref<ValidPathInfo>(*info);
info2->path = dstStore->makeFixedOutputPathFromCA(info->path.name(), info->ca);
+ if (dstStore->storeDir == srcStore->storeDir)
+ assert(info->path == info2->path);
info = info2;
}
@@ -670,6 +672,8 @@ void copyPaths(ref<Store> srcStore, ref<Store> dstStore, const StorePathSet & st
auto storePathForDst = storePath;
if (info->isContentAddressed(*srcStore)) {
storePathForDst = dstStore->makeFixedOutputPathFromCA(storePath.name(), info->ca);
+ if (dstStore->storeDir == srcStore->storeDir)
+ assert(storePathForDst == storePath);
if (storePathForDst != storePath)
debug("replaced path '%s' to '%s' for substituter '%s'", srcStore->printStorePath(storePath), dstStore->printStorePath(storePathForDst), dstStore->getUri());
}
@@ -695,6 +699,8 @@ void copyPaths(ref<Store> srcStore, ref<Store> dstStore, const StorePathSet & st
auto storePathForDst = storePath;
if (info->isContentAddressed(*srcStore)) {
storePathForDst = dstStore->makeFixedOutputPathFromCA(storePath.name(), info->ca);
+ if (dstStore->storeDir == srcStore->storeDir)
+ assert(storePathForDst == storePath);
if (storePathForDst != storePath)
debug("replaced path '%s' to '%s' for substituter '%s'", srcStore->printStorePath(storePath), dstStore->printStorePath(storePathForDst), dstStore->getUri());
}