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...");
alarm(0);
signal(SIGALRM, old);
copyPaths(store, ref<Store>(sshStore), inputs);
copyPaths(store, ref<Store>(sshStore), inputs, false, true);
uploadLock = -1;
BasicDerivation drv(readDerivation(drvPath));
@ -294,7 +294,7 @@ connected:
if (!missing.empty()) {
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;

View file

@ -223,9 +223,6 @@ struct LegacySSHStore : public Store
void addSignatures(const Path & storePath, const StringSet & sigs) override
{ unsupported(); }
bool isTrusted() override
{ return true; }
void computeFSClosure(const PathSet & paths,
PathSet & out, bool flipDirection = false,
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,
bool repair, bool dontCheckSigs, std::shared_ptr<FSAccessor> accessor)
{
assert(info.narHash);
Hash h = hashString(htSHA256, *nar);
if (h != info.narHash)
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;
srcStore->narFromPath({storePath}, sink);
if (srcStore->isTrusted())
dontCheckSigs = true;
if (!info->narHash && dontCheckSigs) {
auto info2 = make_ref<ValidPathInfo>(*info);
info2->narHash = hashString(htSHA256, *sink.s);
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);
}
@ -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);
@ -830,7 +838,7 @@ void copyPaths(ref<Store> from, ref<Store> to, const PathSet & storePaths, bool
if (!to->isValidPath(storePath)) {
Activity act(*logger, lvlInfo, format("copying %s...") % storePath);
copyStorePath(from, to, storePath);
copyStorePath(from, to, storePath, false, dontCheckSigs);
logger->incProgress(copiedLabel);
} else

View file

@ -570,10 +570,6 @@ public:
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,
or null otherwise. */
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());
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 {
tDaemon,

View file

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