* Don't access /nix/var/nix/db directly but use the Nix Perl bindings.

[?]
Mar 4, 2010, 1:25 PM
UC3YQDZF25LANTONKN3SM4NBFKKARRTH7KKWGGSGYQR7U3UBAD6QC

Dependencies

  • [2] DV33AJ23
  • [3] 2GK5DOU7 * Downloading closures.
  • [4] AFTXA575 * $HYDRA_DATA environment variable.
  • [5] IN272KZW * Automatically keep all builds in the latest successful release in
  • [6] XBU2ODSP * More renaming.
  • [7] PPJN6SDP * paging for releases page
  • [8] BDSD2JLV * Speed up manifest generation.
  • [9] WZ3AEJ67 * hydra_update_gc_roots.pl registers build outputs that should be kept
  • [10] A63IHCMX * Register GC roots properly.

Change contents

  • edit in src/lib/Hydra/Helper/Nix.pm at line 7
    [3.80]
    [3.127]
    use Nix;
  • replacement in src/lib/Hydra/Helper/Nix.pm at line 21
    [3.528][3.81:374]()
    #$SIG{CHLD} = 'DEFAULT'; # !!! work around system() failing if SIGCHLD is ignored
    #return system("nix-store --check-validity $path 2> /dev/null") == 0;
    # This is faster than calling nix-store, but it breaks abstraction...
    return -e ("/nix/var/nix/db/info/" . basename $path);
    [3.528]
    [3.75]
    return Nix::isValidPath($path);
  • edit in src/lib/Hydra/Helper/Nix.pm at line 27
    [3.121][3.121:230]()
    # !!! like above, this breaks abstraction. What we really need is
    # Perl bindings for libstore :-)
  • replacement in src/lib/Hydra/Helper/Nix.pm at line 28
    [3.231][3.231:336]()
    open FH, "</nix/var/nix/db/info/" . basename $path
    or die "cannot open info file for $path";
    [3.231]
    [3.336]
    my $hash = Nix::queryPathHash($path);
    my $deriver = Nix::queryDeriver($path);
    my @refs = Nix::queryReferences($path);
  • edit in src/lib/Hydra/Helper/Nix.pm at line 32
    [3.337][3.337:652](),[3.652][2.0:64](),[2.64][3.682:683](),[3.682][3.682:683]()
    my $hash;
    my $deriver;
    my @refs = ();
    while (<FH>) {
    if (/^Hash: (\S+)$/) {
    $hash = $1;
    }
    elsif (/^Deriver: (\S+)$/) {
    $deriver = $1;
    }
    elsif (/^References: (.*)$/) {
    @refs = split / /, $1;
    }
    }
    close FH;
    die "path $path does not have a hash" unless defined $hash;