Also, remove support in hydra-eval-jobs for multiple jobset input alternatives. The web interface hasn't supported this in a long time. Thus we can use the regular "–arg" handler.
STZE4KKRL2AGCPP2FOMBNZHJTRTKJQZSEKALWEV6FK5BII6H7EDAC
RLXDJAG2XXKG7RG5OFO5O7XIBEKCKSFCXHZWCFUI7KHL5OOGUQ6QC
3LM2JRQC4LX4QAQQRFP545Q4Q6M4NZOYUA527KLO42EWNAURXXHQC
HNGPGVBTFCEYF4YCAUTDGADAU7IXQBAAUNE6RIFUD3HXFGU5QPBAC
VU2OLHD246DFWL2WPFSKWPLXTN3WRL25TSRU4PJMJBNWDF35OFRAC
VTMBJVIS6JEZVGC3QHM45LVJDSEOSSTOXSYEBDZE3BK3SHOM2TUQC
YGRLM2SKOIPP4M24VYZTRREELKICDFKXL7ZHHR54BR5HVRCDOP6AC
SM5M2J3AGBS4IHD7TBFBVNMXTUBVA5OIFIIJJDAU6KUCPRU4S74AC
4N5APGRGHTKFMEJ7THSJX6TSYYAP3BUZQG73AJBKCQLXOOEHPATQC
A63IHCMXH3F4V56HDXJLJVVHKXRSJCJMT2PWXXI2IW3J734J6SGQC
4LWGZL33NOCTVZXUZZM5P6BRBHDUMEAJPVPNB52PN3UZVC7DMSZAC
AEFNBIIWLCTYPU6PDYG6D7OYGVP3E7DAGMYPIXVKCVVHJAM63FNAC
IMQRX4MPANNOXDP6THT2FA4576CDFY44LGNCS74BHV6DWLOCXQOQC
YNGIYQRFBKRKSRPSYSIG3R3U73ANOO5MC6C7VO4XOTDNBQHCKL3AC
KD5237CUR4X3VRUD46H3CVU22NYS7LOPF3WXENWHNSF7GKEIQZ6QC
AEKIREIHNEHL4CQEHRZJGRWMCV2XO6ICZK2OM342IKAJV6MUMDOAC
7BRTFGVYL3EF5LQWMLTKOCHLRA4PLPZDATZWWGHOSW3FN6PMFQWQC
WWEGP5ETEZAQUVNFG6RQIWEJ7TVQ7OCSYJAYLABRXZ4QYKSPBLSAC
HJYRK37ANZKUPQY3RVUZNM7TU27R3OGB42WU7Y6K7Z5JFIT64TKAC
5DYPEBSIG2F2DY44Z52YQWDL6N4G4TDUCINMFAIA3G7PTEOPSAZQC
7YCFGMZBCWDOOO3DHSJ3ZWPUWFMEO6OLQGDZWLULAPER3YZOYUJAC
HVXL2XUZTOWJPESBHBFD74B4QXNMG5SX4LOXDLPJ7732IU4SUYWQC
P45ANG5BPCZJQ7TJXNTBWHFDEDCSICMUWVWUI3DZ44TBSFXD3KEQC
SYN2GC3OYBGGITLINWUPQAZQGTDUM3Y4P4H4SOP22OA43MMWO6EQC
VTNP5KDOVQPWGRARMFJJ3MTU7IAZT4NP7ZFY4HJYT3KYJUSAZEZAC
7GKAIP3VYKM4MGGHOGBB3DR2M6B6SENBR5IZQVJYO65AWT4BW7LAC
FUB37KFUYUROEDXICXDZJTQCE6K5GOTRMSWZHIVDRPUYJR2MMO5QC
3PNG7NIBQQURUUPRVQXYL342OT7JUUYOMY2JJNP6YDX7SYJDZMYAC
DKJFD6JNNK5LJMRGQABMJZKMFZLGY3ADKJWF6J4BBHEUPY3NB67QC
FHXU6346V2UFSLCIVXTPRJUBBACOACJ7LFD432IVALTYYHEE4DEQC
MFRA2JX7CIEMPYOWWB2MKV6ZMLCWCF4BFIWKBBSVMKQG3JNJ6DBQC
N22GPKYTOLZLBGTGDATQDVZ4R5APZEAOIA7L32X4UXBH4XNI7MWAC
const AutoArgs & argsLeft, Value & v, const string & attrPath);
static void tryJobAlts(EvalState & state, JSONObject & top,
const AutoArgs & argsLeft, const string & attrPath, Value & fun,
Formals::Formals_::iterator cur,
Formals::Formals_::iterator last,
Bindings & actualArgs) // FIXME: should be const
{
if (cur == last) {
Value v, * arg = state.allocValue();
state.mkAttrs(*arg, 0);
arg->attrs = &actualArgs;
mkApp(v, fun, *arg);
findJobs(state, top, argsLeft, v, attrPath);
return;
}
AutoArgs::const_iterator a = argsLeft.find(cur->name);
Bindings & autoArgs, Value & v, const string & attrPath);
if (a == argsLeft.end()) {
if (!cur->def)
throw TypeError(format("job `%1%' requires an argument named `%2%'")
% attrPath % cur->name);
tryJobAlts(state, top, argsLeft, attrPath, fun, next, last, actualArgs);
return;
}
int n = 0;
for (auto & i : a->second) {
Bindings & actualArgs2(*state.allocBindings(actualArgs.size() + 1)); // !!! inefficient
for (auto & j : actualArgs)
actualArgs2.push_back(j);
AutoArgs argsLeft2(argsLeft);
actualArgs2.push_back(Attr(cur->name, i));
actualArgs2.sort(); // !!! inefficient
argsLeft2.erase(cur->name);
tryJobAlts(state, top, argsLeft2, attrPath, fun, next, last, actualArgs2);
++n;
}
}
else if (v.type == tLambda && v.lambda.fun->matchAttrs) {
Bindings & tmp(*state.allocBindings(0));
tryJobAlts(state, top, argsLeft, attrPath, v,
v.lambda.fun->formals->formals.begin(),
v.lambda.fun->formals->formals.end(),
tmp);
}
parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) {
if (*arg == "--arg" || *arg == "--argstr") {
/* This is like --arg in nix-instantiate, except that it
supports multiple versions for the same argument.
That is, autoArgs is a mapping from variable names to
*lists* of values. */
auto what = *arg;
string name = getArg(what, arg, end);
string value = getArg(what, arg, end);
autoArgs_[name].push_back((what == "--arg" ? 'E' : 'S') + value);
}
else if (parseSearchPathArg(arg, end, searchPath))
;
else if (*arg == "--gc-roots-dir")
struct MyArgs : LegacyArgs, MixEvalArgs
{
using LegacyArgs::LegacyArgs;
};
MyArgs myArgs(baseNameOf(argv[0]), [&](Strings::iterator & arg, const Strings::iterator & end) {
if (*arg == "--gc-roots-dir")
AutoArgs autoArgs;
Value * inputsSet = state.allocValue();
state.mkAttrs(*inputsSet, autoArgs_.size());
for (auto & i : autoArgs_) {
Symbol inputName = state.symbols.create(i.first);
bool first = true;
for (auto & j : i.second) {
Value * v = state.allocValue();
if (j[0] == 'E')
state.eval(state.parseExprFromString(string(j, 1), absPath(".")), *v);
else
mkString(*v, string(j, 1));
autoArgs[inputName].push_back(v);
if (first) {
inputsSet->attrs->push_back(Attr(inputName, v));
first = false;
}
}
}
Symbol sInputs = state.symbols.create("inputs");
if (autoArgs.find(sInputs) == autoArgs.end()) {
inputsSet->attrs->sort();
autoArgs[sInputs].push_back(inputsSet);
}
Bindings & autoArgs = *myArgs.getAutoArgs(state);
foreach my $alt (@{$inputInfo->{$input}}) {
if ($alt->{type} eq "string") {
push @res, "--argstr", $input, $alt->{value};
}
elsif ($alt->{type} eq "boolean") {
push @res, "--arg", $input, booleanToString($exprType, $alt->{value});
}
elsif ($alt->{type} eq "nix") {
die "input type ‘nix’ only supported for Nix-based jobsets\n" unless $exprType eq "nix";
push @res, "--arg", $input, $alt->{value};
}
elsif ($alt->{type} eq "eval") {
die "input type ‘eval’ only supported for Nix-based jobsets\n" unless $exprType eq "nix";
my $s = "{ ";
# FIXME: escape $_. But dots should not be escaped.
$s .= "$_ = builtins.storePath ${\$alt->{jobs}->{$_}}; "
foreach keys %{$alt->{jobs}};
$s .= "}";
push @res, "--arg", $input, $s;
}
else {
push @res, "--arg", $input, buildInputToString($exprType, $alt);
}
die "multiple jobset input alternatives are no longer supported"
if scalar @{$inputInfo->{$input}} != 1;
my $alt = $inputInfo->{$input}->[0];
if ($alt->{type} eq "string") {
push @res, "--argstr", $input, $alt->{value};
elsif ($alt->{type} eq "boolean") {
push @res, "--arg", $input, booleanToString($exprType, $alt->{value});
}
elsif ($alt->{type} eq "nix") {
die "input type ‘nix’ only supported for Nix-based jobsets\n" unless $exprType eq "nix";
push @res, "--arg", $input, $alt->{value};
}
elsif ($alt->{type} eq "eval") {
die "input type ‘eval’ only supported for Nix-based jobsets\n" unless $exprType eq "nix";
my $s = "{ ";
# FIXME: escape $_. But dots should not be escaped.
$s .= "$_ = builtins.storePath ${\$alt->{jobs}->{$_}}; "
foreach keys %{$alt->{jobs}};
$s .= "}";
push @res, "--arg", $input, $s;
}
else {
push @res, "--arg", $input, buildInputToString($exprType, $alt);
}