1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00

change status messages to info level

This commit is contained in:
Ben Burdette 2020-05-13 09:52:36 -06:00
parent ecbb8e9c0a
commit bfca5fc395
8 changed files with 25 additions and 32 deletions

View file

@ -4862,7 +4862,7 @@ void Worker::waitForInput()
if (!waitingForAWhile.empty()) { if (!waitingForAWhile.empty()) {
useTimeout = true; useTimeout = true;
if (lastWokenUp == steady_time_point::min()) if (lastWokenUp == steady_time_point::min())
printError("waiting for locks or build slots..."); printInfo("waiting for locks or build slots...");
if (lastWokenUp == steady_time_point::min() || lastWokenUp > before) lastWokenUp = before; if (lastWokenUp == steady_time_point::min() || lastWokenUp > before) lastWokenUp = before;
timeout = std::max(1L, timeout = std::max(1L,
(long) std::chrono::duration_cast<std::chrono::seconds>( (long) std::chrono::duration_cast<std::chrono::seconds>(

View file

@ -41,7 +41,7 @@ AutoCloseFD LocalStore::openGCLock(LockType lockType)
throw SysError("opening global GC lock '%1%'", fnGCLock); throw SysError("opening global GC lock '%1%'", fnGCLock);
if (!lockFile(fdGCLock.get(), lockType, false)) { if (!lockFile(fdGCLock.get(), lockType, false)) {
printError("waiting for the big garbage collector lock..."); printInfo("waiting for the big garbage collector lock...");
lockFile(fdGCLock.get(), lockType, true); lockFile(fdGCLock.get(), lockType, true);
} }
@ -231,7 +231,7 @@ void LocalStore::findTempRoots(FDs & fds, Roots & tempRoots, bool censor)
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)) {
printError("removing stale temporary roots file '%1%'", path); printInfo("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;
@ -751,7 +751,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. */
printError("finding garbage collector roots..."); printInfo("finding garbage collector roots...");
Roots rootMap; Roots rootMap;
if (!options.ignoreLiveness) if (!options.ignoreLiveness)
findRootsNoTemp(rootMap, true); findRootsNoTemp(rootMap, true);
@ -803,9 +803,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)
printError("deleting garbage..."); printInfo("deleting garbage...");
else else
printError("determining live/dead paths..."); printInfo("determining live/dead paths...");
try { try {
@ -872,7 +872,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
/* 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) {
printError("deleting unused links..."); printInfo("deleting unused links...");
removeUnusedLinks(state); removeUnusedLinks(state);
} }

View file

@ -152,7 +152,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)) {
printError("waiting for the big Nix store lock..."); printInfo("waiting for the big Nix store lock...");
lockFile(globalLock.get(), ltRead, true); lockFile(globalLock.get(), ltRead, true);
} }
@ -183,7 +183,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)) {
printError("waiting for exclusive access to the Nix store..."); printInfo("waiting for exclusive access to the Nix store...");
lockFile(globalLock.get(), ltWrite, true); lockFile(globalLock.get(), ltWrite, true);
} }
@ -261,7 +261,7 @@ LocalStore::~LocalStore()
} }
if (future.valid()) { if (future.valid()) {
printError("waiting for auto-GC to finish on exit..."); printInfo("waiting for auto-GC to finish on exit...");
future.get(); future.get();
} }
@ -1210,7 +1210,7 @@ void LocalStore::invalidatePathChecked(const StorePath & path)
bool LocalStore::verifyStore(bool checkContents, RepairFlag repair) bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
{ {
printError(format("reading the Nix store...")); printInfo(format("reading the Nix store..."));
bool errors = false; bool errors = false;
@ -1251,7 +1251,7 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
}); });
if (repair) { if (repair) {
if (unlink(linkPath.c_str()) == 0) if (unlink(linkPath.c_str()) == 0)
printError("removed link '%s'", linkPath); printInfo("removed link '%s'", linkPath);
else else
throw SysError("removing corrupt link '%s'", linkPath); throw SysError("removing corrupt link '%s'", linkPath);
} else { } else {
@ -1294,14 +1294,14 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair)
/* Fill in missing hashes. */ /* Fill in missing hashes. */
if (info->narHash == nullHash) { if (info->narHash == nullHash) {
printError("fixing missing hash on '%s'", printStorePath(i)); printInfo("fixing missing hash on '%s'", printStorePath(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) {
printError("updating size field on '%s' to %s", printStorePath(i), current.second); printInfo("updating size field on '%s' to %s", printStorePath(i), current.second);
info->narSize = current.second; info->narSize = current.second;
update = true; update = true;
} }
@ -1360,7 +1360,7 @@ void LocalStore::verifyPath(const Path & pathS, const StringSet & store,
} }
if (canInvalidate) { if (canInvalidate) {
printError("path '%s' disappeared, removing from database...", pathS); printInfo("path '%s' disappeared, removing from database...", pathS);
auto state(_state.lock()); auto state(_state.lock());
invalidatePath(*state, path); invalidatePath(*state, path);
} else { } else {
@ -1431,7 +1431,7 @@ static void makeMutable(const Path & path)
void LocalStore::upgradeStore7() void LocalStore::upgradeStore7()
{ {
if (getuid() != 0) return; if (getuid() != 0) return;
printError("removing immutable bits from the Nix store (this may take a while)..."); printInfo("removing immutable bits from the Nix store (this may take a while)...");
makeMutable(realStoreDir); makeMutable(realStoreDir);
} }

View file

@ -251,7 +251,11 @@ bool handleJSONLogMessage(const std::string & msg,
} }
} catch (std::exception & e) { } catch (std::exception & e) {
printError("bad log message from builder: %s", e.what()); logError(
ErrorInfo {
.name = "Json log message",
.hint = hintfmt("bad log message from builder: %s", e.what())
});
} }
return true; return true;

View file

@ -857,7 +857,7 @@ int Pid::kill()
#if __FreeBSD__ || __APPLE__ #if __FreeBSD__ || __APPLE__
if (errno != EPERM || ::kill(pid, 0) != 0) if (errno != EPERM || ::kill(pid, 0) != 0)
#endif #endif
printError((SysError("killing process %d", pid).msg())); logError(SysError("killing process %d", pid).info());
} }
return wait(); return wait();
@ -1447,17 +1447,6 @@ string base64Decode(const string & s)
} }
// void callFailure(const std::function<void(std::exception_ptr exc)> & failure, std::exception_ptr exc)
// {
// try {
// failure(exc);
// } catch (std::exception & e) {
// printError("uncaught exception: %s", e.what());
// abort();
// }
// }
static Sync<std::pair<unsigned short, unsigned short>> windowSize{{0, 0}}; static Sync<std::pair<unsigned short, unsigned short>> windowSize{{0, 0}};

View file

@ -146,7 +146,7 @@ bool createUserEnv(EvalState & state, DrvInfos & elems,
Path lockTokenCur = optimisticLockProfile(profile); Path lockTokenCur = optimisticLockProfile(profile);
if (lockToken != lockTokenCur) { if (lockToken != lockTokenCur) {
printError("profile '%1%' changed while we were busy; restarting", profile); printInfo("profile '%1%' changed while we were busy; restarting", profile);
return false; return false;
} }

View file

@ -85,7 +85,7 @@ struct CmdMakeContentAddressable : StorePathsCommand, MixJSON
info.ca = makeFixedOutputCA(true, info.narHash); info.ca = makeFixedOutputCA(true, info.narHash);
if (!json) if (!json)
printError("rewrote '%s' to '%s'", pathS, store->printStorePath(info.path)); printInfo("rewrote '%s' to '%s'", pathS, store->printStorePath(info.path));
auto source = sinkToSource([&](Sink & nextSink) { auto source = sinkToSource([&](Sink & nextSink) {
RewritingSink rsink2(oldHashPart, storePathToHash(store->printStorePath(info.path)), nextSink); RewritingSink rsink2(oldHashPart, storePathToHash(store->printStorePath(info.path)), nextSink);

View file

@ -98,7 +98,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
{"--profile", profileDir, "-i", store->printStorePath(storePath), "--no-sandbox"}); {"--profile", profileDir, "-i", store->printStorePath(storePath), "--no-sandbox"});
} }
printError(ANSI_GREEN "upgrade to version %s done" ANSI_NORMAL, version); printInfo(ANSI_GREEN "upgrade to version %s done" ANSI_NORMAL, version);
} }
/* Return the profile in which Nix is installed. */ /* Return the profile in which Nix is installed. */