forked from lix-project/lix
printMsg(lvlError, ...) -> printError(...) etc.
This commit is contained in:
parent
4036185cb4
commit
c55bf085eb
|
@ -132,7 +132,7 @@ int main(int argc, char * * argv)
|
||||||
throw UsageError("download-via-ssh: --substitute takes exactly two arguments");
|
throw UsageError("download-via-ssh: --substitute takes exactly two arguments");
|
||||||
Path storePath = argv[2];
|
Path storePath = argv[2];
|
||||||
Path destPath = argv[3];
|
Path destPath = argv[3];
|
||||||
printMsg(lvlError, format("downloading ‘%1%’ via SSH from ‘%2%’...") % storePath % host);
|
printError(format("downloading ‘%1%’ via SSH from ‘%2%’...") % storePath % host);
|
||||||
substitute(pipes, storePath, destPath);
|
substitute(pipes, storePath, destPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -664,7 +664,7 @@ std::pair<bool, std::string> EvalState::resolveSearchPathElem(const SearchPathEl
|
||||||
else
|
else
|
||||||
res = { true, getDownloader()->downloadCached(store, elem.second, true) };
|
res = { true, getDownloader()->downloadCached(store, elem.second, true) };
|
||||||
} catch (DownloadError & e) {
|
} catch (DownloadError & e) {
|
||||||
printMsg(lvlError, format("warning: Nix search path entry ‘%1%’ cannot be downloaded, ignoring") % elem.second);
|
printError(format("warning: Nix search path entry ‘%1%’ cannot be downloaded, ignoring") % elem.second);
|
||||||
res = { false, "" };
|
res = { false, "" };
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -672,7 +672,7 @@ std::pair<bool, std::string> EvalState::resolveSearchPathElem(const SearchPathEl
|
||||||
if (pathExists(path))
|
if (pathExists(path))
|
||||||
res = { true, path };
|
res = { true, path };
|
||||||
else {
|
else {
|
||||||
printMsg(lvlError, format("warning: Nix search path entry ‘%1%’ does not exist, ignoring") % elem.second);
|
printError(format("warning: Nix search path entry ‘%1%’ does not exist, ignoring") % elem.second);
|
||||||
res = { false, "" };
|
res = { false, "" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,9 +427,9 @@ static void prim_trace(EvalState & state, const Pos & pos, Value * * args, Value
|
||||||
{
|
{
|
||||||
state.forceValue(*args[0]);
|
state.forceValue(*args[0]);
|
||||||
if (args[0]->type == tString)
|
if (args[0]->type == tString)
|
||||||
printMsg(lvlError, format("trace: %1%") % args[0]->string.s);
|
printError(format("trace: %1%") % args[0]->string.s);
|
||||||
else
|
else
|
||||||
printMsg(lvlError, format("trace: %1%") % *args[0]);
|
printError(format("trace: %1%") % *args[0]);
|
||||||
state.forceValue(*args[1]);
|
state.forceValue(*args[1]);
|
||||||
v = *args[1];
|
v = *args[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,26 +56,26 @@ void printMissing(ref<Store> store, const PathSet & willBuild,
|
||||||
unsigned long long downloadSize, unsigned long long narSize)
|
unsigned long long downloadSize, unsigned long long narSize)
|
||||||
{
|
{
|
||||||
if (!willBuild.empty()) {
|
if (!willBuild.empty()) {
|
||||||
printMsg(lvlInfo, format("these derivations will be built:"));
|
printInfo(format("these derivations will be built:"));
|
||||||
Paths sorted = store->topoSortPaths(willBuild);
|
Paths sorted = store->topoSortPaths(willBuild);
|
||||||
reverse(sorted.begin(), sorted.end());
|
reverse(sorted.begin(), sorted.end());
|
||||||
for (auto & i : sorted)
|
for (auto & i : sorted)
|
||||||
printMsg(lvlInfo, format(" %1%") % i);
|
printInfo(format(" %1%") % i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!willSubstitute.empty()) {
|
if (!willSubstitute.empty()) {
|
||||||
printMsg(lvlInfo, format("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):")
|
printInfo(format("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):")
|
||||||
% (downloadSize / (1024.0 * 1024.0))
|
% (downloadSize / (1024.0 * 1024.0))
|
||||||
% (narSize / (1024.0 * 1024.0)));
|
% (narSize / (1024.0 * 1024.0)));
|
||||||
for (auto & i : willSubstitute)
|
for (auto & i : willSubstitute)
|
||||||
printMsg(lvlInfo, format(" %1%") % i);
|
printInfo(format(" %1%") % i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!unknown.empty()) {
|
if (!unknown.empty()) {
|
||||||
printMsg(lvlInfo, format("don't know how to build these paths%1%:")
|
printInfo(format("don't know how to build these paths%1%:")
|
||||||
% (settings.readOnlyMode ? " (may be caused by read-only store access)" : ""));
|
% (settings.readOnlyMode ? " (may be caused by read-only store access)" : ""));
|
||||||
for (auto & i : unknown)
|
for (auto & i : unknown)
|
||||||
printMsg(lvlInfo, format(" %1%") % i);
|
printInfo(format(" %1%") % i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,20 +282,20 @@ int handleExceptions(const string & programName, std::function<void()> fun)
|
||||||
} catch (Exit & e) {
|
} catch (Exit & e) {
|
||||||
return e.status;
|
return e.status;
|
||||||
} catch (UsageError & e) {
|
} catch (UsageError & e) {
|
||||||
printMsg(lvlError,
|
printError(
|
||||||
format(error + "%1%\nTry ‘%2% --help’ for more information.")
|
format(error + "%1%\nTry ‘%2% --help’ for more information.")
|
||||||
% e.what() % programName);
|
% e.what() % programName);
|
||||||
return 1;
|
return 1;
|
||||||
} catch (BaseError & e) {
|
} catch (BaseError & e) {
|
||||||
printMsg(lvlError, format(error + "%1%%2%") % (settings.showTrace ? e.prefix() : "") % e.msg());
|
printError(format(error + "%1%%2%") % (settings.showTrace ? e.prefix() : "") % e.msg());
|
||||||
if (e.prefix() != "" && !settings.showTrace)
|
if (e.prefix() != "" && !settings.showTrace)
|
||||||
printMsg(lvlError, "(use ‘--show-trace’ to show detailed location information)");
|
printError("(use ‘--show-trace’ to show detailed location information)");
|
||||||
return e.status;
|
return e.status;
|
||||||
} catch (std::bad_alloc & e) {
|
} catch (std::bad_alloc & e) {
|
||||||
printMsg(lvlError, error + "out of memory");
|
printError(error + "out of memory");
|
||||||
return 1;
|
return 1;
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
printMsg(lvlError, error + e.what());
|
printError(error + e.what());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1014,7 +1014,7 @@ void DerivationGoal::loadDerivation()
|
||||||
trace("loading derivation");
|
trace("loading derivation");
|
||||||
|
|
||||||
if (nrFailed != 0) {
|
if (nrFailed != 0) {
|
||||||
printMsg(lvlError, format("cannot build missing derivation ‘%1%’") % drvPath);
|
printError(format("cannot build missing derivation ‘%1%’") % drvPath);
|
||||||
done(BuildResult::MiscFailure);
|
done(BuildResult::MiscFailure);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1168,7 +1168,7 @@ void DerivationGoal::repairClosure()
|
||||||
PathSet broken;
|
PathSet broken;
|
||||||
for (auto & i : outputClosure) {
|
for (auto & i : outputClosure) {
|
||||||
if (worker.pathContentsGood(i)) continue;
|
if (worker.pathContentsGood(i)) continue;
|
||||||
printMsg(lvlError, format("found corrupted or missing path ‘%1%’ in the output closure of ‘%2%’") % i % drvPath);
|
printError(format("found corrupted or missing path ‘%1%’ in the output closure of ‘%2%’") % i % drvPath);
|
||||||
Path drvPath2 = outputsToDrv[i];
|
Path drvPath2 = outputsToDrv[i];
|
||||||
if (drvPath2 == "")
|
if (drvPath2 == "")
|
||||||
addWaitee(worker.makeSubstitutionGoal(i, true));
|
addWaitee(worker.makeSubstitutionGoal(i, true));
|
||||||
|
@ -1201,7 +1201,7 @@ void DerivationGoal::inputsRealised()
|
||||||
if (nrFailed != 0) {
|
if (nrFailed != 0) {
|
||||||
if (!useDerivation)
|
if (!useDerivation)
|
||||||
throw Error(format("some dependencies of ‘%1%’ are missing") % drvPath);
|
throw Error(format("some dependencies of ‘%1%’ are missing") % drvPath);
|
||||||
printMsg(lvlError,
|
printError(
|
||||||
format("cannot build derivation ‘%1%’: %2% dependencies couldn't be built")
|
format("cannot build derivation ‘%1%’: %2% dependencies couldn't be built")
|
||||||
% drvPath % nrFailed);
|
% drvPath % nrFailed);
|
||||||
done(BuildResult::DependencyFailed);
|
done(BuildResult::DependencyFailed);
|
||||||
|
@ -1366,7 +1366,7 @@ void DerivationGoal::tryToBuild()
|
||||||
startBuilder();
|
startBuilder();
|
||||||
|
|
||||||
} catch (BuildError & e) {
|
} catch (BuildError & e) {
|
||||||
printMsg(lvlError, e.msg());
|
printError(e.msg());
|
||||||
outputLocks.unlock();
|
outputLocks.unlock();
|
||||||
buildUser.release();
|
buildUser.release();
|
||||||
worker.permanentFailure = true;
|
worker.permanentFailure = true;
|
||||||
|
@ -1515,7 +1515,7 @@ void DerivationGoal::buildDone()
|
||||||
|
|
||||||
} catch (BuildError & e) {
|
} catch (BuildError & e) {
|
||||||
if (!hook)
|
if (!hook)
|
||||||
printMsg(lvlError, e.msg());
|
printError(e.msg());
|
||||||
outputLocks.unlock();
|
outputLocks.unlock();
|
||||||
buildUser.release();
|
buildUser.release();
|
||||||
|
|
||||||
|
@ -1644,7 +1644,7 @@ void DerivationGoal::startBuilder()
|
||||||
nrRounds > 1 ? "building path(s) %1% (round %2%/%3%)" :
|
nrRounds > 1 ? "building path(s) %1% (round %2%/%3%)" :
|
||||||
"building path(s) %1%");
|
"building path(s) %1%");
|
||||||
f.exceptions(boost::io::all_error_bits ^ boost::io::too_many_args_bit);
|
f.exceptions(boost::io::all_error_bits ^ boost::io::too_many_args_bit);
|
||||||
printMsg(lvlInfo, f % showPaths(missingPaths) % curRound % nrRounds);
|
printInfo(f % showPaths(missingPaths) % curRound % nrRounds);
|
||||||
|
|
||||||
/* Right platform? */
|
/* Right platform? */
|
||||||
if (!drv->canBuildLocally()) {
|
if (!drv->canBuildLocally()) {
|
||||||
|
@ -2216,7 +2216,7 @@ void DerivationGoal::startBuilder()
|
||||||
if (msg.size() == 1) break;
|
if (msg.size() == 1) break;
|
||||||
throw Error(string(msg, 1));
|
throw Error(string(msg, 1));
|
||||||
}
|
}
|
||||||
printMsg(lvlDebug, msg);
|
debug(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2704,7 +2704,7 @@ void DerivationGoal::registerOutputs()
|
||||||
/* Apply hash rewriting if necessary. */
|
/* Apply hash rewriting if necessary. */
|
||||||
bool rewritten = false;
|
bool rewritten = false;
|
||||||
if (!outputRewrites.empty()) {
|
if (!outputRewrites.empty()) {
|
||||||
printMsg(lvlError, format("warning: rewriting hashes in ‘%1%’; cross fingers") % path);
|
printError(format("warning: rewriting hashes in ‘%1%’; cross fingers") % path);
|
||||||
|
|
||||||
/* Canonicalise first. This ensures that the path we're
|
/* Canonicalise first. This ensures that the path we're
|
||||||
rewriting doesn't contain a hard link to /etc/shadow or
|
rewriting doesn't contain a hard link to /etc/shadow or
|
||||||
|
@ -2743,7 +2743,7 @@ void DerivationGoal::registerOutputs()
|
||||||
Hash h2 = recursive ? hashPath(h.type, actualPath).first : hashFile(h.type, actualPath);
|
Hash h2 = recursive ? hashPath(h.type, actualPath).first : hashFile(h.type, actualPath);
|
||||||
if (buildMode == bmHash) {
|
if (buildMode == bmHash) {
|
||||||
Path dest = worker.store.makeFixedOutputPath(recursive, h2, drv->env["name"]);
|
Path dest = worker.store.makeFixedOutputPath(recursive, h2, drv->env["name"]);
|
||||||
printMsg(lvlError, format("build produced path ‘%1%’ with %2% hash ‘%3%’")
|
printError(format("build produced path ‘%1%’ with %2% hash ‘%3%’")
|
||||||
% dest % printHashType(h.type) % printHash16or32(h2));
|
% dest % printHashType(h.type) % printHash16or32(h2));
|
||||||
if (worker.store.isValidPath(dest))
|
if (worker.store.isValidPath(dest))
|
||||||
return;
|
return;
|
||||||
|
@ -2967,7 +2967,7 @@ void DerivationGoal::deleteTmpDir(bool force)
|
||||||
{
|
{
|
||||||
if (tmpDir != "") {
|
if (tmpDir != "") {
|
||||||
if (settings.keepFailed && !force) {
|
if (settings.keepFailed && !force) {
|
||||||
printMsg(lvlError,
|
printError(
|
||||||
format("note: keeping build directory ‘%2%’")
|
format("note: keeping build directory ‘%2%’")
|
||||||
% drvPath % tmpDir);
|
% drvPath % tmpDir);
|
||||||
chmod(tmpDir.c_str(), 0755);
|
chmod(tmpDir.c_str(), 0755);
|
||||||
|
@ -2986,7 +2986,7 @@ void DerivationGoal::handleChildOutput(int fd, const string & data)
|
||||||
{
|
{
|
||||||
logSize += data.size();
|
logSize += data.size();
|
||||||
if (settings.maxLogSize && logSize > settings.maxLogSize) {
|
if (settings.maxLogSize && logSize > settings.maxLogSize) {
|
||||||
printMsg(lvlError,
|
printError(
|
||||||
format("%1% killed after writing more than %2% bytes of log output")
|
format("%1% killed after writing more than %2% bytes of log output")
|
||||||
% getName() % settings.maxLogSize);
|
% getName() % settings.maxLogSize);
|
||||||
killChild();
|
killChild();
|
||||||
|
@ -3009,7 +3009,7 @@ void DerivationGoal::handleChildOutput(int fd, const string & data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hook && fd == hook->fromHook.readSide.get())
|
if (hook && fd == hook->fromHook.readSide.get())
|
||||||
printMsg(lvlError, data); // FIXME?
|
printError(data); // FIXME?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3023,7 +3023,7 @@ void DerivationGoal::handleEOF(int fd)
|
||||||
void DerivationGoal::flushLine()
|
void DerivationGoal::flushLine()
|
||||||
{
|
{
|
||||||
if (settings.verboseBuild)
|
if (settings.verboseBuild)
|
||||||
printMsg(lvlInfo, filterANSIEscapes(currentLogLine, true));
|
printInfo(filterANSIEscapes(currentLogLine, true));
|
||||||
else {
|
else {
|
||||||
logTail.push_back(currentLogLine);
|
logTail.push_back(currentLogLine);
|
||||||
if (logTail.size() > settings.logLines) logTail.pop_front();
|
if (logTail.size() > settings.logLines) logTail.pop_front();
|
||||||
|
@ -3236,7 +3236,7 @@ void SubstitutionGoal::tryNext()
|
||||||
signature. LocalStore::addToStore() also checks for this, but
|
signature. LocalStore::addToStore() also checks for this, but
|
||||||
only after we've downloaded the path. */
|
only after we've downloaded the path. */
|
||||||
if (worker.store.requireSigs && !info->checkSignatures(worker.store, worker.store.publicKeys)) {
|
if (worker.store.requireSigs && !info->checkSignatures(worker.store, worker.store.publicKeys)) {
|
||||||
printMsg(lvlInfo, format("warning: substituter ‘%s’ does not have a valid signature for path ‘%s’")
|
printInfo(format("warning: substituter ‘%s’ does not have a valid signature for path ‘%s’")
|
||||||
% sub->getUri() % storePath);
|
% sub->getUri() % storePath);
|
||||||
tryNext();
|
tryNext();
|
||||||
return;
|
return;
|
||||||
|
@ -3287,7 +3287,7 @@ void SubstitutionGoal::tryToRun()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printMsg(lvlInfo, format("fetching path ‘%1%’...") % storePath);
|
printInfo(format("fetching path ‘%1%’...") % storePath);
|
||||||
|
|
||||||
outPipe.create();
|
outPipe.create();
|
||||||
|
|
||||||
|
@ -3323,7 +3323,7 @@ void SubstitutionGoal::finished()
|
||||||
try {
|
try {
|
||||||
promise.get_future().get();
|
promise.get_future().get();
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
printMsg(lvlInfo, e.msg());
|
printInfo(e.msg());
|
||||||
|
|
||||||
/* Try the next substitute. */
|
/* Try the next substitute. */
|
||||||
state = &SubstitutionGoal::tryNext;
|
state = &SubstitutionGoal::tryNext;
|
||||||
|
@ -3617,7 +3617,7 @@ void Worker::waitForInput()
|
||||||
if (!waitingForAWhile.empty()) {
|
if (!waitingForAWhile.empty()) {
|
||||||
useTimeout = true;
|
useTimeout = true;
|
||||||
if (lastWokenUp == 0)
|
if (lastWokenUp == 0)
|
||||||
printMsg(lvlError, "waiting for locks or build slots...");
|
printError("waiting for locks or build slots...");
|
||||||
if (lastWokenUp == 0 || lastWokenUp > before) lastWokenUp = before;
|
if (lastWokenUp == 0 || lastWokenUp > before) lastWokenUp = before;
|
||||||
timeout.tv_sec = std::max((time_t) 1, (time_t) (lastWokenUp + settings.pollInterval - before));
|
timeout.tv_sec = std::max((time_t) 1, (time_t) (lastWokenUp + settings.pollInterval - before));
|
||||||
} else lastWokenUp = 0;
|
} else lastWokenUp = 0;
|
||||||
|
@ -3680,7 +3680,7 @@ void Worker::waitForInput()
|
||||||
j->respectTimeouts &&
|
j->respectTimeouts &&
|
||||||
after - j->lastOutput >= (time_t) settings.maxSilentTime)
|
after - j->lastOutput >= (time_t) settings.maxSilentTime)
|
||||||
{
|
{
|
||||||
printMsg(lvlError,
|
printError(
|
||||||
format("%1% timed out after %2% seconds of silence")
|
format("%1% timed out after %2% seconds of silence")
|
||||||
% goal->getName() % settings.maxSilentTime);
|
% goal->getName() % settings.maxSilentTime);
|
||||||
goal->timedOut();
|
goal->timedOut();
|
||||||
|
@ -3691,7 +3691,7 @@ void Worker::waitForInput()
|
||||||
j->respectTimeouts &&
|
j->respectTimeouts &&
|
||||||
after - j->timeStarted >= (time_t) settings.buildTimeout)
|
after - j->timeStarted >= (time_t) settings.buildTimeout)
|
||||||
{
|
{
|
||||||
printMsg(lvlError,
|
printError(
|
||||||
format("%1% timed out after %2% seconds")
|
format("%1% timed out after %2% seconds")
|
||||||
% goal->getName() % settings.buildTimeout);
|
% goal->getName() % settings.buildTimeout);
|
||||||
goal->timedOut();
|
goal->timedOut();
|
||||||
|
@ -3719,7 +3719,7 @@ bool Worker::pathContentsGood(const Path & path)
|
||||||
{
|
{
|
||||||
std::map<Path, bool>::iterator i = pathContentsGoodCache.find(path);
|
std::map<Path, bool>::iterator i = pathContentsGoodCache.find(path);
|
||||||
if (i != pathContentsGoodCache.end()) return i->second;
|
if (i != pathContentsGoodCache.end()) return i->second;
|
||||||
printMsg(lvlInfo, format("checking path ‘%1%’...") % path);
|
printInfo(format("checking path ‘%1%’...") % path);
|
||||||
auto info = store.queryPathInfo(path);
|
auto info = store.queryPathInfo(path);
|
||||||
bool res;
|
bool res;
|
||||||
if (!pathExists(path))
|
if (!pathExists(path))
|
||||||
|
@ -3730,7 +3730,7 @@ bool Worker::pathContentsGood(const Path & path)
|
||||||
res = info->narHash == nullHash || info->narHash == current.first;
|
res = info->narHash == nullHash || info->narHash == current.first;
|
||||||
}
|
}
|
||||||
pathContentsGoodCache[path] = res;
|
pathContentsGoodCache[path] = res;
|
||||||
if (!res) printMsg(lvlError, format("path ‘%1%’ is corrupted or missing!") % path);
|
if (!res) printError(format("path ‘%1%’ is corrupted or missing!") % path);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ struct CurlDownloader : public Downloader
|
||||||
download after a while. */
|
download after a while. */
|
||||||
if (err == Transient && attempt < request.tries) {
|
if (err == Transient && attempt < request.tries) {
|
||||||
int ms = request.baseRetryTimeMs * std::pow(2.0f, attempt - 1 + std::uniform_real_distribution<>(0.0, 0.5)(downloader.mt19937));
|
int ms = request.baseRetryTimeMs * std::pow(2.0f, attempt - 1 + std::uniform_real_distribution<>(0.0, 0.5)(downloader.mt19937));
|
||||||
printMsg(lvlError, format("warning: %s; retrying in %d ms") % exc.what() % ms);
|
printError(format("warning: %s; retrying in %d ms") % exc.what() % ms);
|
||||||
embargo = std::chrono::steady_clock::now() + std::chrono::milliseconds(ms);
|
embargo = std::chrono::steady_clock::now() + std::chrono::milliseconds(ms);
|
||||||
downloader.enqueueItem(shared_from_this());
|
downloader.enqueueItem(shared_from_this());
|
||||||
}
|
}
|
||||||
|
@ -420,7 +420,7 @@ struct CurlDownloader : public Downloader
|
||||||
workerThreadMain();
|
workerThreadMain();
|
||||||
} catch (nix::Interrupted & e) {
|
} catch (nix::Interrupted & e) {
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
printMsg(lvlError, format("unexpected error in download thread: %s") % e.what());
|
printError(format("unexpected error in download thread: %s") % e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -522,7 +522,7 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
|
||||||
if (effectiveUrl)
|
if (effectiveUrl)
|
||||||
*effectiveUrl = url_;
|
*effectiveUrl = url_;
|
||||||
} else if (!ss[1].empty()) {
|
} else if (!ss[1].empty()) {
|
||||||
printMsg(lvlDebug, format("verifying previous ETag ‘%1%’") % ss[1]);
|
debug(format("verifying previous ETag ‘%1%’") % ss[1]);
|
||||||
expectedETag = ss[1];
|
expectedETag = ss[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -556,7 +556,7 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
|
||||||
writeFile(dataFile, url + "\n" + res.etag + "\n" + std::to_string(time(0)) + "\n");
|
writeFile(dataFile, url + "\n" + res.etag + "\n" + std::to_string(time(0)) + "\n");
|
||||||
} catch (DownloadError & e) {
|
} catch (DownloadError & e) {
|
||||||
if (storePath.empty()) throw;
|
if (storePath.empty()) throw;
|
||||||
printMsg(lvlError, format("warning: %1%; using cached result") % e.msg());
|
printError(format("warning: %1%; using cached result") % e.msg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,7 +570,7 @@ Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpa
|
||||||
unpackedStorePath = "";
|
unpackedStorePath = "";
|
||||||
}
|
}
|
||||||
if (unpackedStorePath.empty()) {
|
if (unpackedStorePath.empty()) {
|
||||||
printMsg(lvlInfo, format("unpacking ‘%1%’...") % url);
|
printInfo(format("unpacking ‘%1%’...") % url);
|
||||||
Path tmpDir = createTempDir();
|
Path tmpDir = createTempDir();
|
||||||
AutoDelete autoDelete(tmpDir, true);
|
AutoDelete autoDelete(tmpDir, true);
|
||||||
// FIXME: this requires GNU tar for decompression.
|
// FIXME: this requires GNU tar for decompression.
|
||||||
|
|
|
@ -39,7 +39,7 @@ int LocalStore::openGCLock(LockType lockType)
|
||||||
throw SysError(format("opening global GC lock ‘%1%’") % fnGCLock);
|
throw SysError(format("opening global GC lock ‘%1%’") % fnGCLock);
|
||||||
|
|
||||||
if (!lockFile(fdGCLock.get(), lockType, false)) {
|
if (!lockFile(fdGCLock.get(), lockType, false)) {
|
||||||
printMsg(lvlError, format("waiting for the big garbage collector lock..."));
|
printError(format("waiting for the big garbage collector lock..."));
|
||||||
lockFile(fdGCLock.get(), lockType, true);
|
lockFile(fdGCLock.get(), lockType, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ Path LocalFSStore::addPermRoot(const Path & _storePath,
|
||||||
if (settings.checkRootReachability) {
|
if (settings.checkRootReachability) {
|
||||||
Roots roots = findRoots();
|
Roots roots = findRoots();
|
||||||
if (roots.find(gcRoot) == roots.end())
|
if (roots.find(gcRoot) == roots.end())
|
||||||
printMsg(lvlError,
|
printError(
|
||||||
format(
|
format(
|
||||||
"warning: ‘%1%’ is not in a directory where the garbage collector looks for roots; "
|
"warning: ‘%1%’ is not in a directory where the garbage collector looks for roots; "
|
||||||
"therefore, ‘%2%’ might be removed by the garbage collector")
|
"therefore, ‘%2%’ might be removed by the garbage collector")
|
||||||
|
@ -226,7 +226,7 @@ void LocalStore::readTempRoots(PathSet & tempRoots, FDs & fds)
|
||||||
only succeed if the owning process has died. In that case
|
only succeed if the owning process has died. In that case
|
||||||
we don't care about its temporary roots. */
|
we don't care about its temporary roots. */
|
||||||
if (lockFile(fd->get(), ltWrite, false)) {
|
if (lockFile(fd->get(), ltWrite, false)) {
|
||||||
printMsg(lvlError, format("removing stale temporary roots file ‘%1%’") % path);
|
printError(format("removing stale temporary roots file ‘%1%’") % path);
|
||||||
unlink(path.c_str());
|
unlink(path.c_str());
|
||||||
writeFull(fd->get(), "d");
|
writeFull(fd->get(), "d");
|
||||||
continue;
|
continue;
|
||||||
|
@ -264,7 +264,7 @@ void LocalStore::findRoots(const Path & path, unsigned char type, Roots & roots)
|
||||||
if (isStorePath(storePath) && isValidPath(storePath))
|
if (isStorePath(storePath) && isValidPath(storePath))
|
||||||
roots[path] = storePath;
|
roots[path] = storePath;
|
||||||
else
|
else
|
||||||
printMsg(lvlInfo, format("skipping invalid root from ‘%1%’ to ‘%2%’") % path % storePath);
|
printInfo(format("skipping invalid root from ‘%1%’ to ‘%2%’") % path % storePath);
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -287,7 +287,7 @@ void LocalStore::findRoots(const Path & path, unsigned char type, Roots & roots)
|
||||||
target = absPath(target, dirOf(path));
|
target = absPath(target, dirOf(path));
|
||||||
if (!pathExists(target)) {
|
if (!pathExists(target)) {
|
||||||
if (isInDir(path, stateDir + "/" + gcRootsDir + "/auto")) {
|
if (isInDir(path, stateDir + "/" + gcRootsDir + "/auto")) {
|
||||||
printMsg(lvlInfo, format("removing stale link from ‘%1%’ to ‘%2%’") % path % target);
|
printInfo(format("removing stale link from ‘%1%’ to ‘%2%’") % path % target);
|
||||||
unlink(path.c_str());
|
unlink(path.c_str());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -310,7 +310,7 @@ void LocalStore::findRoots(const Path & path, unsigned char type, Roots & roots)
|
||||||
catch (SysError & e) {
|
catch (SysError & e) {
|
||||||
/* We only ignore permanent failures. */
|
/* We only ignore permanent failures. */
|
||||||
if (e.errNo == EACCES || e.errNo == ENOENT || e.errNo == ENOTDIR)
|
if (e.errNo == EACCES || e.errNo == ENOENT || e.errNo == ENOTDIR)
|
||||||
printMsg(lvlInfo, format("cannot read potential root ‘%1%’") % path);
|
printInfo(format("cannot read potential root ‘%1%’") % path);
|
||||||
else
|
else
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@ -513,7 +513,7 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path)
|
||||||
throw SysError(format("getting status of %1%") % realPath);
|
throw SysError(format("getting status of %1%") % realPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
printMsg(lvlInfo, format("deleting ‘%1%’") % path);
|
printInfo(format("deleting ‘%1%’") % path);
|
||||||
|
|
||||||
state.results.paths.insert(path);
|
state.results.paths.insert(path);
|
||||||
|
|
||||||
|
@ -535,7 +535,7 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path)
|
||||||
state.bytesInvalidated += size;
|
state.bytesInvalidated += size;
|
||||||
} catch (SysError & e) {
|
} catch (SysError & e) {
|
||||||
if (e.errNo == ENOSPC) {
|
if (e.errNo == ENOSPC) {
|
||||||
printMsg(lvlInfo, format("note: can't create move ‘%1%’: %2%") % realPath % e.msg());
|
printInfo(format("note: can't create move ‘%1%’: %2%") % realPath % e.msg());
|
||||||
deleteGarbage(state, realPath);
|
deleteGarbage(state, realPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -543,7 +543,7 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path)
|
||||||
deleteGarbage(state, realPath);
|
deleteGarbage(state, realPath);
|
||||||
|
|
||||||
if (state.results.bytesFreed + state.bytesInvalidated > state.options.maxFreed) {
|
if (state.results.bytesFreed + state.bytesInvalidated > state.options.maxFreed) {
|
||||||
printMsg(lvlInfo, format("deleted or invalidated more than %1% bytes; stopping") % state.options.maxFreed);
|
printInfo(format("deleted or invalidated more than %1% bytes; stopping") % state.options.maxFreed);
|
||||||
throw GCLimitReached();
|
throw GCLimitReached();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -562,7 +562,7 @@ bool LocalStore::canReachRoot(GCState & state, PathSet & visited, const Path & p
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.roots.find(path) != state.roots.end()) {
|
if (state.roots.find(path) != state.roots.end()) {
|
||||||
printMsg(lvlDebug, format("cannot delete ‘%1%’ because it's a root") % path);
|
debug(format("cannot delete ‘%1%’ because it's a root") % path);
|
||||||
state.alive.insert(path);
|
state.alive.insert(path);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -626,7 +626,7 @@ void LocalStore::tryToDelete(GCState & state, const Path & path)
|
||||||
PathSet visited;
|
PathSet visited;
|
||||||
|
|
||||||
if (canReachRoot(state, visited, path)) {
|
if (canReachRoot(state, visited, path)) {
|
||||||
printMsg(lvlDebug, format("cannot delete ‘%1%’ because it's still reachable") % path);
|
debug(format("cannot delete ‘%1%’ because it's still reachable") % path);
|
||||||
} else {
|
} else {
|
||||||
/* No path we visited was a root, so everything is garbage.
|
/* No path we visited was a root, so everything is garbage.
|
||||||
But we only delete ‘path’ and its referrers here so that
|
But we only delete ‘path’ and its referrers here so that
|
||||||
|
@ -682,7 +682,7 @@ void LocalStore::removeUnusedLinks(const GCState & state)
|
||||||
throw SysError(format("statting ‘%1%’") % linksDir);
|
throw SysError(format("statting ‘%1%’") % linksDir);
|
||||||
long long overhead = st.st_blocks * 512ULL;
|
long long overhead = st.st_blocks * 512ULL;
|
||||||
|
|
||||||
printMsg(lvlInfo, format("note: currently hard linking saves %.2f MiB")
|
printInfo(format("note: currently hard linking saves %.2f MiB")
|
||||||
% ((unsharedSize - actualSize - overhead) / (1024.0 * 1024.0)));
|
% ((unsharedSize - actualSize - overhead) / (1024.0 * 1024.0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,7 +715,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
||||||
|
|
||||||
/* Find the roots. Since we've grabbed the GC lock, the set of
|
/* Find the roots. Since we've grabbed the GC lock, the set of
|
||||||
permanent roots cannot increase now. */
|
permanent roots cannot increase now. */
|
||||||
printMsg(lvlError, format("finding garbage collector roots..."));
|
printError(format("finding garbage collector roots..."));
|
||||||
Roots rootMap = options.ignoreLiveness ? Roots() : findRoots();
|
Roots rootMap = options.ignoreLiveness ? Roots() : findRoots();
|
||||||
|
|
||||||
for (auto & i : rootMap) state.roots.insert(i.second);
|
for (auto & i : rootMap) state.roots.insert(i.second);
|
||||||
|
@ -744,7 +744,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
||||||
createDirs(trashDir);
|
createDirs(trashDir);
|
||||||
} catch (SysError & e) {
|
} catch (SysError & e) {
|
||||||
if (e.errNo == ENOSPC) {
|
if (e.errNo == ENOSPC) {
|
||||||
printMsg(lvlInfo, format("note: can't create trash directory: %1%") % e.msg());
|
printInfo(format("note: can't create trash directory: %1%") % e.msg());
|
||||||
state.moveToTrash = false;
|
state.moveToTrash = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -765,9 +765,9 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
||||||
} else if (options.maxFreed > 0) {
|
} else if (options.maxFreed > 0) {
|
||||||
|
|
||||||
if (state.shouldDelete)
|
if (state.shouldDelete)
|
||||||
printMsg(lvlError, format("deleting garbage..."));
|
printError(format("deleting garbage..."));
|
||||||
else
|
else
|
||||||
printMsg(lvlError, format("determining live/dead paths..."));
|
printError(format("determining live/dead paths..."));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -825,12 +825,12 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
|
||||||
fds.clear();
|
fds.clear();
|
||||||
|
|
||||||
/* Delete the trash directory. */
|
/* Delete the trash directory. */
|
||||||
printMsg(lvlInfo, format("deleting ‘%1%’") % trashDir);
|
printInfo(format("deleting ‘%1%’") % trashDir);
|
||||||
deleteGarbage(state, trashDir);
|
deleteGarbage(state, trashDir);
|
||||||
|
|
||||||
/* Clean up the links directory. */
|
/* Clean up the links directory. */
|
||||||
if (options.action == GCOptions::gcDeleteDead || options.action == GCOptions::gcDeleteSpecific) {
|
if (options.action == GCOptions::gcDeleteDead || options.action == GCOptions::gcDeleteSpecific) {
|
||||||
printMsg(lvlError, format("deleting unused links..."));
|
printError(format("deleting unused links..."));
|
||||||
removeUnusedLinks(state);
|
removeUnusedLinks(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ LocalStore::LocalStore(const Params & params)
|
||||||
|
|
||||||
struct group * gr = getgrnam(settings.buildUsersGroup.c_str());
|
struct group * gr = getgrnam(settings.buildUsersGroup.c_str());
|
||||||
if (!gr)
|
if (!gr)
|
||||||
printMsg(lvlError, format("warning: the group ‘%1%’ specified in ‘build-users-group’ does not exist")
|
printError(format("warning: the group ‘%1%’ specified in ‘build-users-group’ does not exist")
|
||||||
% settings.buildUsersGroup);
|
% settings.buildUsersGroup);
|
||||||
else {
|
else {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
@ -136,7 +136,7 @@ LocalStore::LocalStore(const Params & params)
|
||||||
globalLock = openLockFile(globalLockPath.c_str(), true);
|
globalLock = openLockFile(globalLockPath.c_str(), true);
|
||||||
|
|
||||||
if (!lockFile(globalLock.get(), ltRead, false)) {
|
if (!lockFile(globalLock.get(), ltRead, false)) {
|
||||||
printMsg(lvlError, "waiting for the big Nix store lock...");
|
printError("waiting for the big Nix store lock...");
|
||||||
lockFile(globalLock.get(), ltRead, true);
|
lockFile(globalLock.get(), ltRead, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ LocalStore::LocalStore(const Params & params)
|
||||||
"please upgrade Nix to version 1.11 first.");
|
"please upgrade Nix to version 1.11 first.");
|
||||||
|
|
||||||
if (!lockFile(globalLock.get(), ltWrite, false)) {
|
if (!lockFile(globalLock.get(), ltWrite, false)) {
|
||||||
printMsg(lvlError, "waiting for exclusive access to the Nix store...");
|
printError("waiting for exclusive access to the Nix store...");
|
||||||
lockFile(globalLock.get(), ltWrite, true);
|
lockFile(globalLock.get(), ltWrite, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1108,7 +1108,7 @@ void LocalStore::invalidatePathChecked(const Path & path)
|
||||||
|
|
||||||
bool LocalStore::verifyStore(bool checkContents, bool repair)
|
bool LocalStore::verifyStore(bool checkContents, bool repair)
|
||||||
{
|
{
|
||||||
printMsg(lvlError, format("reading the Nix store..."));
|
printError(format("reading the Nix store..."));
|
||||||
|
|
||||||
bool errors = false;
|
bool errors = false;
|
||||||
|
|
||||||
|
@ -1119,7 +1119,7 @@ bool LocalStore::verifyStore(bool checkContents, bool repair)
|
||||||
for (auto & i : readDirectory(realStoreDir)) store.insert(i.name);
|
for (auto & i : readDirectory(realStoreDir)) store.insert(i.name);
|
||||||
|
|
||||||
/* Check whether all valid paths actually exist. */
|
/* Check whether all valid paths actually exist. */
|
||||||
printMsg(lvlInfo, "checking path existence...");
|
printInfo("checking path existence...");
|
||||||
|
|
||||||
PathSet validPaths2 = queryAllValidPaths(), validPaths, done;
|
PathSet validPaths2 = queryAllValidPaths(), validPaths, done;
|
||||||
|
|
||||||
|
@ -1132,7 +1132,7 @@ bool LocalStore::verifyStore(bool checkContents, bool repair)
|
||||||
|
|
||||||
/* Optionally, check the content hashes (slow). */
|
/* Optionally, check the content hashes (slow). */
|
||||||
if (checkContents) {
|
if (checkContents) {
|
||||||
printMsg(lvlInfo, "checking hashes...");
|
printInfo("checking hashes...");
|
||||||
|
|
||||||
Hash nullHash(htSHA256);
|
Hash nullHash(htSHA256);
|
||||||
|
|
||||||
|
@ -1145,7 +1145,7 @@ bool LocalStore::verifyStore(bool checkContents, bool repair)
|
||||||
HashResult current = hashPath(info->narHash.type, i);
|
HashResult current = hashPath(info->narHash.type, i);
|
||||||
|
|
||||||
if (info->narHash != nullHash && info->narHash != current.first) {
|
if (info->narHash != nullHash && info->narHash != current.first) {
|
||||||
printMsg(lvlError, format("path ‘%1%’ was modified! "
|
printError(format("path ‘%1%’ was modified! "
|
||||||
"expected hash ‘%2%’, got ‘%3%’")
|
"expected hash ‘%2%’, got ‘%3%’")
|
||||||
% i % printHash(info->narHash) % printHash(current.first));
|
% i % printHash(info->narHash) % printHash(current.first));
|
||||||
if (repair) repairPath(i); else errors = true;
|
if (repair) repairPath(i); else errors = true;
|
||||||
|
@ -1155,14 +1155,14 @@ bool LocalStore::verifyStore(bool checkContents, bool repair)
|
||||||
|
|
||||||
/* Fill in missing hashes. */
|
/* Fill in missing hashes. */
|
||||||
if (info->narHash == nullHash) {
|
if (info->narHash == nullHash) {
|
||||||
printMsg(lvlError, format("fixing missing hash on ‘%1%’") % i);
|
printError(format("fixing missing hash on ‘%1%’") % i);
|
||||||
info->narHash = current.first;
|
info->narHash = current.first;
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in missing narSize fields (from old stores). */
|
/* Fill in missing narSize fields (from old stores). */
|
||||||
if (info->narSize == 0) {
|
if (info->narSize == 0) {
|
||||||
printMsg(lvlError, format("updating size field on ‘%1%’ to %2%") % i % current.second);
|
printError(format("updating size field on ‘%1%’ to %2%") % i % current.second);
|
||||||
info->narSize = current.second;
|
info->narSize = current.second;
|
||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
@ -1178,9 +1178,9 @@ bool LocalStore::verifyStore(bool checkContents, bool repair)
|
||||||
/* It's possible that the path got GC'ed, so ignore
|
/* It's possible that the path got GC'ed, so ignore
|
||||||
errors on invalid paths. */
|
errors on invalid paths. */
|
||||||
if (isValidPath(i))
|
if (isValidPath(i))
|
||||||
printMsg(lvlError, format("error: %1%") % e.msg());
|
printError(format("error: %1%") % e.msg());
|
||||||
else
|
else
|
||||||
printMsg(lvlError, format("warning: %1%") % e.msg());
|
printError(format("warning: %1%") % e.msg());
|
||||||
errors = true;
|
errors = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1199,7 +1199,7 @@ void LocalStore::verifyPath(const Path & path, const PathSet & store,
|
||||||
done.insert(path);
|
done.insert(path);
|
||||||
|
|
||||||
if (!isStorePath(path)) {
|
if (!isStorePath(path)) {
|
||||||
printMsg(lvlError, format("path ‘%1%’ is not in the Nix store") % path);
|
printError(format("path ‘%1%’ is not in the Nix store") % path);
|
||||||
auto state(_state.lock());
|
auto state(_state.lock());
|
||||||
invalidatePath(*state, path);
|
invalidatePath(*state, path);
|
||||||
return;
|
return;
|
||||||
|
@ -1218,16 +1218,16 @@ void LocalStore::verifyPath(const Path & path, const PathSet & store,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canInvalidate) {
|
if (canInvalidate) {
|
||||||
printMsg(lvlError, format("path ‘%1%’ disappeared, removing from database...") % path);
|
printError(format("path ‘%1%’ disappeared, removing from database...") % path);
|
||||||
auto state(_state.lock());
|
auto state(_state.lock());
|
||||||
invalidatePath(*state, path);
|
invalidatePath(*state, path);
|
||||||
} else {
|
} else {
|
||||||
printMsg(lvlError, format("path ‘%1%’ disappeared, but it still has valid referrers!") % path);
|
printError(format("path ‘%1%’ disappeared, but it still has valid referrers!") % path);
|
||||||
if (repair)
|
if (repair)
|
||||||
try {
|
try {
|
||||||
repairPath(path);
|
repairPath(path);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
printMsg(lvlError, format("warning: %1%") % e.msg());
|
printError(format("warning: %1%") % e.msg());
|
||||||
errors = true;
|
errors = true;
|
||||||
}
|
}
|
||||||
else errors = true;
|
else errors = true;
|
||||||
|
@ -1279,7 +1279,7 @@ static void makeMutable(const Path & path)
|
||||||
void LocalStore::upgradeStore7()
|
void LocalStore::upgradeStore7()
|
||||||
{
|
{
|
||||||
if (getuid() != 0) return;
|
if (getuid() != 0) return;
|
||||||
printMsg(lvlError, "removing immutable bits from the Nix store (this may take a while)...");
|
printError("removing immutable bits from the Nix store (this may take a while)...");
|
||||||
makeMutable(realStoreDir);
|
makeMutable(realStoreDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ struct MakeReadOnly
|
||||||
|
|
||||||
LocalStore::InodeHash LocalStore::loadInodeHash()
|
LocalStore::InodeHash LocalStore::loadInodeHash()
|
||||||
{
|
{
|
||||||
printMsg(lvlDebug, "loading hash inodes in memory");
|
debug("loading hash inodes in memory");
|
||||||
InodeHash inodeHash;
|
InodeHash inodeHash;
|
||||||
|
|
||||||
AutoCloseDir dir = opendir(linksDir.c_str());
|
AutoCloseDir dir = opendir(linksDir.c_str());
|
||||||
|
@ -75,7 +75,7 @@ Strings LocalStore::readDirectoryIgnoringInodes(const Path & path, const InodeHa
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
|
|
||||||
if (inodeHash.count(dirent->d_ino)) {
|
if (inodeHash.count(dirent->d_ino)) {
|
||||||
printMsg(lvlDebug, format("‘%1%’ is already linked") % dirent->d_name);
|
debug(format("‘%1%’ is already linked") % dirent->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,13 +116,13 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
|
||||||
NixOS (example: $fontconfig/var/cache being modified). Skip
|
NixOS (example: $fontconfig/var/cache being modified). Skip
|
||||||
those files. FIXME: check the modification time. */
|
those files. FIXME: check the modification time. */
|
||||||
if (S_ISREG(st.st_mode) && (st.st_mode & S_IWUSR)) {
|
if (S_ISREG(st.st_mode) && (st.st_mode & S_IWUSR)) {
|
||||||
printMsg(lvlError, format("skipping suspicious writable file ‘%1%’") % path);
|
printError(format("skipping suspicious writable file ‘%1%’") % path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This can still happen on top-level files. */
|
/* This can still happen on top-level files. */
|
||||||
if (st.st_nlink > 1 && inodeHash.count(st.st_ino)) {
|
if (st.st_nlink > 1 && inodeHash.count(st.st_ino)) {
|
||||||
printMsg(lvlDebug, format("‘%1%’ is already linked, with %2% other file(s)") % path % (st.st_nlink - 2));
|
debug(format("‘%1%’ is already linked, with %2% other file(s)") % path % (st.st_nlink - 2));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
|
||||||
contents of the symlink (i.e. the result of readlink()), not
|
contents of the symlink (i.e. the result of readlink()), not
|
||||||
the contents of the target (which may not even exist). */
|
the contents of the target (which may not even exist). */
|
||||||
Hash hash = hashPath(htSHA256, path).first;
|
Hash hash = hashPath(htSHA256, path).first;
|
||||||
printMsg(lvlDebug, format("‘%1%’ has hash ‘%2%’") % path % printHash(hash));
|
debug(format("‘%1%’ has hash ‘%2%’") % path % printHash(hash));
|
||||||
|
|
||||||
/* Check if this is a known hash. */
|
/* Check if this is a known hash. */
|
||||||
Path linkPath = linksDir + "/" + printHash32(hash);
|
Path linkPath = linksDir + "/" + printHash32(hash);
|
||||||
|
@ -161,12 +161,12 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
|
||||||
throw SysError(format("getting attributes of path ‘%1%’") % linkPath);
|
throw SysError(format("getting attributes of path ‘%1%’") % linkPath);
|
||||||
|
|
||||||
if (st.st_ino == stLink.st_ino) {
|
if (st.st_ino == stLink.st_ino) {
|
||||||
printMsg(lvlDebug, format("‘%1%’ is already linked to ‘%2%’") % path % linkPath);
|
debug(format("‘%1%’ is already linked to ‘%2%’") % path % linkPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st.st_size != stLink.st_size) {
|
if (st.st_size != stLink.st_size) {
|
||||||
printMsg(lvlError, format("removing corrupted link ‘%1%’") % linkPath);
|
printError(format("removing corrupted link ‘%1%’") % linkPath);
|
||||||
unlink(linkPath.c_str());
|
unlink(linkPath.c_str());
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
|
||||||
systems). This is likely to happen with empty files.
|
systems). This is likely to happen with empty files.
|
||||||
Just shrug and ignore. */
|
Just shrug and ignore. */
|
||||||
if (st.st_size)
|
if (st.st_size)
|
||||||
printMsg(lvlInfo, format("‘%1%’ has maximum number of links") % linkPath);
|
printInfo(format("‘%1%’ has maximum number of links") % linkPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw SysError(format("cannot link ‘%1%’ to ‘%2%’") % tempLink % linkPath);
|
throw SysError(format("cannot link ‘%1%’ to ‘%2%’") % tempLink % linkPath);
|
||||||
|
@ -201,14 +201,14 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
|
||||||
/* Atomically replace the old file with the new hard link. */
|
/* Atomically replace the old file with the new hard link. */
|
||||||
if (rename(tempLink.c_str(), path.c_str()) == -1) {
|
if (rename(tempLink.c_str(), path.c_str()) == -1) {
|
||||||
if (unlink(tempLink.c_str()) == -1)
|
if (unlink(tempLink.c_str()) == -1)
|
||||||
printMsg(lvlError, format("unable to unlink ‘%1%’") % tempLink);
|
printError(format("unable to unlink ‘%1%’") % tempLink);
|
||||||
if (errno == EMLINK) {
|
if (errno == EMLINK) {
|
||||||
/* Some filesystems generate too many links on the rename,
|
/* Some filesystems generate too many links on the rename,
|
||||||
rather than on the original link. (Probably it
|
rather than on the original link. (Probably it
|
||||||
temporarily increases the st_nlink field before
|
temporarily increases the st_nlink field before
|
||||||
decreasing it again.) */
|
decreasing it again.) */
|
||||||
if (st.st_size)
|
if (st.st_size)
|
||||||
printMsg(lvlInfo, format("‘%1%’ has maximum number of links") % linkPath);
|
printInfo(format("‘%1%’ has maximum number of links") % linkPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw SysError(format("cannot rename ‘%1%’ to ‘%2%’") % tempLink % path);
|
throw SysError(format("cannot rename ‘%1%’ to ‘%2%’") % tempLink % path);
|
||||||
|
@ -244,7 +244,7 @@ void LocalStore::optimiseStore()
|
||||||
|
|
||||||
optimiseStore(stats);
|
optimiseStore(stats);
|
||||||
|
|
||||||
printMsg(lvlError,
|
printError(
|
||||||
format("%1% freed by hard-linking %2% files")
|
format("%1% freed by hard-linking %2% files")
|
||||||
% showBytes(stats.bytesFreed)
|
% showBytes(stats.bytesFreed)
|
||||||
% stats.filesLinked);
|
% stats.filesLinked);
|
||||||
|
|
|
@ -121,7 +121,7 @@ bool PathLocks::lockPaths(const PathSet & _paths,
|
||||||
/* Acquire an exclusive lock. */
|
/* Acquire an exclusive lock. */
|
||||||
if (!lockFile(fd.get(), ltWrite, false)) {
|
if (!lockFile(fd.get(), ltWrite, false)) {
|
||||||
if (wait) {
|
if (wait) {
|
||||||
if (waitMsg != "") printMsg(lvlError, waitMsg);
|
if (waitMsg != "") printError(waitMsg);
|
||||||
lockFile(fd.get(), ltWrite, true);
|
lockFile(fd.get(), ltWrite, true);
|
||||||
} else {
|
} else {
|
||||||
/* Failed to lock this path; release all other
|
/* Failed to lock this path; release all other
|
||||||
|
@ -174,7 +174,7 @@ void PathLocks::unlock()
|
||||||
|
|
||||||
lockedPaths.erase(i.second);
|
lockedPaths.erase(i.second);
|
||||||
if (close(i.first) == -1)
|
if (close(i.first) == -1)
|
||||||
printMsg(lvlError,
|
printError(
|
||||||
format("error (ignored): cannot close lock file on ‘%1%’") % i.second);
|
format("error (ignored): cannot close lock file on ‘%1%’") % i.second);
|
||||||
|
|
||||||
debug(format("lock released on ‘%1%’") % i.second);
|
debug(format("lock released on ‘%1%’") % i.second);
|
||||||
|
|
|
@ -132,9 +132,9 @@ void deleteGeneration(const Path & profile, unsigned int gen)
|
||||||
static void deleteGeneration2(const Path & profile, unsigned int gen, bool dryRun)
|
static void deleteGeneration2(const Path & profile, unsigned int gen, bool dryRun)
|
||||||
{
|
{
|
||||||
if (dryRun)
|
if (dryRun)
|
||||||
printMsg(lvlInfo, format("would remove generation %1%") % gen);
|
printInfo(format("would remove generation %1%") % gen);
|
||||||
else {
|
else {
|
||||||
printMsg(lvlInfo, format("removing generation %1%") % gen);
|
printInfo(format("removing generation %1%") % gen);
|
||||||
deleteGeneration(profile, gen);
|
deleteGeneration(profile, gen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -559,7 +559,7 @@ void RemoteStore::Connection::processStderr(Sink * sink, Source * source)
|
||||||
to.flush();
|
to.flush();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printMsg(lvlError, chomp(readString(from)));
|
printError(chomp(readString(from)));
|
||||||
}
|
}
|
||||||
if (msg == STDERR_ERROR) {
|
if (msg == STDERR_ERROR) {
|
||||||
string error = readString(from);
|
string error = readString(from);
|
||||||
|
|
|
@ -161,7 +161,7 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore
|
||||||
|
|
||||||
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count();
|
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count();
|
||||||
|
|
||||||
printMsg(lvlInfo, format("uploaded ‘s3://%1%/%2%’ (%3% bytes) in %4% ms")
|
printInfo(format("uploaded ‘s3://%1%/%2%’ (%3% bytes) in %4% ms")
|
||||||
% bucketName % path % data.size() % duration);
|
% bucketName % path % data.size() % duration);
|
||||||
|
|
||||||
stats.putTimeMs += duration;
|
stats.putTimeMs += duration;
|
||||||
|
|
|
@ -10,11 +10,11 @@ namespace nix {
|
||||||
int err = sqlite3_errcode(db);
|
int err = sqlite3_errcode(db);
|
||||||
if (err == SQLITE_BUSY || err == SQLITE_PROTOCOL) {
|
if (err == SQLITE_BUSY || err == SQLITE_PROTOCOL) {
|
||||||
if (err == SQLITE_PROTOCOL)
|
if (err == SQLITE_PROTOCOL)
|
||||||
printMsg(lvlError, "warning: SQLite database is busy (SQLITE_PROTOCOL)");
|
printError("warning: SQLite database is busy (SQLITE_PROTOCOL)");
|
||||||
else {
|
else {
|
||||||
static bool warned = false;
|
static bool warned = false;
|
||||||
if (!warned) {
|
if (!warned) {
|
||||||
printMsg(lvlError, "warning: SQLite database is busy");
|
printError("warning: SQLite database is busy");
|
||||||
warned = true;
|
warned = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -472,7 +472,7 @@ void ValidPathInfo::sign(const SecretKey & secretKey)
|
||||||
bool ValidPathInfo::isContentAddressed(const Store & store) const
|
bool ValidPathInfo::isContentAddressed(const Store & store) const
|
||||||
{
|
{
|
||||||
auto warn = [&]() {
|
auto warn = [&]() {
|
||||||
printMsg(lvlError, format("warning: path ‘%s’ claims to be content-addressed but isn't") % path);
|
printError(format("warning: path ‘%s’ claims to be content-addressed but isn't") % path);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (hasPrefix(ca, "text:")) {
|
if (hasPrefix(ca, "text:")) {
|
||||||
|
|
|
@ -20,12 +20,12 @@ void setAffinityTo(int cpu)
|
||||||
#if __linux__
|
#if __linux__
|
||||||
if (sched_getaffinity(0, sizeof(cpu_set_t), &savedAffinity) == -1) return;
|
if (sched_getaffinity(0, sizeof(cpu_set_t), &savedAffinity) == -1) return;
|
||||||
didSaveAffinity = true;
|
didSaveAffinity = true;
|
||||||
printMsg(lvlDebug, format("locking this thread to CPU %1%") % cpu);
|
debug(format("locking this thread to CPU %1%") % cpu);
|
||||||
cpu_set_t newAffinity;
|
cpu_set_t newAffinity;
|
||||||
CPU_ZERO(&newAffinity);
|
CPU_ZERO(&newAffinity);
|
||||||
CPU_SET(cpu, &newAffinity);
|
CPU_SET(cpu, &newAffinity);
|
||||||
if (sched_setaffinity(0, sizeof(cpu_set_t), &newAffinity) == -1)
|
if (sched_setaffinity(0, sizeof(cpu_set_t), &newAffinity) == -1)
|
||||||
printMsg(lvlError, format("failed to lock thread to CPU %1%") % cpu);
|
printError(format("failed to lock thread to CPU %1%") % cpu);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ void restoreAffinity()
|
||||||
#if __linux__
|
#if __linux__
|
||||||
if (!didSaveAffinity) return;
|
if (!didSaveAffinity) return;
|
||||||
if (sched_setaffinity(0, sizeof(cpu_set_t), &savedAffinity) == -1)
|
if (sched_setaffinity(0, sizeof(cpu_set_t), &savedAffinity) == -1)
|
||||||
printMsg(lvlError, "failed to restore affinity %1%");
|
printError("failed to restore affinity %1%");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ static void dump(const Path & path, Sink & sink, PathFilter & filter)
|
||||||
string name(i.name);
|
string name(i.name);
|
||||||
size_t pos = i.name.find(caseHackSuffix);
|
size_t pos = i.name.find(caseHackSuffix);
|
||||||
if (pos != string::npos) {
|
if (pos != string::npos) {
|
||||||
printMsg(lvlDebug, format("removing case hack suffix from ‘%1%’") % (path + "/" + i.name));
|
debug(format("removing case hack suffix from ‘%1%’") % (path + "/" + i.name));
|
||||||
name.erase(pos);
|
name.erase(pos);
|
||||||
}
|
}
|
||||||
if (unhacked.find(name) != unhacked.end())
|
if (unhacked.find(name) != unhacked.end())
|
||||||
|
@ -248,7 +248,7 @@ static void parse(ParseSink & sink, Source & source, const Path & path)
|
||||||
if (useCaseHack) {
|
if (useCaseHack) {
|
||||||
auto i = names.find(name);
|
auto i = names.find(name);
|
||||||
if (i != names.end()) {
|
if (i != names.end()) {
|
||||||
printMsg(lvlDebug, format("case collision between ‘%1%’ and ‘%2%’") % i->first % name);
|
debug(format("case collision between ‘%1%’ and ‘%2%’") % i->first % name);
|
||||||
name += caseHackSuffix;
|
name += caseHackSuffix;
|
||||||
name += std::to_string(++i->second);
|
name += std::to_string(++i->second);
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -52,7 +52,7 @@ Verbosity verbosity = lvlInfo;
|
||||||
void warnOnce(bool & haveWarned, const FormatOrString & fs)
|
void warnOnce(bool & haveWarned, const FormatOrString & fs)
|
||||||
{
|
{
|
||||||
if (!haveWarned) {
|
if (!haveWarned) {
|
||||||
printMsg(lvlError, format("warning: %1%") % fs.s);
|
printError(format("warning: %1%") % fs.s);
|
||||||
haveWarned = true;
|
haveWarned = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ size_t threshold = 256 * 1024 * 1024;
|
||||||
|
|
||||||
static void warnLargeDump()
|
static void warnLargeDump()
|
||||||
{
|
{
|
||||||
printMsg(lvlError, "warning: dumping very large path (> 256 MiB); this may run out of memory");
|
printError("warning: dumping very large path (> 256 MiB); this may run out of memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ void ThreadPool::workerEntry()
|
||||||
if (state->exception) {
|
if (state->exception) {
|
||||||
if (!dynamic_cast<Interrupted*>(&e) &&
|
if (!dynamic_cast<Interrupted*>(&e) &&
|
||||||
!dynamic_cast<ThreadPoolShutDown*>(&e))
|
!dynamic_cast<ThreadPoolShutDown*>(&e))
|
||||||
printMsg(lvlError, format("error: %s") % e.what());
|
printError(format("error: %s") % e.what());
|
||||||
} else {
|
} else {
|
||||||
state->exception = std::current_exception();
|
state->exception = std::current_exception();
|
||||||
work.notify_all();
|
work.notify_all();
|
||||||
|
|
|
@ -724,20 +724,20 @@ void Pid::kill(bool quiet)
|
||||||
if (pid == -1 || pid == 0) return;
|
if (pid == -1 || pid == 0) return;
|
||||||
|
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
printMsg(lvlError, format("killing process %1%") % pid);
|
printError(format("killing process %1%") % pid);
|
||||||
|
|
||||||
/* Send the requested signal to the child. If it has its own
|
/* Send the requested signal to the child. If it has its own
|
||||||
process group, send the signal to every process in the child
|
process group, send the signal to every process in the child
|
||||||
process group (which hopefully includes *all* its children). */
|
process group (which hopefully includes *all* its children). */
|
||||||
if (::kill(separatePG ? -pid : pid, killSignal) != 0)
|
if (::kill(separatePG ? -pid : pid, killSignal) != 0)
|
||||||
printMsg(lvlError, (SysError(format("killing process %1%") % pid).msg()));
|
printError((SysError(format("killing process %1%") % pid).msg()));
|
||||||
|
|
||||||
/* Wait until the child dies, disregarding the exit status. */
|
/* Wait until the child dies, disregarding the exit status. */
|
||||||
int status;
|
int status;
|
||||||
while (waitpid(pid, &status, 0) == -1) {
|
while (waitpid(pid, &status, 0) == -1) {
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
if (errno != EINTR) {
|
if (errno != EINTR) {
|
||||||
printMsg(lvlError,
|
printError(
|
||||||
(SysError(format("waiting for process %1%") % pid).msg()));
|
(SysError(format("waiting for process %1%") % pid).msg()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1125,7 +1125,7 @@ void ignoreException()
|
||||||
try {
|
try {
|
||||||
throw;
|
throw;
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
printMsg(lvlError, format("error (ignored): %1%") % e.what());
|
printError(format("error (ignored): %1%") % e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1228,7 +1228,7 @@ void callFailure(const std::function<void(std::exception_ptr exc)> & failure, st
|
||||||
try {
|
try {
|
||||||
failure(exc);
|
failure(exc);
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
printMsg(lvlError, format("uncaught exception: %s") % e.what());
|
printError(format("uncaught exception: %s") % e.what());
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ void removeOldGenerations(std::string dir)
|
||||||
if (e.errNo == ENOENT) continue;
|
if (e.errNo == ENOENT) continue;
|
||||||
}
|
}
|
||||||
if (link.find("link") != string::npos) {
|
if (link.find("link") != string::npos) {
|
||||||
printMsg(lvlInfo, format("removing old generations of profile %1%") % path);
|
printInfo(format("removing old generations of profile %1%") % path);
|
||||||
if (deleteOlderThan != "")
|
if (deleteOlderThan != "")
|
||||||
deleteGenerationsOlderThan(path, deleteOlderThan, dryRun);
|
deleteGenerationsOlderThan(path, deleteOlderThan, dryRun);
|
||||||
else
|
else
|
||||||
|
|
|
@ -644,7 +644,7 @@ static void processConnection(bool trusted)
|
||||||
|
|
||||||
canSendStderr = false;
|
canSendStderr = false;
|
||||||
_isInterrupted = false;
|
_isInterrupted = false;
|
||||||
printMsg(lvlDebug, format("%1% operations") % opCount);
|
debug(format("%1% operations") % opCount);
|
||||||
|
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
stopWork(false, e.msg(), 1);
|
stopWork(false, e.msg(), 1);
|
||||||
|
@ -837,7 +837,7 @@ static void daemonLoop(char * * argv)
|
||||||
if (!trusted && !matchUser(user, group, allowedUsers))
|
if (!trusted && !matchUser(user, group, allowedUsers))
|
||||||
throw Error(format("user ‘%1%’ is not allowed to connect to the Nix daemon") % user);
|
throw Error(format("user ‘%1%’ is not allowed to connect to the Nix daemon") % user);
|
||||||
|
|
||||||
printMsg(lvlInfo, format((string) "accepted connection from pid %1%, user %2%" + (trusted ? " (trusted)" : ""))
|
printInfo(format((string) "accepted connection from pid %1%, user %2%" + (trusted ? " (trusted)" : ""))
|
||||||
% (peer.pidKnown ? std::to_string(peer.pid) : "<unknown>")
|
% (peer.pidKnown ? std::to_string(peer.pid) : "<unknown>")
|
||||||
% (peer.uidKnown ? user : "<unknown>"));
|
% (peer.uidKnown ? user : "<unknown>"));
|
||||||
|
|
||||||
|
@ -874,7 +874,7 @@ static void daemonLoop(char * * argv)
|
||||||
} catch (Interrupted & e) {
|
} catch (Interrupted & e) {
|
||||||
throw;
|
throw;
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
printMsg(lvlError, format("error processing connection: %1%") % e.msg());
|
printError(format("error processing connection: %1%") % e.msg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ static void getAllExprs(EvalState & state,
|
||||||
if (hasSuffix(attrName, ".nix"))
|
if (hasSuffix(attrName, ".nix"))
|
||||||
attrName = string(attrName, 0, attrName.size() - 4);
|
attrName = string(attrName, 0, attrName.size() - 4);
|
||||||
if (attrs.find(attrName) != attrs.end()) {
|
if (attrs.find(attrName) != attrs.end()) {
|
||||||
printMsg(lvlError, format("warning: name collision in input Nix expressions, skipping ‘%1%’") % path2);
|
printError(format("warning: name collision in input Nix expressions, skipping ‘%1%’") % path2);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
attrs.insert(attrName);
|
attrs.insert(attrName);
|
||||||
|
@ -304,7 +304,7 @@ static DrvInfos filterBySelector(EvalState & state, const DrvInfos & allElems,
|
||||||
matches.clear();
|
matches.clear();
|
||||||
for (auto & j : newest) {
|
for (auto & j : newest) {
|
||||||
if (multiple.find(j.second.first.name) != multiple.end())
|
if (multiple.find(j.second.first.name) != multiple.end())
|
||||||
printMsg(lvlInfo,
|
printInfo(
|
||||||
format("warning: there are multiple derivations named ‘%1%’; using the first one")
|
format("warning: there are multiple derivations named ‘%1%’; using the first one")
|
||||||
% j.second.first.name);
|
% j.second.first.name);
|
||||||
matches.push_back(j.second);
|
matches.push_back(j.second);
|
||||||
|
@ -496,13 +496,13 @@ static void installDerivations(Globals & globals,
|
||||||
if (!globals.preserveInstalled &&
|
if (!globals.preserveInstalled &&
|
||||||
newNames.find(drvName.name) != newNames.end() &&
|
newNames.find(drvName.name) != newNames.end() &&
|
||||||
!keep(i))
|
!keep(i))
|
||||||
printMsg(lvlInfo, format("replacing old ‘%1%’") % i.name);
|
printInfo(format("replacing old ‘%1%’") % i.name);
|
||||||
else
|
else
|
||||||
allElems.push_back(i);
|
allElems.push_back(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto & i : newElems)
|
for (auto & i : newElems)
|
||||||
printMsg(lvlInfo, format("installing ‘%1%’") % i.name);
|
printInfo(format("installing ‘%1%’") % i.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
printMissing(*globals.state, newElems);
|
printMissing(*globals.state, newElems);
|
||||||
|
@ -604,7 +604,7 @@ static void upgradeDerivations(Globals & globals,
|
||||||
{
|
{
|
||||||
const char * action = compareVersions(drvName.version, bestVersion) <= 0
|
const char * action = compareVersions(drvName.version, bestVersion) <= 0
|
||||||
? "upgrading" : "downgrading";
|
? "upgrading" : "downgrading";
|
||||||
printMsg(lvlInfo,
|
printInfo(
|
||||||
format("%1% ‘%2%’ to ‘%3%’")
|
format("%1% ‘%2%’ to ‘%3%’")
|
||||||
% action % i.name % bestElem->name);
|
% action % i.name % bestElem->name);
|
||||||
newElems.push_back(*bestElem);
|
newElems.push_back(*bestElem);
|
||||||
|
@ -674,7 +674,7 @@ static void opSetFlag(Globals & globals, Strings opFlags, Strings opArgs)
|
||||||
DrvName drvName(i.name);
|
DrvName drvName(i.name);
|
||||||
for (auto & j : selectors)
|
for (auto & j : selectors)
|
||||||
if (j.matches(drvName)) {
|
if (j.matches(drvName)) {
|
||||||
printMsg(lvlInfo, format("setting flag on ‘%1%’") % i.name);
|
printInfo(format("setting flag on ‘%1%’") % i.name);
|
||||||
j.hits++;
|
j.hits++;
|
||||||
setMetaFlag(*globals.state, i, flagName, flagValue);
|
setMetaFlag(*globals.state, i, flagName, flagValue);
|
||||||
break;
|
break;
|
||||||
|
@ -748,7 +748,7 @@ static void uninstallDerivations(Globals & globals, Strings & selectors,
|
||||||
if ((isPath(j) && i.queryOutPath() == globals.state->store->followLinksToStorePath(j))
|
if ((isPath(j) && i.queryOutPath() == globals.state->store->followLinksToStorePath(j))
|
||||||
|| DrvName(j).matches(drvName))
|
|| DrvName(j).matches(drvName))
|
||||||
{
|
{
|
||||||
printMsg(lvlInfo, format("uninstalling ‘%1%’") % i.name);
|
printInfo(format("uninstalling ‘%1%’") % i.name);
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -874,7 +874,7 @@ static void queryJSON(Globals & globals, vector<DrvInfo> & elems)
|
||||||
auto placeholder = metaObj.placeholder(j);
|
auto placeholder = metaObj.placeholder(j);
|
||||||
Value * v = i.queryMeta(j);
|
Value * v = i.queryMeta(j);
|
||||||
if (!v) {
|
if (!v) {
|
||||||
printMsg(lvlError, format("derivation ‘%1%’ has invalid meta attribute ‘%2%’") % i.name % j);
|
printError(format("derivation ‘%1%’ has invalid meta attribute ‘%2%’") % i.name % j);
|
||||||
placeholder.write(nullptr);
|
placeholder.write(nullptr);
|
||||||
} else {
|
} else {
|
||||||
PathSet context;
|
PathSet context;
|
||||||
|
@ -1118,7 +1118,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
|
||||||
attrs2["name"] = j;
|
attrs2["name"] = j;
|
||||||
Value * v = i.queryMeta(j);
|
Value * v = i.queryMeta(j);
|
||||||
if (!v)
|
if (!v)
|
||||||
printMsg(lvlError, format("derivation ‘%1%’ has invalid meta attribute ‘%2%’") % i.name % j);
|
printError(format("derivation ‘%1%’ has invalid meta attribute ‘%2%’") % i.name % j);
|
||||||
else {
|
else {
|
||||||
if (v->type == tString) {
|
if (v->type == tString) {
|
||||||
attrs2["type"] = "string";
|
attrs2["type"] = "string";
|
||||||
|
@ -1219,7 +1219,7 @@ static void switchGeneration(Globals & globals, int dstGen)
|
||||||
throw Error(format("generation %1% does not exist") % dstGen);
|
throw Error(format("generation %1% does not exist") % dstGen);
|
||||||
}
|
}
|
||||||
|
|
||||||
printMsg(lvlInfo, format("switching from generation %1% to %2%")
|
printInfo(format("switching from generation %1% to %2%")
|
||||||
% curGen % dst.number);
|
% curGen % dst.number);
|
||||||
|
|
||||||
if (globals.dryRun) return;
|
if (globals.dryRun) return;
|
||||||
|
@ -1372,7 +1372,7 @@ int main(int argc, char * * argv)
|
||||||
else if (*arg == "--delete-generations")
|
else if (*arg == "--delete-generations")
|
||||||
op = opDeleteGenerations;
|
op = opDeleteGenerations;
|
||||||
else if (*arg == "--dry-run") {
|
else if (*arg == "--dry-run") {
|
||||||
printMsg(lvlInfo, "(dry run; not doing anything)");
|
printInfo("(dry run; not doing anything)");
|
||||||
globals.dryRun = true;
|
globals.dryRun = true;
|
||||||
}
|
}
|
||||||
else if (*arg == "--system-filter")
|
else if (*arg == "--system-filter")
|
||||||
|
|
|
@ -139,7 +139,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
|
||||||
|
|
||||||
Path lockTokenCur = optimisticLockProfile(profile);
|
Path lockTokenCur = optimisticLockProfile(profile);
|
||||||
if (lockToken != lockTokenCur) {
|
if (lockToken != lockTokenCur) {
|
||||||
printMsg(lvlError, format("profile ‘%1%’ changed while we were busy; restarting") % profile);
|
printError(format("profile ‘%1%’ changed while we were busy; restarting") % profile);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ int main(int argc, char * * argv)
|
||||||
/* Extract the hash mode. */
|
/* Extract the hash mode. */
|
||||||
attr = v.attrs->find(state.symbols.create("outputHashMode"));
|
attr = v.attrs->find(state.symbols.create("outputHashMode"));
|
||||||
if (attr == v.attrs->end())
|
if (attr == v.attrs->end())
|
||||||
printMsg(lvlInfo, "warning: this does not look like a fetchurl call");
|
printInfo("warning: this does not look like a fetchurl call");
|
||||||
else
|
else
|
||||||
unpack = state.forceString(*attr->value) == "recursive";
|
unpack = state.forceString(*attr->value) == "recursive";
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ int main(int argc, char * * argv)
|
||||||
|
|
||||||
/* Optionally unpack the file. */
|
/* Optionally unpack the file. */
|
||||||
if (unpack) {
|
if (unpack) {
|
||||||
printMsg(lvlInfo, "unpacking...");
|
printInfo("unpacking...");
|
||||||
Path unpacked = (Path) tmpDir + "/unpacked";
|
Path unpacked = (Path) tmpDir + "/unpacked";
|
||||||
createDirs(unpacked);
|
createDirs(unpacked);
|
||||||
if (hasSuffix(baseNameOf(uri), ".zip"))
|
if (hasSuffix(baseNameOf(uri), ".zip"))
|
||||||
|
@ -201,7 +201,7 @@ int main(int argc, char * * argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!printPath)
|
if (!printPath)
|
||||||
printMsg(lvlInfo, format("path is ‘%1%’") % storePath);
|
printInfo(format("path is ‘%1%’") % storePath);
|
||||||
|
|
||||||
std::cout << printHash16or32(hash) << std::endl;
|
std::cout << printHash16or32(hash) << std::endl;
|
||||||
if (printPath)
|
if (printPath)
|
||||||
|
|
|
@ -755,7 +755,7 @@ static void opVerify(Strings opFlags, Strings opArgs)
|
||||||
else throw UsageError(format("unknown flag ‘%1%’") % i);
|
else throw UsageError(format("unknown flag ‘%1%’") % i);
|
||||||
|
|
||||||
if (store->verifyStore(checkContents, repair)) {
|
if (store->verifyStore(checkContents, repair)) {
|
||||||
printMsg(lvlError, "warning: not all errors were fixed");
|
printError("warning: not all errors were fixed");
|
||||||
throw Exit(1);
|
throw Exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -777,7 +777,7 @@ static void opVerifyPath(Strings opFlags, Strings opArgs)
|
||||||
store->narFromPath(path, sink);
|
store->narFromPath(path, sink);
|
||||||
auto current = sink.finish();
|
auto current = sink.finish();
|
||||||
if (current.first != info->narHash) {
|
if (current.first != info->narHash) {
|
||||||
printMsg(lvlError,
|
printError(
|
||||||
format("path ‘%1%’ was modified! expected hash ‘%2%’, got ‘%3%’")
|
format("path ‘%1%’ was modified! expected hash ‘%2%’, got ‘%3%’")
|
||||||
% path % printHash(info->narHash) % printHash(current.first));
|
% path % printHash(info->narHash) % printHash(current.first));
|
||||||
status = 1;
|
status = 1;
|
||||||
|
@ -879,7 +879,7 @@ static void opServe(Strings opFlags, Strings opArgs)
|
||||||
try {
|
try {
|
||||||
store->buildPaths(willSubstitute);
|
store->buildPaths(willSubstitute);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
printMsg(lvlError, format("warning: %1%") % e.msg());
|
printError(format("warning: %1%") % e.msg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ struct CmdCopySigs : StorePathsCommand
|
||||||
|
|
||||||
pool.process();
|
pool.process();
|
||||||
|
|
||||||
printMsg(lvlInfo, format("imported %d signatures") % added);
|
printInfo(format("imported %d signatures") % added);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ struct CmdSignPaths : StorePathsCommand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printMsg(lvlInfo, format("added %d signatures") % added);
|
printInfo(format("added %d signatures") % added);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ struct CmdVerify : StorePathsCommand
|
||||||
if (hash.first != info->narHash) {
|
if (hash.first != info->narHash) {
|
||||||
logger->incProgress(corruptedLabel);
|
logger->incProgress(corruptedLabel);
|
||||||
corrupted = 1;
|
corrupted = 1;
|
||||||
printMsg(lvlError,
|
printError(
|
||||||
format("path ‘%s’ was modified! expected hash ‘%s’, got ‘%s’")
|
format("path ‘%s’ was modified! expected hash ‘%s’, got ‘%s’")
|
||||||
% info->path % printHash(info->narHash) % printHash(hash.first));
|
% info->path % printHash(info->narHash) % printHash(hash.first));
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ struct CmdVerify : StorePathsCommand
|
||||||
doSigs(info2->sigs);
|
doSigs(info2->sigs);
|
||||||
} catch (InvalidPath &) {
|
} catch (InvalidPath &) {
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
printMsg(lvlError, format(ANSI_RED "error:" ANSI_NORMAL " %s") % e.what());
|
printError(format(ANSI_RED "error:" ANSI_NORMAL " %s") % e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ struct CmdVerify : StorePathsCommand
|
||||||
if (!good) {
|
if (!good) {
|
||||||
logger->incProgress(untrustedLabel);
|
logger->incProgress(untrustedLabel);
|
||||||
untrusted++;
|
untrusted++;
|
||||||
printMsg(lvlError, format("path ‘%s’ is untrusted") % info->path);
|
printError(format("path ‘%s’ is untrusted") % info->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ struct CmdVerify : StorePathsCommand
|
||||||
done++;
|
done++;
|
||||||
|
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
printMsg(lvlError, format(ANSI_RED "error:" ANSI_NORMAL " %s") % e.what());
|
printError(format(ANSI_RED "error:" ANSI_NORMAL " %s") % e.what());
|
||||||
logger->incProgress(failedLabel);
|
logger->incProgress(failedLabel);
|
||||||
failed++;
|
failed++;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ struct CmdVerify : StorePathsCommand
|
||||||
|
|
||||||
pool.process();
|
pool.process();
|
||||||
|
|
||||||
printMsg(lvlInfo, format("%d paths checked, %d untrusted, %d corrupted, %d failed")
|
printInfo(format("%d paths checked, %d untrusted, %d corrupted, %d failed")
|
||||||
% done % untrusted % corrupted % failed);
|
% done % untrusted % corrupted % failed);
|
||||||
|
|
||||||
throw Exit(
|
throw Exit(
|
||||||
|
|
|
@ -62,13 +62,13 @@ std::set<std::string> runResolver(const Path & filename) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mach64_offset == 0) {
|
if (mach64_offset == 0) {
|
||||||
printMsg(lvlError, format("Could not find any mach64 blobs in file ‘%1%’, continuing...") % filename);
|
printError(format("Could not find any mach64 blobs in file ‘%1%’, continuing...") % filename);
|
||||||
return std::set<string>();
|
return std::set<string>();
|
||||||
}
|
}
|
||||||
} else if (magic == MH_MAGIC_64 || magic == MH_CIGAM_64) {
|
} else if (magic == MH_MAGIC_64 || magic == MH_CIGAM_64) {
|
||||||
mach64_offset = 0;
|
mach64_offset = 0;
|
||||||
} else {
|
} else {
|
||||||
printMsg(lvlError, format("Object file has unknown magic number ‘%1%’, skipping it...") % magic);
|
printError(format("Object file has unknown magic number ‘%1%’, skipping it...") % magic);
|
||||||
return std::set<string>();
|
return std::set<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue