mirror of
https://github.com/NixOS/nix
synced 2025-07-04 03:01:47 +02:00
Refactor: rename C++ concatStringsSep -> dropEmptyInitThenConcatStringsSep
This commit is contained in:
parent
b1effc9649
commit
1a8defd06f
33 changed files with 70 additions and 70 deletions
|
@ -895,7 +895,7 @@ void runPostBuildHook(
|
|||
std::map<std::string, std::string> hookEnvironment = getEnv();
|
||||
|
||||
hookEnvironment.emplace("DRV_PATH", store.printStorePath(drvPath));
|
||||
hookEnvironment.emplace("OUT_PATHS", chomp(concatStringsSep(" ", store.printStorePathSet(outputPaths))));
|
||||
hookEnvironment.emplace("OUT_PATHS", chomp(dropEmptyInitThenConcatStringsSep(" ", store.printStorePathSet(outputPaths))));
|
||||
hookEnvironment.emplace("NIX_CONFIG", globalConfig.toKeyValue());
|
||||
|
||||
struct LogSink : Sink {
|
||||
|
@ -1505,7 +1505,7 @@ std::pair<bool, SingleDrvOutputs> DerivationGoal::checkPathValidity()
|
|||
if (!wantedOutputsLeft.empty())
|
||||
throw Error("derivation '%s' does not have wanted outputs %s",
|
||||
worker.store.printStorePath(drvPath),
|
||||
concatStringsSep(", ", quoteStrings(wantedOutputsLeft)));
|
||||
dropEmptyInitThenConcatStringsSep(", ", quoteStrings(wantedOutputsLeft)));
|
||||
|
||||
bool allValid = true;
|
||||
for (auto & [_, status] : initialOutputs) {
|
||||
|
|
|
@ -42,7 +42,7 @@ void Store::buildPaths(const std::vector<DerivedPath> & reqs, BuildMode buildMod
|
|||
throw std::move(*ex);
|
||||
} else if (!failed.empty()) {
|
||||
if (ex) logError(ex->info());
|
||||
throw Error(worker.failingExitStatus(), "build of %s failed", concatStringsSep(", ", quoteStrings(failed)));
|
||||
throw Error(worker.failingExitStatus(), "build of %s failed", dropEmptyInitThenConcatStringsSep(", ", quoteStrings(failed)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ Settings::Settings()
|
|||
Strings ss;
|
||||
for (auto & p : tokenizeString<Strings>(*s, ":"))
|
||||
ss.push_back("@" + p);
|
||||
builders = concatStringsSep(" ", ss);
|
||||
builders = dropEmptyInitThenConcatStringsSep(" ", ss);
|
||||
}
|
||||
|
||||
#if defined(__linux__) && defined(SANDBOX_SHELL)
|
||||
|
|
|
@ -656,7 +656,7 @@ void LocalStore::registerDrvOutput(const Realisation & info)
|
|||
combinedSignatures.insert(info.signatures.begin(),
|
||||
info.signatures.end());
|
||||
state->stmts->UpdateRealisedOutput.use()
|
||||
(concatStringsSep(" ", combinedSignatures))
|
||||
(dropEmptyInitThenConcatStringsSep(" ", combinedSignatures))
|
||||
(info.id.strHash())
|
||||
(info.id.outputName)
|
||||
.exec();
|
||||
|
@ -675,7 +675,7 @@ void LocalStore::registerDrvOutput(const Realisation & info)
|
|||
(info.id.strHash())
|
||||
(info.id.outputName)
|
||||
(printStorePath(info.outPath))
|
||||
(concatStringsSep(" ", info.signatures))
|
||||
(dropEmptyInitThenConcatStringsSep(" ", info.signatures))
|
||||
.exec();
|
||||
}
|
||||
for (auto & [outputId, depPath] : info.dependentRealisations) {
|
||||
|
@ -729,7 +729,7 @@ uint64_t LocalStore::addValidPath(State & state,
|
|||
(info.deriver ? printStorePath(*info.deriver) : "", (bool) info.deriver)
|
||||
(info.narSize, info.narSize != 0)
|
||||
(info.ultimate ? 1 : 0, info.ultimate)
|
||||
(concatStringsSep(" ", info.sigs), !info.sigs.empty())
|
||||
(dropEmptyInitThenConcatStringsSep(" ", info.sigs), !info.sigs.empty())
|
||||
(renderContentAddress(info.ca), (bool) info.ca)
|
||||
.exec();
|
||||
uint64_t id = state.db.getLastInsertedRowId();
|
||||
|
@ -833,7 +833,7 @@ void LocalStore::updatePathInfo(State & state, const ValidPathInfo & info)
|
|||
(info.narSize, info.narSize != 0)
|
||||
(info.narHash.to_string(HashFormat::Base16, true))
|
||||
(info.ultimate ? 1 : 0, info.ultimate)
|
||||
(concatStringsSep(" ", info.sigs), !info.sigs.empty())
|
||||
(dropEmptyInitThenConcatStringsSep(" ", info.sigs), !info.sigs.empty())
|
||||
(renderContentAddress(info.ca), (bool) info.ca)
|
||||
(printStorePath(info.path))
|
||||
.exec();
|
||||
|
|
|
@ -464,7 +464,7 @@ OutputPathMap resolveDerivedPath(Store & store, const DerivedPath::Built & bfd)
|
|||
if (!outputsLeft.empty())
|
||||
throw Error("derivation '%s' does not have an outputs %s",
|
||||
store.printStorePath(drvPath),
|
||||
concatStringsSep(", ", quoteStrings(std::get<OutputsSpec::Names>(bfd.outputs.raw))));
|
||||
dropEmptyInitThenConcatStringsSep(", ", quoteStrings(std::get<OutputsSpec::Names>(bfd.outputs.raw))));
|
||||
return outputMap;
|
||||
}
|
||||
|
||||
|
|
|
@ -337,9 +337,9 @@ public:
|
|||
(narInfo ? narInfo->fileSize : 0, narInfo != 0 && narInfo->fileSize)
|
||||
(info->narHash.to_string(HashFormat::Nix32, true))
|
||||
(info->narSize)
|
||||
(concatStringsSep(" ", info->shortRefs()))
|
||||
(dropEmptyInitThenConcatStringsSep(" ", info->shortRefs()))
|
||||
(info->deriver ? std::string(info->deriver->to_string()) : "", (bool) info->deriver)
|
||||
(concatStringsSep(" ", info->sigs))
|
||||
(dropEmptyInitThenConcatStringsSep(" ", info->sigs))
|
||||
(renderContentAddress(info->ca))
|
||||
(time(0)).exec();
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ std::string NarInfo::to_string(const Store & store) const
|
|||
res += "NarHash: " + narHash.to_string(HashFormat::Nix32, true) + "\n";
|
||||
res += "NarSize: " + std::to_string(narSize) + "\n";
|
||||
|
||||
res += "References: " + concatStringsSep(" ", shortRefs()) + "\n";
|
||||
res += "References: " + dropEmptyInitThenConcatStringsSep(" ", shortRefs()) + "\n";
|
||||
|
||||
if (deriver)
|
||||
res += "Deriver: " + std::string(deriver->to_string()) + "\n";
|
||||
|
|
|
@ -83,7 +83,7 @@ std::string OutputsSpec::to_string() const
|
|||
return "*";
|
||||
},
|
||||
[&](const OutputsSpec::Names & outputNames) -> std::string {
|
||||
return concatStringsSep(",", outputNames);
|
||||
return dropEmptyInitThenConcatStringsSep(",", outputNames);
|
||||
},
|
||||
}, raw);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ std::string ValidPathInfo::fingerprint(const Store & store) const
|
|||
"1;" + store.printStorePath(path) + ";"
|
||||
+ narHash.to_string(HashFormat::Nix32, true) + ";"
|
||||
+ std::to_string(narSize) + ";"
|
||||
+ concatStringsSep(",", store.printStorePathSet(references));
|
||||
+ dropEmptyInitThenConcatStringsSep(",", store.printStorePathSet(references));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ std::string StorePathWithOutputs::to_string(const StoreDirConfig & store) const
|
|||
{
|
||||
return outputs.empty()
|
||||
? store.printStorePath(path)
|
||||
: store.printStorePath(path) + "!" + concatStringsSep(",", outputs);
|
||||
: store.printStorePath(path) + "!" + dropEmptyInitThenConcatStringsSep(",", outputs);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1208,7 +1208,7 @@ std::string StoreDirConfig::showPaths(const StorePathSet & paths)
|
|||
|
||||
std::string showPaths(const PathSet & paths)
|
||||
{
|
||||
return concatStringsSep(", ", quoteStrings(paths));
|
||||
return dropEmptyInitThenConcatStringsSep(", ", quoteStrings(paths));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace nix {
|
|||
|
||||
HookInstance::HookInstance()
|
||||
{
|
||||
debug("starting build hook '%s'", concatStringsSep(" ", settings.buildHook.get()));
|
||||
debug("starting build hook '%s'", dropEmptyInitThenConcatStringsSep(" ", settings.buildHook.get()));
|
||||
|
||||
auto buildHookArgs = settings.buildHook.get();
|
||||
|
||||
|
|
|
@ -496,10 +496,10 @@ void LocalDerivationGoal::startBuilder()
|
|||
if (!parsedDrv->canBuildLocally(worker.store))
|
||||
throw Error("a '%s' with features {%s} is required to build '%s', but I am a '%s' with features {%s}",
|
||||
drv->platform,
|
||||
concatStringsSep(", ", parsedDrv->getRequiredSystemFeatures()),
|
||||
dropEmptyInitThenConcatStringsSep(", ", parsedDrv->getRequiredSystemFeatures()),
|
||||
worker.store.printStorePath(drvPath),
|
||||
settings.thisSystem,
|
||||
concatStringsSep<StringSet>(", ", worker.store.systemFeatures));
|
||||
dropEmptyInitThenConcatStringsSep<StringSet>(", ", worker.store.systemFeatures));
|
||||
|
||||
/* Create a temporary directory where the build will take
|
||||
place. */
|
||||
|
@ -840,7 +840,7 @@ void LocalDerivationGoal::startBuilder()
|
|||
|
||||
/* Run the builder. */
|
||||
printMsg(lvlChatty, "executing builder '%1%'", drv->builder);
|
||||
printMsg(lvlChatty, "using builder args '%1%'", concatStringsSep(" ", drv->args));
|
||||
printMsg(lvlChatty, "using builder args '%1%'", dropEmptyInitThenConcatStringsSep(" ", drv->args));
|
||||
for (auto & i : drv->env)
|
||||
printMsg(lvlVomit, "setting builder env variable '%1%'='%2%'", i.first, i.second);
|
||||
|
||||
|
@ -1063,7 +1063,7 @@ void LocalDerivationGoal::startBuilder()
|
|||
e.addTrace({}, "while waiting for the build environment for '%s' to initialize (%s, previous messages: %s)",
|
||||
worker.store.printStorePath(drvPath),
|
||||
statusToString(status),
|
||||
concatStringsSep("|", msgs));
|
||||
dropEmptyInitThenConcatStringsSep("|", msgs));
|
||||
throw;
|
||||
}
|
||||
}();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue