forked from lix-project/lix
Fix tests on systems with a non-master git defaultBranch #1
|
@ -269,11 +269,31 @@ Path Settings::getDefaultSSLCertFile()
|
||||||
|
|
||||||
const std::string nixVersion = PACKAGE_VERSION;
|
const std::string nixVersion = PACKAGE_VERSION;
|
||||||
|
|
||||||
NLOHMANN_JSON_SERIALIZE_ENUM(SandboxMode, {
|
void to_json(nlohmann::json & j, const SandboxMode & e)
|
||||||
{SandboxMode::smEnabled, true},
|
{
|
||||||
{SandboxMode::smRelaxed, "relaxed"},
|
if (e == SandboxMode::smEnabled) {
|
||||||
{SandboxMode::smDisabled, false},
|
j = true;
|
||||||
});
|
} else if (e == SandboxMode::smRelaxed) {
|
||||||
|
j = "relaxed";
|
||||||
|
} else if (e == SandboxMode::smDisabled) {
|
||||||
|
j = false;
|
||||||
|
} else {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_json(const nlohmann::json & j, SandboxMode & e)
|
||||||
|
{
|
||||||
|
if (j == true) {
|
||||||
|
e = SandboxMode::smEnabled;
|
||||||
|
} else if (j == "relaxed") {
|
||||||
|
e = SandboxMode::smRelaxed;
|
||||||
|
} else if (j == false) {
|
||||||
|
e = SandboxMode::smDisabled;
|
||||||
|
} else {
|
||||||
|
throw Error("Invalid sandbox mode '%s'", std::string(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<> SandboxMode BaseSetting<SandboxMode>::parse(const std::string & str, const ApplyConfigOptions & options) const
|
template<> SandboxMode BaseSetting<SandboxMode>::parse(const std::string & str, const ApplyConfigOptions & options) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,9 @@ namespace nix {
|
||||||
|
|
||||||
typedef enum { smEnabled, smRelaxed, smDisabled } SandboxMode;
|
typedef enum { smEnabled, smRelaxed, smDisabled } SandboxMode;
|
||||||
|
|
||||||
|
void to_json(nlohmann::json & j, const SandboxMode & e);
|
||||||
|
void from_json(const nlohmann::json & j, SandboxMode & e);
|
||||||
|
|
||||||
struct MaxBuildJobsSetting : public BaseSetting<unsigned int>
|
struct MaxBuildJobsSetting : public BaseSetting<unsigned int>
|
||||||
{
|
{
|
||||||
MaxBuildJobsSetting(Config * options,
|
MaxBuildJobsSetting(Config * options,
|
||||||
|
|
Loading…
Reference in a new issue