* hydra: indentation and fixed duplicate key in cachedgitinputs bug

[?]
Feb 24, 2010, 8:09 AM
WWUOQ7V4KWGGHG22G22G6FWRHZEDLP3UZHA2C2FOMNT3UU4PFT4AC

Dependencies

  • [2] BK24VA6Q * for git inputs, check latest revision of branch (defaults to master for now), if there is change, only use input if last checkout was > hour ago.
  • [3] Z6XUFUCL Set $NIX_PREFETCH_GIT_DEEP_CLONE.
  • [4] NJBETZ2C Use $NIX_PREFETCH_GIT_CHECKOUT_HOOK to produce a `.git-version' file.
  • [5] RR7O4KFU Set $NIX_PREFETCH_SVN_LEAVE_DOT_SVN to 1.
  • [6] OOQ2D3KC * Refactoring: move fetchInput out of hydra_scheduler into a separate
  • [7] JTRG7RDQ add support for git as jobinput
  • [8] VN2SV3G2 Ask `nix-prefetch-git' to leave `.git' in the output.

Change contents

  • replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 291
    [4.832][4.832:947](),[4.947][2.919:956]()
    $storePath = $cachedInput->storepath;
    $sha256 = $cachedInput->sha256hash;
    $timestamp = $cachedInput->timestamp;
    $revision = $cachedInput->revision;
    [4.832]
    [4.947]
    $storePath = $cachedInput->storepath;
    $sha256 = $cachedInput->sha256hash;
    $timestamp = $cachedInput->timestamp;
    $revision = $cachedInput->revision;
  • replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 296
    [4.960][4.960:1120](),[4.1120][4.0:118](),[4.118][4.0:112](),[4.112][4.162:209](),[4.162][4.162:209](),[4.209][4.113:160](),[4.160][3.0:215](),[4.160][4.209:210](),[3.215][4.209:210](),[4.209][4.209:210](),[4.1152][4.1152:1204](),[4.1204][2.957:1089](),[2.1089][4.1305:1412](),[4.1305][4.1305:1412](),[4.1412][2.1090:1153](),[2.1153][4.1456:1575](),[4.1456][4.1456:1575](),[4.1575][2.1154:1238](),[2.1238][4.1575:1921](),[4.1575][4.1575:1921]()
    # Then download this revision into the store.
    print STDERR "checking out Git input from $uri";
    $ENV{"NIX_HASH_ALGO"} = "sha256";
    $ENV{"PRINT_PATH"} = "1";
    # Checked out code often wants to be able to run `git
    # describe', e.g., code that uses Gnulib's `git-version-gen'
    # script. Thus, we leave `.git' in there. Same for
    # Subversion (e.g., libgcrypt's build system uses that.)
    $ENV{"NIX_PREFETCH_GIT_LEAVE_DOT_GIT"} = "1";
    $ENV{"NIX_PREFETCH_SVN_LEAVE_DOT_SVN"} = "1";
    # Ask for a "deep clone" to allow "git describe" and similar
    # tools to work. See
    # http://thread.gmane.org/gmane.linux.distributions.nixos/3569
    # for a discussion.
    $ENV{"NIX_PREFETCH_GIT_DEEP_CLONE"} = "1";
    (my $res, $stdout, $stderr) = captureStdoutStderr(
    "nix-prefetch-git", $uri, $revision);
    die "Cannot check out Git repository branch '$branch' at `$uri':\n$stderr" unless $res;
    ($sha256, $storePath) = split ' ', $stdout;
    ($cachedInput) = $db->resultset('CachedGitInputs')->search(
    {uri => $uri, branch => $branch, sha256hash => $sha256});
    if (!defined $cachedInput) {
    txn_do($db, sub {
    $db->resultset('CachedGitInputs')->create(
    { uri => $uri
    , branch => $branch
    , revision => $revision
    , timestamp => $timestamp
    , lastseen => $timestamp
    , sha256hash => $sha256
    , storepath => $storePath
    });
    });
    } else {
    $timestamp = $cachedInput->timestamp;
    txn_do($db, sub {
    $cachedInput->update({lastseen => time});
    });
    }
    [4.960]
    [4.10008]
    # Then download this revision into the store.
    print STDERR "checking out Git input from $uri";
    $ENV{"NIX_HASH_ALGO"} = "sha256";
    $ENV{"PRINT_PATH"} = "1";
    # Checked out code often wants to be able to run `git
    # describe', e.g., code that uses Gnulib's `git-version-gen'
    # script. Thus, we leave `.git' in there. Same for
    # Subversion (e.g., libgcrypt's build system uses that.)
    $ENV{"NIX_PREFETCH_GIT_LEAVE_DOT_GIT"} = "1";
    $ENV{"NIX_PREFETCH_SVN_LEAVE_DOT_SVN"} = "1";
    # Ask for a "deep clone" to allow "git describe" and similar
    # tools to work. See
    # http://thread.gmane.org/gmane.linux.distributions.nixos/3569
    # for a discussion.
    $ENV{"NIX_PREFETCH_GIT_DEEP_CLONE"} = "1";
    (my $res, $stdout, $stderr) = captureStdoutStderr(
    "nix-prefetch-git", $uri, $revision);
    die "Cannot check out Git repository branch '$branch' at `$uri':\n$stderr" unless $res;
    ($sha256, $storePath) = split ' ', $stdout;
    ($cachedInput) = $db->resultset('CachedGitInputs')->search(
    {uri => $uri, branch => $branch, sha256hash => $sha256});
    if (!defined $cachedInput) {
    txn_do($db, sub {
    $db->resultset('CachedGitInputs')->update_or_create(
    { uri => $uri
    , branch => $branch
    , revision => $revision
    , timestamp => $timestamp
    , lastseen => $timestamp
    , sha256hash => $sha256
    , storepath => $storePath
    });
    });
    } else {
    $timestamp = $cachedInput->timestamp;
    txn_do($db, sub {
    $cachedInput->update({lastseen => time});
    });
    }