Fix build against Nix master

[?]
Oct 26, 2017, 11:10 AM
STZE4KKRL2AGCPP2FOMBNZHJTRTKJQZSEKALWEV6FK5BII6H7EDAC

Dependencies

  • [2] RLXDJAG2 hydra-eval-jobs: Add --dry-run option
  • [3] 3LM2JRQC Whoops, misread signature
  • [4] HNGPGVBT Fix build
  • [5] VU2OLHD2 Move most of AddBuilds to hydra-eval-jobset
  • [6] VTMBJVIS hydra-eval-jobs: Disable the build hook.
  • [7] MIC2O6ZF Use evalFile() instead of parseExprFromFile()
  • [8] KD5237CU * eval-jobs now efficiently evaluates all Hydra jobs from a
  • [9] 5X6FHW3S hydra-eval-jobs: Fix building against the latest unstable Nix
  • [10] FHXU6346 hydra-eval-jobs: Pass all inputs as 'inputs' arg.
  • [11] GPZYBCJC accidentally committed an = too little, which caused all unknown values to result in 'not building', which was not the intention
  • [12] IMQRX4MP hydra-eval-jobs: Use JSON instead of XML
  • [13] IZ2AHLM3 * Export all relevant info about the derivation.
  • [14] VTNP5KDO * Don't catch all errors. Some errors mess up the connection with the
  • [15] HJYRK37A * Revert r27114, it seems to break stuff.
  • [16] 7GKAIP3V Fix build and handling of string inputs starting with a dash
  • [17] P45ANG5B Fix build
  • [18] HOVPJBFF * Require every argument to be specified.
  • [19] 4N5APGRG * Start of a helper tool to evaluate job expressions efficiently.
  • [20] 7YCFGMZB * Report evaluation errors per job, and don't bail out if a job fails
  • [21] 52JSLNC6 * Build fix.
  • [22] WWEGP5ET * Use default values of job function arguments if they're not
  • [23] SYN2GC3O allow null values for jobs, meaning it should build
  • [24] EBG4P4SY Doh - clear $NIX_PATH properly
  • [25] WVD3YYON hydra-evaluator: Add some debug code
  • [26] YNGIYQRF hydra-eval-jobs: Don't keep track of used inputs
  • [27] FUB37KFU Use Nix's restricted evaluation mode
  • [28] MFRA2JX7 Only pass the first value of each input in the inputs argument
  • [29] 5MVWRWHT hydra-evaluator: Don't use the "timeout" command
  • [30] 77VF5TC6 * For ease of use during debugging, don't require --gc-roots-dir.
  • [31] YGRLM2SK * Export all relevant info about the derivation.
  • [32] RFE6T5LG * Store jobset evaluations in the database explicitly. This includes
  • [33] SM5M2J3A Pass inputs to release expressions using -I
  • [34] L4GM4MA6 Call initGC()
  • [35] 5DYPEBSI hydra-eval-jobs: Use function argument default values
  • [36] HVXL2XUZ
  • [37] DKJFD6JN Process Nix API changes
  • [38] 4XR2A7QD * Fix building hydra_eval_jobs against the sqlite branch.
  • [39] 4LWGZL33
  • [40] AEFNBIIW * Merge the GC branch.
  • [41] A63IHCMX * Register GC roots properly.
  • [42] 4GTOWRFW hydra-eval-jobs: Fix build
  • [43] AEKIREIH * Updated hydra_eval_jobs for the new evaluator.
  • [44] 3PNG7NIB Remove trailing whitespace
  • [45] FMJMW4PU
  • [46] FGUL3HAZ hydra-eval-jobs: Don't go into an infinite recursion
  • [47] 7BRTFGVY Really fix hydra-eval-jobs
  • [*] N22GPKYT * Put info about logs / build products in the DB.

