Improve parsing of hydra-build-products

[?]
Jun 19, 2015, 3:20 PM
YHP5DSOOKAXAYHUDMYO6EKX2YAN7DLDQPJX5K52TCP7EXQVP6JAAC

Dependencies

  • [2] 24BMQDZA Start of single-process hydra-queue-runner
  • [3] WHULPA6S Handle failure with output
  • [4] GS4BE6TB Asynchronously compress build logs

Change contents

  • edit in src/hydra-queue-runner/build-result.cc at line 5
    [2.531]
    [2.531]
    #include "regex.hh"
  • edit in src/hydra-queue-runner/build-result.cc at line 30
    [2.1146]
    [2.1146]
    Regex regex(
    "(([a-zA-Z0-9_-]+)" // type (e.g. "doc")
    "[[:space:]]+"
    "([a-zA-Z0-9_-]+)" // subtype (e.g. "readme")
    "[[:space:]]+"
    "(\"[^\"]+\"|[^[:space:]\"]+))" // path (may be quoted)
    "([[:space:]]+([^[:space:]]+))?" // entry point
    , true);
  • replacement in src/hydra-queue-runner/build-result.cc at line 48
    [2.1385][2.1385:1439]()
    productsFile = canonPath(productsFile, true);
    [2.1385]
    [2.1439]
    try {
    productsFile = canonPath(productsFile, true);
    } catch (Error & e) { continue; }
  • replacement in src/hydra-queue-runner/build-result.cc at line 53
    [2.1488][2.1488:1524]()
    // FIXME: handle I/O errors
    [2.1488]
    [2.1524]
    string contents;
    try {
    contents = readFile(productsFile);
    } catch (Error & e) { continue; }
  • replacement in src/hydra-queue-runner/build-result.cc at line 58
    [2.1525][2.1525:1635]()
    auto contents = readFile(productsFile);
    auto lines = tokenizeString<Strings>(contents, "\n");
    [2.1525]
    [2.1635]
    for (auto & line : tokenizeString<Strings>(contents, "\n")) {
    BuildProduct product;
  • replacement in src/hydra-queue-runner/build-result.cc at line 61
    [2.1636][2.1636:1706]()
    for (auto & line : lines) {
    BuildProduct product;
    [2.1636]
    [2.1706]
    Regex::Subs subs;
    if (!regex.matches(line, subs)) continue;
  • replacement in src/hydra-queue-runner/build-result.cc at line 64
    [2.1707][2.1707:2221]()
    auto words = tokenizeString<Strings>(line);
    if (words.size() < 3) continue;
    product.type = words.front(); words.pop_front();
    product.subtype = words.front(); words.pop_front();
    if (string(words.front(), 0, 1) == "\"") {
    // FIXME:
    throw Error("FIXME");
    } else {
    product.path = words.front(); words.pop_front();
    }
    product.defaultPath = words.empty() ? "" : words.front();
    [2.1707]
    [2.2221]
    product.type = subs[1];
    product.subtype = subs[2];
    product.path = subs[3][0] == '"' ? string(subs[3], 1, subs[3].size() - 2) : subs[3];
    product.defaultPath = subs[5];
  • replacement in src/hydra-queue-runner/build-result.cc at line 72
    [2.2388][2.2388:2446]()
    product.path = canonPath(product.path, true);
    [2.2388]
    [2.2446]
    try {
    product.path = canonPath(product.path, true);
    } catch (Error & e) { continue; }
  • replacement in src/hydra-queue-runner/build-result.cc at line 119
    [2.4142][2.4142:4222]()
    // FIXME: handle I/O error
    res.releaseName = trim(readFile(p));
    [2.4142]
    [2.4222]
    try {
    res.releaseName = trim(readFile(p));
    } catch (Error & e) { continue; }