* Before a build, show the disk space that the downloaded store paths

will approximately require.
This commit is contained in:
Eelco Dolstra 2010-11-17 14:31:42 +00:00
parent 06699d4219
commit bdf089f463
11 changed files with 36 additions and 29 deletions

View file

@ -839,6 +839,7 @@ bool LocalStore::querySubstitutablePathInfo(const Path & substituter,
info.references.insert(p);
}
info.downloadSize = getIntLine<long long>(run.from);
info.narSize = getIntLine<long long>(run.from);
return true;
}

View file

@ -48,9 +48,9 @@ Path findOutput(const Derivation & drv, string id)
void queryMissing(const PathSet & targets,
PathSet & willBuild, PathSet & willSubstitute, PathSet & unknown,
unsigned long long & downloadSize)
unsigned long long & downloadSize, unsigned long long & narSize)
{
downloadSize = 0;
downloadSize = narSize = 0;
PathSet todo(targets.begin(), targets.end()), done;
@ -88,6 +88,7 @@ void queryMissing(const PathSet & targets,
if (store->querySubstitutablePathInfo(p, info)) {
willSubstitute.insert(p);
downloadSize += info.downloadSize;
narSize += info.narSize;
todo.insert(info.references.begin(), info.references.end());
} else
unknown.insert(p);

View file

@ -31,7 +31,7 @@ Path findOutput(const Derivation & drv, string id);
will be substituted. */
void queryMissing(const PathSet & targets,
PathSet & willBuild, PathSet & willSubstitute, PathSet & unknown,
unsigned long long & downloadSize);
unsigned long long & downloadSize, unsigned long long & narSize);
}

View file

@ -191,9 +191,8 @@ void RemoteStore::setOptions()
writeInt(logType, to);
writeInt(printBuildTrace, to);
}
if (GET_PROTOCOL_MINOR(daemonVersion) >= 6) {
if (GET_PROTOCOL_MINOR(daemonVersion) >= 6)
writeInt(buildCores, to);
}
processStderr();
}
@ -243,6 +242,7 @@ bool RemoteStore::querySubstitutablePathInfo(const Path & path,
if (info.deriver != "") assertStorePath(info.deriver);
info.references = readStorePaths(from);
info.downloadSize = readLongLong(from);
info.narSize = GET_PROTOCOL_MINOR(daemonVersion) >= 7 ? readLongLong(from) : 0;
return true;
}

View file

@ -87,6 +87,7 @@ struct SubstitutablePathInfo
Path deriver;
PathSet references;
unsigned long long downloadSize; /* 0 = unknown or inapplicable */
unsigned long long narSize; /* 0 = unknown */
};

View file

@ -8,7 +8,7 @@ namespace nix {
#define WORKER_MAGIC_1 0x6e697863
#define WORKER_MAGIC_2 0x6478696f
#define PROTOCOL_VERSION 0x106
#define PROTOCOL_VERSION 0x107
#define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)