build-remote: Don't require signatures

This restores the old behaviour.
This commit is contained in:
Eelco Dolstra 2017-05-01 20:03:25 +02:00
parent 031d70e500
commit 3a5f04f48c
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
6 changed files with 20 additions and 16 deletions

View file

@ -279,7 +279,7 @@ connected:
printError("somebody is hogging the upload lock for %s, continuing..."); printError("somebody is hogging the upload lock for %s, continuing...");
alarm(0); alarm(0);
signal(SIGALRM, old); signal(SIGALRM, old);
copyPaths(store, ref<Store>(sshStore), inputs); copyPaths(store, ref<Store>(sshStore), inputs, false, true);
uploadLock = -1; uploadLock = -1;
BasicDerivation drv(readDerivation(drvPath)); BasicDerivation drv(readDerivation(drvPath));
@ -294,7 +294,7 @@ connected:
if (!missing.empty()) { if (!missing.empty()) {
setenv("NIX_HELD_LOCKS", concatStringsSep(" ", missing).c_str(), 1); /* FIXME: ugly */ setenv("NIX_HELD_LOCKS", concatStringsSep(" ", missing).c_str(), 1); /* FIXME: ugly */
copyPaths(ref<Store>(sshStore), store, missing); copyPaths(ref<Store>(sshStore), store, missing, false, true);
} }
return; return;

View file

@ -223,9 +223,6 @@ struct LegacySSHStore : public Store
void addSignatures(const Path & storePath, const StringSet & sigs) override void addSignatures(const Path & storePath, const StringSet & sigs) override
{ unsupported(); } { unsupported(); }
bool isTrusted() override
{ return true; }
void computeFSClosure(const PathSet & paths, void computeFSClosure(const PathSet & paths,
PathSet & out, bool flipDirection = false, PathSet & out, bool flipDirection = false,
bool includeOutputs = false, bool includeDerivers = false) override bool includeOutputs = false, bool includeDerivers = false) override

View file

@ -915,6 +915,8 @@ void LocalStore::invalidatePath(State & state, const Path & path)
void LocalStore::addToStore(const ValidPathInfo & info, const ref<std::string> & nar, void LocalStore::addToStore(const ValidPathInfo & info, const ref<std::string> & nar,
bool repair, bool dontCheckSigs, std::shared_ptr<FSAccessor> accessor) bool repair, bool dontCheckSigs, std::shared_ptr<FSAccessor> accessor)
{ {
assert(info.narHash);
Hash h = hashString(htSHA256, *nar); Hash h = hashString(htSHA256, *nar);
if (h != info.narHash) if (h != info.narHash)
throw Error(format("hash mismatch importing path %s; expected hash %s, got %s") % throw Error(format("hash mismatch importing path %s; expected hash %s, got %s") %

View file

@ -542,15 +542,22 @@ void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
StringSink sink; StringSink sink;
srcStore->narFromPath({storePath}, sink); srcStore->narFromPath({storePath}, sink);
if (srcStore->isTrusted())
dontCheckSigs = true;
if (!info->narHash && dontCheckSigs) { if (!info->narHash && dontCheckSigs) {
auto info2 = make_ref<ValidPathInfo>(*info); auto info2 = make_ref<ValidPathInfo>(*info);
info2->narHash = hashString(htSHA256, *sink.s); info2->narHash = hashString(htSHA256, *sink.s);
info = info2; info = info2;
} }
assert(info->narHash);
if (info->ultimate) {
auto info2 = make_ref<ValidPathInfo>(*info);
info2->ultimate = false;
info = info2;
}
assert(info->narHash);
dstStore->addToStore(*info, sink.s, repair, dontCheckSigs); dstStore->addToStore(*info, sink.s, repair, dontCheckSigs);
} }
@ -802,7 +809,8 @@ std::list<ref<Store>> getDefaultSubstituters()
} }
void copyPaths(ref<Store> from, ref<Store> to, const PathSet & storePaths, bool substitute) void copyPaths(ref<Store> from, ref<Store> to, const PathSet & storePaths,
bool substitute, bool dontCheckSigs)
{ {
PathSet valid = to->queryValidPaths(storePaths, substitute); PathSet valid = to->queryValidPaths(storePaths, substitute);
@ -830,7 +838,7 @@ void copyPaths(ref<Store> from, ref<Store> to, const PathSet & storePaths, bool
if (!to->isValidPath(storePath)) { if (!to->isValidPath(storePath)) {
Activity act(*logger, lvlInfo, format("copying %s...") % storePath); Activity act(*logger, lvlInfo, format("copying %s...") % storePath);
copyStorePath(from, to, storePath); copyStorePath(from, to, storePath, false, dontCheckSigs);
logger->incProgress(copiedLabel); logger->incProgress(copiedLabel);
} else } else

View file

@ -570,10 +570,6 @@ public:
const Stats & getStats(); const Stats & getStats();
/* Whether this store paths from this store can be imported even
if they lack a signature. */
virtual bool isTrusted() { return false; }
/* Return the build log of the specified store path, if available, /* Return the build log of the specified store path, if available,
or null otherwise. */ or null otherwise. */
virtual std::shared_ptr<std::string> getBuildLog(const Path & path) virtual std::shared_ptr<std::string> getBuildLog(const Path & path)
@ -695,7 +691,8 @@ ref<Store> openStore(const std::string & uri = getEnv("NIX_REMOTE"),
const Store::Params & extraParams = Store::Params()); const Store::Params & extraParams = Store::Params());
void copyPaths(ref<Store> from, ref<Store> to, const PathSet & storePaths, bool substitute = false); void copyPaths(ref<Store> from, ref<Store> to, const PathSet & storePaths,
bool substitute = false, bool dontCheckSigs = false);
enum StoreType { enum StoreType {
tDaemon, tDaemon,

View file

@ -58,6 +58,6 @@ int main(int argc, char ** argv)
PathSet closure; PathSet closure;
from->computeFSClosure(storePaths2, closure, false, includeOutputs); from->computeFSClosure(storePaths2, closure, false, includeOutputs);
copyPaths(from, to, closure, useSubstitutes); copyPaths(from, to, closure, useSubstitutes, true);
}); });
} }