hydra: if evaluator sees cached build, also add the buildproducts

[?]
Sep 7, 2010, 11:29 AM
FM4O2L4MNPCHWRDRHKGKSH5TFFX6R2RMCPEQ3XCECA6UVLJPLUVQC

Dependencies

  • [2] TPDJL4TY * Add derivations and all build-time dependencies of a build to the
  • [3] A22P7HCO hydra: at evaluation, check if path is already built, and mark as built in stead of adding to the queue.
  • [4] 7YBYT2LQ
  • [5] BD3GRK4B * Get rid of "positive failures" and separate log phases.
  • [6] KOTB7BKV
  • [7] SJN2QPWH * Big speed-up of the job status page and the channel generation (such
  • [8] MOCEUXZA * Support serving products that are directories (such as manuals or
  • [9] L2E6EVE2 * Merged the Build and Job tables.
  • [10] AKAZKCR6 * At top-level and for each project, provide two channels: "latest"
  • [11] EJSBLCLT * Dying considered harmful.
  • [12] D3DIBMOK * For products that are directories (like manuals), allow a default
  • [13] BHZXGT2H * Channels: provide an index page that lists all the packages in the
  • [14] 7UJ5YV4V * Provide a channel for each project containing all the latest
  • [15] ECBA3GQO * Make the schema class names match the case of the SQL table names.
  • [16] CLJQCY2X * Store info about all the build actions and allow them to be
  • [17] WHAFVCEI
  • [18] B72GLND4
  • [*] OOQ2D3KC * Refactoring: move fetchInput out of hydra_scheduler into a separate
  • [*] 3XTHEUMP * Implemented the clone feature.
  • [*] LBNVQXUB * Build the /build stuff in a separate controller.

Change contents

  • edit in src/lib/Hydra/Helper/AddBuilds.pm at line 588
    [21.3430]
    [21.3430]
    sub addBuildProducts {
    my ($db, $build) = @_;
    my $outPath = $build->outpath;
    my $productnr = 1;
    if (-e "$outPath/nix-support/hydra-build-products") {
    open LIST, "$outPath/nix-support/hydra-build-products" or die;
    while (<LIST>) {
    /^([\w\-]+)\s+([\w\-]+)\s+(\S+)(\s+(\S+))?$/ or next;
    my $type = $1;
    my $subtype = $2 eq "none" ? "" : $2;
    my $path = $3;
    my $defaultPath = $5;
    next unless -e $path;
    my $fileSize, my $sha1, my $sha256;
    # !!! validate $path, $defaultPath
  • edit in src/lib/Hydra/Helper/AddBuilds.pm at line 609
    [21.3431]
    [21.3431]
    if (-f $path) {
    my $st = stat($path) or die "cannot stat $path: $!";
    $fileSize = $st->size;
    $sha1 = `nix-hash --flat --type sha1 $path`
    or die "cannot hash $path: $?";;
    chomp $sha1;
    $sha256 = `nix-hash --flat --type sha256 $path`
    or die "cannot hash $path: $?";;
    chomp $sha256;
    }
  • edit in src/lib/Hydra/Helper/AddBuilds.pm at line 622
    [21.3432]
    [21.3432]
    my $name = $path eq $outPath ? "" : basename $path;
    $db->resultset('BuildProducts')->create(
    { build => $build->id
    , productnr => $productnr++
    , type => $type
    , subtype => $subtype
    , path => $path
    , filesize => $fileSize
    , sha1hash => $sha1
    , sha256hash => $sha256
    , name => $name
    , defaultpath => $defaultPath
    });
    }
    close LIST;
    }
    else {
    $db->resultset('BuildProducts')->create(
    { build => $build->id
    , productnr => $productnr++
    , type => "nix-build"
    , subtype => ""
    , path => $outPath
    , name => $build->nixname
    });
    }
    }
  • edit in src/lib/Hydra/Helper/AddBuilds.pm at line 731
    [3.987]
    [3.987]
    addBuildProducts($build);
  • replacement in src/lib/Hydra/Helper/CatalystUtils.pm at line 120
    [4.2194][4.941:991](),[4.941][4.941:991](),[4.991][2.50:94]()
    next unless isValidPath($build->outpath);
    if (isValidPath($build->drvpath)) {
    [4.2194]
    [2.94]
    next unless Hydra::Helper::Nix::isValidPath($build->outpath);
    if (Hydra::Helper::Nix::isValidPath($build->drvpath)) {
  • replacement in src/script/hydra_build.pl at line 386
    [4.4577][4.5155:5156](),[4.5155][4.5155:5156](),[4.3734][4.3734:3765](),[4.5639][4.5639:5818](),[4.5818][4.3316:3390](),[4.2753][4.5875:5910](),[4.3390][4.5875:5910](),[4.5875][4.5875:5910](),[4.5910][4.2754:2812](),[4.2812][4.5948:5983](),[4.5948][4.5948:5983](),[4.5983][4.3391:3433](),[4.3433][4.0:42](),[4.5983][4.0:42](),[4.42][4.3766:3767](),[4.6024][4.3766:3767](),[4.3767][4.1176:1232](),[4.1232][4.3840:3841](),[4.3840][4.3840:3841](),[4.3841][4.3434:3490](),[4.3490][4.1233:1346](),[4.3841][4.1233:1346](),[4.1346][4.2813:2860](),[4.2860][4.1387:1578](),[4.1387][4.1387:1578](),[4.1578][4.3998:4019](),[4.3998][4.3998:4019](),[4.4019][4.1579:1773](),[4.1773][4.3491:3564](),[4.1773][4.4182:4203](),[4.3564][4.4182:4203](),[4.4182][4.4182:4203](),[4.4203][4.4983:5044](),[4.5044][4.6085:6131](),[4.6085][4.6085:6131](),[4.6131][4.4204:4256](),[4.4256][4.6131:6257](),[4.6131][4.6131:6257](),[4.6257][4.1774:1822](),[4.1822][4.4305:4397](),[4.4305][4.4305:4397](),[4.4397][4.3565:3659](),[4.3659][4.6257:6331](),[4.4446][4.6257:6331](),[4.6257][4.6257:6331](),[4.6331][4.4447:4462](),[4.4462][4.4578:4597](),[4.4597][4.5045:5102](),[4.5102][4.6409:6451](),[4.6409][4.6409:6451](),[4.6451][4.4503:4551](),[4.4551][4.6451:6568](),[4.6451][4.6451:6568](),[4.6568][4.2861:2907](),[4.2907][4.6568:6606](),[4.6568][4.6568:6606]()
    my $productnr = 1;
    if (-e "$outPath/nix-support/hydra-build-products") {
    open LIST, "$outPath/nix-support/hydra-build-products" or die;
    while (<LIST>) {
    /^([\w\-]+)\s+([\w\-]+)\s+(\S+)(\s+(\S+))?$/ or next;
    my $type = $1;
    my $subtype = $2 eq "none" ? "" : $2;
    my $path = $3;
    my $defaultPath = $5;
    next unless -e $path;
    my $fileSize, my $sha1, my $sha256;
    # !!! validate $path, $defaultPath
    if (-f $path) {
    my $st = stat($path) or die "cannot stat $path: $!";
    $fileSize = $st->size;
    $sha1 = `nix-hash --flat --type sha1 $path`
    or die "cannot hash $path: $?";;
    chomp $sha1;
    $sha256 = `nix-hash --flat --type sha256 $path`
    or die "cannot hash $path: $?";;
    chomp $sha256;
    }
    my $name = $path eq $outPath ? "" : basename $path;
    $db->resultset('BuildProducts')->create(
    { build => $build->id
    , productnr => $productnr++
    , type => $type
    , subtype => $subtype
    , path => $path
    , filesize => $fileSize
    , sha1hash => $sha1
    , sha256hash => $sha256
    , name => $name
    , defaultpath => $defaultPath
    });
    }
    close LIST;
    }
    else {
    $db->resultset('BuildProducts')->create(
    { build => $build->id
    , productnr => $productnr++
    , type => "nix-build"
    , subtype => ""
    , path => $outPath
    , name => $build->nixname
    });
    }
    [4.4577]
    [4.6606]
    addBuildProducts($db, $build);