* Register builds as GC roots so they don't get deleted.

[?]
Feb 6, 2009, 9:01 PM
2T42QGZDK23C5V4ZHO4R7EBJESIQ62GKWDBWVX7OBEE3YVBUNUFAC

Dependencies

  • [2] IN272KZW * Automatically keep all builds in the latest successful release in
  • [3] 4X6NS66Q * Keep the most recent builds for each job.
  • [4] WZ3AEJ67 * hydra_update_gc_roots.pl registers build outputs that should be kept
  • [*] 2GK5DOU7 * Downloading closures.
  • [*] AFTXA575 * $HYDRA_DATA environment variable.
  • [*] 7YBYT2LQ
  • [*] BD3GRK4B * Get rid of "positive failures" and separate log phases.
  • [*] N22GPKYT * Put info about logs / build products in the DB.

Change contents

  • edit in src/Hydra/lib/Hydra/Helper/Nix.pm at line 5
    [7.127]
    [3.60]
    use File::Path;
  • edit in src/Hydra/lib/Hydra/Helper/Nix.pm at line 11
    [2.675]
    [2.675]
    registerRoot getGCRootsDir
  • edit in src/Hydra/lib/Hydra/Helper/Nix.pm at line 44
    [7.846]
    [2.751]
    }
    sub getGCRootsDir {
    die unless defined $ENV{LOGNAME};
    return "/nix/var/nix/gcroots/per-user/$ENV{LOGNAME}/hydra-roots";
    }
    sub registerRoot {
    my ($path) = @_;
    my $gcRootsDir = getGCRootsDir;
    mkpath($gcRootsDir) if !-e $gcRootsDir;
    my $link = "$gcRootsDir/" . basename $path;
    if (!-l $link) {
    symlink($path, $link)
    or die "cannot create symlink in $gcRootsDir to $path";
    }
  • edit in src/Hydra/script/hydra_build.pl at line 27
    [9.3622]
    [8.3465]
    registerRoot $outPath;
  • edit in src/Hydra/script/hydra_scheduler.pl at line 251
    [8.11037]
    [8.11037]
    # !!! this should really by done by nix-instantiate to prevent a GC race.
    registerRoot $drvPath;
  • edit in src/Hydra/script/hydra_update_gc_roots.pl at line 11
    [3.630][3.630:741]()
    die unless defined $ENV{LOGNAME};
    my $gcRootsDir = "/nix/var/nix/gcroots/per-user/$ENV{LOGNAME}/hydra-roots";
  • replacement in src/Hydra/script/hydra_update_gc_roots.pl at line 17
    [3.795][3.25:47](),[3.47][3.816:919](),[3.816][3.816:919](),[3.919][3.48:69](),[3.69][3.940:970](),[3.940][3.940:970](),[3.970][3.70:138](),[3.138][3.1040:1047](),[3.1040][3.1040:1047]()
    #print "$path\n";
    mkpath($gcRootsDir) if !-e $gcRootsDir;
    my $link = "$gcRootsDir/" . basename $path;
    if (!-l $link) {
    symlink($path, $link)
    or die "cannot create symlink in $gcRootsDir to $path";
    }
    [3.795]
    [3.1047]
    Hydra::Helper::Nix::registerRoot($path);
  • replacement in src/Hydra/script/hydra_update_gc_roots.pl at line 87
    [3.1500][3.1620:1685](),[3.1620][3.1620:1685]()
    # For scheduled builds, we register the derivation as a GC root.
    [3.1500]
    [3.1501]
    # For scheduled builds, we register the derivation and the output as a GC root.
  • edit in src/Hydra/script/hydra_update_gc_roots.pl at line 91
    [3.1825]
    [3.1825]
    print "keeping scheduled build ", $build->id, " (",
    strftime("%Y-%m-%d %H:%M:%S", localtime($build->timestamp)), ")\n";
  • edit in src/Hydra/script/hydra_update_gc_roots.pl at line 94
    [3.1863]
    [3.1863]
    registerRoot $build->outpath;
  • edit in src/Hydra/script/hydra_update_gc_roots.pl at line 102
    [3.2031]
    [3.2031]
    print "*** removing unneeded GC roots\n";
    my $gcRootsDir = getGCRootsDir;