More cleanup

This commit is contained in:
Eelco Dolstra 2015-07-20 01:16:16 +02:00
parent 6bd2c7bb38
commit b3491c781c
9 changed files with 184 additions and 296 deletions

View file

@ -1528,22 +1528,14 @@ void LocalStore::exportPath(const Path & path, bool sign,
throw Error(format("hash of path %1% has changed from %2% to %3%!") % path
% printHash(storedHash) % printHash(hash));
writeInt(EXPORT_MAGIC, hashAndWriteSink);
writeString(path, hashAndWriteSink);
PathSet references;
queryReferences(path, references);
writeStrings(references, hashAndWriteSink);
Path deriver = queryDeriver(path);
writeString(deriver, hashAndWriteSink);
hashAndWriteSink << EXPORT_MAGIC << path << references << queryDeriver(path);
if (sign) {
Hash hash = hashAndWriteSink.currentHash();
writeInt(1, hashAndWriteSink);
Path tmpDir = createTempDir();
AutoDelete delTmp(tmpDir);
Path hashFile = tmpDir + "/hash";
@ -1561,10 +1553,10 @@ void LocalStore::exportPath(const Path & path, bool sign,
args.push_back(hashFile);
string signature = runProgram(OPENSSL_PATH, true, args);
writeString(signature, hashAndWriteSink);
hashAndWriteSink << 1 << signature;
} else
writeInt(0, hashAndWriteSink);
hashAndWriteSink << 0;
}