mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
dropEmptyInitThenConcatStringsSep -> concatStringSep: diagnostics and docs
These are non-critical, so their behavior is ok to change. Dropping empty items is not needed and usually not expected.
This commit is contained in:
parent
a681d354e7
commit
ea966a70fc
9 changed files with 28 additions and 16 deletions
|
@ -16,6 +16,7 @@
|
||||||
#include "serialise.hh"
|
#include "serialise.hh"
|
||||||
#include "build-result.hh"
|
#include "build-result.hh"
|
||||||
#include "store-api.hh"
|
#include "store-api.hh"
|
||||||
|
#include "strings.hh"
|
||||||
#include "derivations.hh"
|
#include "derivations.hh"
|
||||||
#include "local-store.hh"
|
#include "local-store.hh"
|
||||||
#include "legacy.hh"
|
#include "legacy.hh"
|
||||||
|
@ -206,15 +207,15 @@ static int main_build_remote(int argc, char * * argv)
|
||||||
error
|
error
|
||||||
% drvstr
|
% drvstr
|
||||||
% neededSystem
|
% neededSystem
|
||||||
% dropEmptyInitThenConcatStringsSep<StringSet>(", ", requiredFeatures)
|
% concatStringsSep<StringSet>(", ", requiredFeatures)
|
||||||
% machines.size();
|
% machines.size();
|
||||||
|
|
||||||
for (auto & m : machines)
|
for (auto & m : machines)
|
||||||
error
|
error
|
||||||
% dropEmptyInitThenConcatStringsSep<StringSet>(", ", m.systemTypes)
|
% concatStringsSep<StringSet>(", ", m.systemTypes)
|
||||||
% m.maxJobs
|
% m.maxJobs
|
||||||
% dropEmptyInitThenConcatStringsSep<StringSet>(", ", m.supportedFeatures)
|
% concatStringsSep<StringSet>(", ", m.supportedFeatures)
|
||||||
% dropEmptyInitThenConcatStringsSep<StringSet>(", ", m.mandatoryFeatures);
|
% concatStringsSep<StringSet>(", ", m.mandatoryFeatures);
|
||||||
|
|
||||||
printMsg(couldBuildLocally ? lvlChatty : lvlWarn, error.str());
|
printMsg(couldBuildLocally ? lvlChatty : lvlWarn, error.str());
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
#include "command.hh"
|
#include "command.hh"
|
||||||
#include "markdown.hh"
|
#include "markdown.hh"
|
||||||
#include "store-api.hh"
|
#include "store-api.hh"
|
||||||
|
@ -6,8 +8,7 @@
|
||||||
#include "nixexpr.hh"
|
#include "nixexpr.hh"
|
||||||
#include "profiles.hh"
|
#include "profiles.hh"
|
||||||
#include "repl.hh"
|
#include "repl.hh"
|
||||||
|
#include "strings.hh"
|
||||||
#include <nlohmann/json.hpp>
|
|
||||||
|
|
||||||
extern char * * environ __attribute__((weak));
|
extern char * * environ __attribute__((weak));
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ void NixMultiCommand::run()
|
||||||
for (auto & [name, _] : commands)
|
for (auto & [name, _] : commands)
|
||||||
subCommandTextLines.insert(fmt("- `%s`", name));
|
subCommandTextLines.insert(fmt("- `%s`", name));
|
||||||
std::string markdownError = fmt("`nix %s` requires a sub-command. Available sub-commands:\n\n%s\n",
|
std::string markdownError = fmt("`nix %s` requires a sub-command. Available sub-commands:\n\n%s\n",
|
||||||
commandName, dropEmptyInitThenConcatStringsSep("\n", subCommandTextLines));
|
commandName, concatStringsSep("\n", subCommandTextLines));
|
||||||
throw UsageError(renderMarkdownToTerminal(markdownError));
|
throw UsageError(renderMarkdownToTerminal(markdownError));
|
||||||
}
|
}
|
||||||
command->second->run();
|
command->second->run();
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
#include "strings-inline.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
void completeFlakeInputPath(
|
void completeFlakeInputPath(
|
||||||
|
@ -630,7 +632,7 @@ static void throwBuildErrors(
|
||||||
}
|
}
|
||||||
failedPaths.insert(failedResult->path.to_string(store));
|
failedPaths.insert(failedResult->path.to_string(store));
|
||||||
}
|
}
|
||||||
throw Error("build of %s failed", dropEmptyInitThenConcatStringsSep(", ", quoteStrings(failedPaths)));
|
throw Error("build of %s failed", concatStringsSep(", ", quoteStrings(failedPaths)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include <gc/gc_cpp.h>
|
#include <gc/gc_cpp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "strings.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -625,7 +627,7 @@ ProcessLineResult NixRepl::processLine(std::string line)
|
||||||
|
|
||||||
markdown +=
|
markdown +=
|
||||||
"**Synopsis:** `builtins." + (std::string) (*doc->name) + "` "
|
"**Synopsis:** `builtins." + (std::string) (*doc->name) + "` "
|
||||||
+ dropEmptyInitThenConcatStringsSep(" ", args) + "\n\n";
|
+ concatStringsSep(" ", args) + "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
markdown += stripIndentation(doc->doc);
|
markdown += stripIndentation(doc->doc);
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
#include "strings.hh"
|
||||||
|
|
||||||
namespace nix::flake {
|
namespace nix::flake {
|
||||||
|
|
||||||
static FlakeRef getFlakeRef(
|
static FlakeRef getFlakeRef(
|
||||||
|
@ -61,7 +63,7 @@ static std::shared_ptr<Node> doFind(const ref<Node>& root, const InputPath & pat
|
||||||
std::vector<std::string> cycle;
|
std::vector<std::string> cycle;
|
||||||
std::transform(found, visited.cend(), std::back_inserter(cycle), printInputPath);
|
std::transform(found, visited.cend(), std::back_inserter(cycle), printInputPath);
|
||||||
cycle.push_back(printInputPath(path));
|
cycle.push_back(printInputPath(path));
|
||||||
throw Error("follow cycle detected: [%s]", dropEmptyInitThenConcatStringsSep(" -> ", cycle));
|
throw Error("follow cycle detected: [%s]", concatStringsSep(" -> ", cycle));
|
||||||
}
|
}
|
||||||
visited.push_back(path);
|
visited.push_back(path);
|
||||||
|
|
||||||
|
@ -367,7 +369,7 @@ void check();
|
||||||
|
|
||||||
std::string printInputPath(const InputPath & path)
|
std::string printInputPath(const InputPath & path)
|
||||||
{
|
{
|
||||||
return dropEmptyInitThenConcatStringsSep("/", path);
|
return concatStringsSep("/", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
|
|
||||||
#include "exit.hh"
|
#include "exit.hh"
|
||||||
|
#include "strings.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
@ -301,11 +302,11 @@ void printVersion(const std::string & programName)
|
||||||
#endif
|
#endif
|
||||||
cfg.push_back("signed-caches");
|
cfg.push_back("signed-caches");
|
||||||
std::cout << "System type: " << settings.thisSystem << "\n";
|
std::cout << "System type: " << settings.thisSystem << "\n";
|
||||||
std::cout << "Additional system types: " << dropEmptyInitThenConcatStringsSep(", ", settings.extraPlatforms.get()) << "\n";
|
std::cout << "Additional system types: " << concatStringsSep(", ", settings.extraPlatforms.get()) << "\n";
|
||||||
std::cout << "Features: " << dropEmptyInitThenConcatStringsSep(", ", cfg) << "\n";
|
std::cout << "Features: " << concatStringsSep(", ", cfg) << "\n";
|
||||||
std::cout << "System configuration file: " << settings.nixConfDir + "/nix.conf" << "\n";
|
std::cout << "System configuration file: " << settings.nixConfDir + "/nix.conf" << "\n";
|
||||||
std::cout << "User configuration files: " <<
|
std::cout << "User configuration files: " <<
|
||||||
dropEmptyInitThenConcatStringsSep(":", settings.nixUserConfFiles)
|
concatStringsSep(":", settings.nixUserConfFiles)
|
||||||
<< "\n";
|
<< "\n";
|
||||||
std::cout << "Store directory: " << settings.nixStore << "\n";
|
std::cout << "Store directory: " << settings.nixStore << "\n";
|
||||||
std::cout << "State directory: " << settings.nixStateDir << "\n";
|
std::cout << "State directory: " << settings.nixStateDir << "\n";
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
# include "derivation-goal.hh"
|
# include "derivation-goal.hh"
|
||||||
#endif
|
#endif
|
||||||
#include "local-store.hh"
|
#include "local-store.hh"
|
||||||
|
#include "strings.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ void Store::buildPaths(const std::vector<DerivedPath> & reqs, BuildMode buildMod
|
||||||
throw std::move(*ex);
|
throw std::move(*ex);
|
||||||
} else if (!failed.empty()) {
|
} else if (!failed.empty()) {
|
||||||
if (ex) logError(ex->info());
|
if (ex) logError(ex->info());
|
||||||
throw Error(worker.failingExitStatus(), "build of %s failed", dropEmptyInitThenConcatStringsSep(", ", quoteStrings(failed)));
|
throw Error(worker.failingExitStatus(), "build of %s failed", concatStringsSep(", ", quoteStrings(failed)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "callback.hh"
|
#include "callback.hh"
|
||||||
#include "closure.hh"
|
#include "closure.hh"
|
||||||
#include "filetransfer.hh"
|
#include "filetransfer.hh"
|
||||||
|
#include "strings.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,13 @@
|
||||||
#include "hook-instance.hh"
|
#include "hook-instance.hh"
|
||||||
#include "file-system.hh"
|
#include "file-system.hh"
|
||||||
#include "child.hh"
|
#include "child.hh"
|
||||||
|
#include "strings.hh"
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
HookInstance::HookInstance()
|
HookInstance::HookInstance()
|
||||||
{
|
{
|
||||||
debug("starting build hook '%s'", dropEmptyInitThenConcatStringsSep(" ", settings.buildHook.get()));
|
debug("starting build hook '%s'", concatStringsSep(" ", settings.buildHook.get()));
|
||||||
|
|
||||||
auto buildHookArgs = settings.buildHook.get();
|
auto buildHookArgs = settings.buildHook.get();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue