initial support for mercurial

[?]
Jul 27, 2010, 11:14 AM
O25D52TAMOPAK45N4II5XMWOBMPQJNHLW22M37COVY43EKNQBWJAC

Dependencies

  • [2] YQWH4POV * Simplify.
  • [3] 2WUNXJGW Hydra/26: Go back to using "svn export" as default for svn, added svn-checkout type for jobset which need .svn dirs. export is much more efficient
  • [4] YFPZ46YK * hydra: added variant of build input type, 'build output (same system)' to allow better continous integration in one jobset for multiple system. it makes sure that the system of the build that is passed as input for a job has the same system as the job.
  • [5] KQS7DSKJ * Clean up indentation.
  • [6] 3XTHEUMP * Implemented the clone feature.
  • [7] T4LLYESZ * Nix expression for building Hydra.
  • [8] OOQ2D3KC * Refactoring: move fetchInput out of hydra_scheduler into a separate
  • [9] JTRG7RDQ add support for git as jobinput
  • [*] DFXIN6YW * Include jquery and tablesorter in the build.
  • [*] IK53RV4V
  • [*] N22GPKYT * Put info about logs / build products in the DB.
  • [*] 2I2ZX6JB * Make the "latest succeeded" query (used by the "latest" channel)
  • [*] E2TOU3L6 * More indices.

Change contents

  • replacement in release.nix at line 79
    [2.2094][2.2094:2135]()
    gzip bzip2 lzma gnutar unzip git
    [2.2094]
    [2.2135]
    gzip bzip2 lzma gnutar unzip git mercurial
  • edit in release.nix at line 93
    [2.2601]
    [11.531]
    cp ${"${nixpkgs}/pkgs/build-support/fetchhg/nix-prefetch-hg"} $out/bin/nix-prefetch-hg
  • edit in src/lib/Hydra/Helper/AddBuilds.pm at line 9
    [4.2759]
    [4.2759]
    use Digest::SHA qw(sha256_hex);
    use File::Path;
  • edit in src/lib/Hydra/Helper/AddBuilds.pm at line 359
    [4.2118]
    [4.2120]
    sub scmPath {
    return getHydraPath . "/scm" ;
    }
  • replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 363
    [4.2121][4.2121:2141]()
    sub fetchInputCVS {
    [4.2121]
    [4.2141]
    sub fetchInputHg {
  • edit in src/lib/Hydra/Helper/AddBuilds.pm at line 365
    [4.2201]
    [4.2201]
    (my $uri, my $branch) = split ' ', $value;
    $branch = defined $branch ? $branch : "default";
    # init local hg clone
    my $stdout; my $stderr;
    my $clonePath;
    mkpath(scmPath);
    $clonePath = scmPath . "/" . sha256_hex($uri);
    if (! -d $clonePath) {
    (my $res, $stdout, $stderr) = captureStdoutStderr(600,
    ("hg", "clone", $uri, $clonePath));
    die "Error cloning mercurial repo at `$uri':\n$stderr" unless $res;
    }
    # hg pull + check rev
    chdir $clonePath or die $!;
    (my $res, $stdout, $stderr) = captureStdoutStderr(600,
    ("hg", "pull"));
    die "Error pulling latest change mercurial repo at `$uri':\n$stderr" unless $res;
    (my $res1, $stdout, $stderr) = captureStdoutStderr(600,
    ("hg", "heads", $branch));
    die "Error getting head of $branch from `$uri':\n$stderr" unless $res;
    $stdout =~ m/[0-9]+:([0-9A-Fa-f]{12})/;
    my $revision = $1;
    die "Could not determine head revision of branch $branch" unless $revision;
    my $storePath;
    my $sha256;
    (my $cachedInput) = $db->resultset('CachedHgInputs')->search(
    {uri => $uri, branch => $branch, revision => $revision});
    if (defined $cachedInput && isValidPath($cachedInput->storepath)) {
    $storePath = $cachedInput->storepath;
    $sha256 = $cachedInput->sha256hash;
    } else {
    print STDERR "checking out Mercurial input from $uri $branch revision $revision\n";
    $ENV{"NIX_HASH_ALGO"} = "sha256";
    $ENV{"PRINT_PATH"} = "1";
    (my $res, $stdout, $stderr) = captureStdoutStderr(600,
    ("nix-prefetch-hg", $uri, $revision));
    die "Cannot check out Mercurial repository `$uri':\n$stderr" unless $res;
    ($sha256, $storePath) = split ' ', $stdout;
    txn_do($db, sub {
    $db->resultset('CachedHgInputs')->create(
    { uri => $uri
    , branch => $branch
    , revision => $revision
    , sha256hash => $sha256
    , storepath => $storePath
    });
    });
    }
    return
    { type => $type
    , uri => $uri
    , branch => $branch
    , storePath => $storePath
    , sha256hash => $sha256
    , revision => $revision
    };
  • replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 489
    [4.1790][3.461:553]()
    when (["svn", "svn-checkout", "path", "build", "git", "cvs", "sysbuild"]) {
    [4.1790]
    [4.1840]
    when (["svn", "svn-checkout", "path", "build", "git", "hg", "sysbuild"]) {
  • edit in src/root/common.tt at line 11
    [12.2927]
    [12.2927]
    , "hg" = "Mercurial checkout"
  • edit in src/sql/hydra.sql at line 316
    [4.6187]
    [4.6187]
    sha256hash text not null,
    storePath text not null,
    primary key (uri, branch, revision)
    );
    create table CachedHgInputs (
    uri text not null,
    branch text not null,
    revision text not null,
  • edit in src/sql/hydra.sql at line 507
    [14.804]
    [15.159]
    create index IndexCachedHgInputsOnHash on CachedHgInputs(uri, branch, sha256hash);