Change contents

  • edit in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 13
    [7.23][7.0:26]()
    #include "common-opts.hh"
  • edit in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 14
    [2.22]
    [7.451]
    #include "common-eval-args.hh"
  • edit in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 20
    [7.26][7.74:75](),[7.74][7.74:75](),[7.75][7.27:28](),[7.420][7.420:535]()
    typedef std::list<Value *, traceable_allocator<Value *> > ValueList;
    typedef std::map<Symbol, ValueList> AutoArgs;
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 23
    [7.87][7.0:68](),[7.218][7.0:68](),[7.68][7.96:98](),[7.217][7.96:98](),[7.96][7.96:98](),[7.98][7.88:148](),[7.148][7.69:138](),[7.157][7.69:138](),[7.138][7.318:393](),[7.318][7.318:393](),[7.393][7.0:53](),[7.53][7.306:308](),[7.426][7.306:308](),[7.306][7.306:308](),[7.308][7.427:450](),[7.450][7.536:613](),[7.613][7.54:88](),[7.88][7.647:676](),[7.647][7.647:676](),[7.676][7.149:202](),[7.192][7.448:470](),[7.202][7.448:470](),[7.624][7.448:470](),[7.448][7.448:470](),[7.53][7.470:471](),[7.470][7.470:471](),[7.471][7.625:684]()
    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);
    [7.87]
    [7.143]
    Bindings & autoArgs, Value & v, const string & attrPath);
  • edit in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 25
    [7.144][7.144:196]()
    Formals::Formals_::iterator next = cur; ++next;
  • edit in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 26
    [7.1][7.1:177](),[7.177][7.203:284](),[7.274][7.268:290](),[7.284][7.268:290](),[7.268][7.268:290](),[7.196][7.805:821](),[7.290][7.805:821](),[7.343][7.805:821](),[7.805][7.805:821](),[7.821][4.0:33](),[4.33][7.89:185](),[7.733][7.89:185](),[7.185][4.34:108](),[4.108][7.979:1017](),[7.979][7.979:1017](),[7.1017][4.109:160](),[4.160][7.786:833](),[7.786][7.786:833](),[7.905][7.1130:1166](),[7.1130][7.1130:1166](),[7.1166][7.285:368](),[7.358][7.1260:1273](),[7.368][7.1260:1273](),[7.1260][7.1260:1273](),[7.306][7.211:221]()
    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;
    }
    }
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 53
    [7.434][7.359:426](),[7.377][7.359:426]()
    const AutoArgs & argsLeft, Value & v, const string & attrPath)
    [7.434]
    [7.255]
    Bindings & autoArgs, Value & vIn, const string & attrPath)
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 59
    [7.980][7.1674:1699](),[7.308][7.1674:1699]()
    state.forceValue(v);
    [7.980]
    [7.336]
    Value v;
    state.autoCallFunction(autoArgs, vIn, v);
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 124
    [4.544][4.544:605]()
    findJobs(state, top, argsLeft, *i.value,
    [4.544]
    [4.605]
    findJobs(state, top, autoArgs, *i.value,
  • edit in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 130
    [7.1419][7.1986:2048](),[7.2048][7.0:49](),[7.49][7.1552:1606](),[7.544][7.2112:2214](),[7.1606][7.2112:2214](),[7.2112][7.2112:2214](),[7.2214][7.50:68](),[7.68][7.0:7](),[7.2239][7.0:7]()
    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);
    }
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 140
    [7.1665][7.545:612](),[7.551][7.545:612]()
    const AutoArgs & argsLeft, Value & v, const string & attrPath)
    [7.1665]
    [7.646]
    Bindings & autoArgs, Value & v, const string & attrPath)
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 143
    [7.658][7.1666:1726]()
    findJobsWrapped(state, top, argsLeft, v, attrPath);
    [7.658]
    [7.0]
    findJobsWrapped(state, top, autoArgs, v, attrPath);
  • edit in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 163
    [7.28][7.100:128]()
    Strings searchPath;
  • edit in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 164
    [7.154][7.154:199]()
    std::map<string, Strings> autoArgs_;
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 165
    [7.200][7.200:975]()
    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")
    [7.200]
    [7.975]
    struct MyArgs : LegacyArgs, MixEvalArgs
    {
    using LegacyArgs::LegacyArgs;
    };
    MyArgs myArgs(baseNameOf(argv[0]), [&](Strings::iterator & arg, const Strings::iterator & end) {
    if (*arg == "--gc-roots-dir")
  • edit in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 181
    [7.1195]
    [7.0]
    myArgs.parseCmdline(argvToStrings(argc, argv));
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 185
    [6.119][6.119:158]()
    settings.useBuildHook = false;
    [6.119]
    [6.158]
    settings.builders = "";
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 189
    [7.105][7.105:152]()
    settings.set("restrict-eval", "true");
    [7.105]
    [7.854]
    settings.restrictEval = true;
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 195
    [7.811][7.88:138]()
    EvalState state(searchPath, openStore());
    [7.811]
    [7.880]
    EvalState state(myArgs.searchPath, openStore());
  • replacement in src/hydra-eval-jobs/hydra-eval-jobs.cc at line 197
    [7.881][7.1405:1432](),[7.1432][7.0:101](),[7.101][7.1432:1469](),[7.1432][7.1432:1469](),[7.1469][7.102:164](),[7.164][7.0:31](),[7.31][7.1469:1750](),[7.321][7.1469:1750](),[7.1469][7.1469:1750](),[7.1750][7.322:372](),[7.372][7.32:61](),[7.61][3.0:69](),[3.69][7.131:184](),[7.131][7.131:184](),[7.184][7.1820:1844](),[7.427][7.1820:1844](),[7.1820][7.1820:1844](),[7.1844][7.428:641]()
    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);
    }
    [7.881]
    [7.1624]
    Bindings & autoArgs = *myArgs.getAutoArgs(state);
  • replacement in src/script/hydra-eval-jobset at line 306
    [5.9894][5.9894:11021]()
    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);
    }
    [5.9894]
    [5.11021]
    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};
  • edit in src/script/hydra-eval-jobset at line 315
    [5.11031]
    [5.11031]
    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);
    }