Merge pull request #9924 from 9999years/rename-yellowtxt

Rename `yellowtxt` -> `magentatxt`

(cherry picked from commit fb78a99e04)
Change-Id: I9ade553d9f499e6713aeff3463c9a653a880a051
This commit is contained in:
eldritch horrors 2024-03-04 08:53:10 +01:00
parent 43cedec6c5
commit cd654451c9
3 changed files with 9 additions and 11 deletions

View file

@ -708,7 +708,7 @@ void DerivationGoal::tryToBuild()
if (!outputLocks.lockPaths(lockFiles, "", false)) { if (!outputLocks.lockPaths(lockFiles, "", false)) {
if (!actLock) if (!actLock)
actLock = std::make_unique<Activity>(*logger, lvlWarn, actBuildWaiting, actLock = std::make_unique<Activity>(*logger, lvlWarn, actBuildWaiting,
fmt("waiting for lock on %s", yellowtxt(showPaths(lockFiles)))); fmt("waiting for lock on %s", magentatxt(showPaths(lockFiles))));
worker.waitForAWhile(shared_from_this()); worker.waitForAWhile(shared_from_this());
return; return;
} }
@ -762,7 +762,7 @@ void DerivationGoal::tryToBuild()
the wake-up timeout expires. */ the wake-up timeout expires. */
if (!actLock) if (!actLock)
actLock = std::make_unique<Activity>(*logger, lvlWarn, actBuildWaiting, actLock = std::make_unique<Activity>(*logger, lvlWarn, actBuildWaiting,
fmt("waiting for a machine to build '%s'", yellowtxt(worker.store.printStorePath(drvPath)))); fmt("waiting for a machine to build '%s'", magentatxt(worker.store.printStorePath(drvPath))));
worker.waitForAWhile(shared_from_this()); worker.waitForAWhile(shared_from_this());
outputLocks.unlock(); outputLocks.unlock();
return; return;
@ -987,7 +987,7 @@ void DerivationGoal::buildDone()
diskFull |= cleanupDecideWhetherDiskFull(); diskFull |= cleanupDecideWhetherDiskFull();
auto msg = fmt("builder for '%s' %s", auto msg = fmt("builder for '%s' %s",
yellowtxt(worker.store.printStorePath(drvPath)), magentatxt(worker.store.printStorePath(drvPath)),
statusToString(status)); statusToString(status));
if (!logger->isVerbose() && !logTail.empty()) { if (!logger->isVerbose() && !logTail.empty()) {

View file

@ -227,7 +227,7 @@ void LocalDerivationGoal::tryLocalBuild()
if (!buildUser) { if (!buildUser) {
if (!actLock) if (!actLock)
actLock = std::make_unique<Activity>(*logger, lvlWarn, actBuildWaiting, actLock = std::make_unique<Activity>(*logger, lvlWarn, actBuildWaiting,
fmt("waiting for a free build user ID for '%s'", yellowtxt(worker.store.printStorePath(drvPath)))); fmt("waiting for a free build user ID for '%s'", magentatxt(worker.store.printStorePath(drvPath))));
worker.waitForAWhile(shared_from_this()); worker.waitForAWhile(shared_from_this());
return; return;
} }

View file

@ -58,19 +58,17 @@ inline std::string fmt(const std::string & fs, const Args & ... args)
return f.str(); return f.str();
} }
// -----------------------------------------------------------------------------
// format function for hints in errors. same as fmt, except templated values // format function for hints in errors. same as fmt, except templated values
// are always in yellow. // are always in magenta.
template <class T> template <class T>
struct yellowtxt struct magentatxt
{ {
yellowtxt(const T &s) : value(s) {} magentatxt(const T &s) : value(s) {}
const T & value; const T & value;
}; };
template <class T> template <class T>
std::ostream & operator<<(std::ostream & out, const yellowtxt<T> & y) std::ostream & operator<<(std::ostream & out, const magentatxt<T> & y)
{ {
return out << ANSI_WARNING << y.value << ANSI_NORMAL; return out << ANSI_WARNING << y.value << ANSI_NORMAL;
} }
@ -109,7 +107,7 @@ public:
template<class T> template<class T>
hintformat & operator%(const T & value) hintformat & operator%(const T & value)
{ {
fmt % yellowtxt(value); fmt % magentatxt(value);
return *this; return *this;
} }