Skip to content

Commit

Permalink
Add some more debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Mar 19, 2020
1 parent 50a52ed commit 7a6d76d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/build-remote/build-remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ static int _main(int argc, char * * argv)
}
}
if (!free) {
debug("skipping '%s': no slots free", m.storeUri);
continue;
}
bool best = false;
Expand All @@ -162,7 +163,15 @@ static int _main(int argc, char * * argv)
bestLoad = load;
bestSlotLock = std::move(free);
bestMachine = &m;
} else {
debug("skipping '%s': there is a better machine", m.storeUri);
}
} else {
debug("skipping '%s': does not meet all condiditions\n - enabled = %s\n - system: type is matching = %s / required %s / got %s\n - features: all supported = %s / mandatory supported = %s / required %s / got %s", m.storeUri,
m.enabled,
std::find(m.systemTypes.begin(), m.systemTypes.end(), neededSystem) != m.systemTypes.end(), neededSystem, join(m.systemTypes, ","),
m.allSupported(requiredFeatures), m.mandatoryMet(requiredFeatures), "", ""
);
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/libstore/build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,7 @@ void DerivationGoal::tryToBuild()
return;
case rpDecline:
/* We should do it ourselves. */
debug("skip remote build...");
break;
}
}
Expand Down Expand Up @@ -1738,7 +1739,10 @@ void DerivationGoal::buildDone()

HookReply DerivationGoal::tryBuildHook()
{
if (!worker.tryBuildHook || !useDerivation) return rpDecline;
if (!worker.tryBuildHook || !useDerivation) {
debug("ignore build hook for '%s'...", worker.store.printStorePath(drvPath));
return rpDecline;
}

if (!worker.hook)
worker.hook = std::make_unique<HookInstance>();
Expand Down
11 changes: 11 additions & 0 deletions src/libutil/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,17 @@ std::vector<std::string> split(const std::string& value,
return result;
}

std::string join(const std::vector<std::string> strings,
const char* delim)
{
std::ostringstream imploded;
std::copy(strings.begin(), strings.end(),
std::ostream_iterator<std::string>(imploded, delim));
std::string res = imploded.str();
res.erase(res.size() - 1);
return res;
}


std::string toLower(const std::string & s)
{
Expand Down
3 changes: 3 additions & 0 deletions src/libutil/util.hh
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,9 @@ bool hasSuffix(std::string_view s, std::string_view suffix);
std::vector<std::string> split(const std::string& value,
char separator);

/* Returns a stream with the joined string */
std::string join(const std::vector<std::string> strings,
const char* delim);

/* Convert a string to lower case. */
std::string toLower(const std::string & s);
Expand Down

0 comments on commit 7a6d76d

Please sign in to comment.