initial bzr support

[?]
Feb 8, 2011, 1:11 PM
FXW2UR7FY7NPCEHSCAO4FTZHA47K5YACKHJJVKP6T3V42LJJTLAAC

Dependencies

  • [2] ZWCTAZGL added newsitems, added some admin options to clear various caches.
  • [3] O25D52TA initial support for mercurial
  • [4] VOBOLKL4 missing case for hg input type
  • [5] 34DPX2OR * Create some more indices on tables that have a foreign key reference
  • [6] CHQEG6WY Hydra/29: Added timeout to svn/git checkouts, job evaluation
  • [7] JTRG7RDQ add support for git as jobinput
  • [8] WWUOQ7V4 * hydra: indentation and fixed duplicate key in cachedgitinputs bug
  • [9] KQS7DSKJ * Clean up indentation.
  • [10] OOQ2D3KC * Refactoring: move fetchInput out of hydra_scheduler into a separate
  • [11] 3XTHEUMP * Implemented the clone feature.
  • [*] IK53RV4V
  • [*] 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
  • [*] N22GPKYT * Put info about logs / build products in the DB.
  • [*] E2TOU3L6 * More indices.

Change contents

  • edit in src/lib/Hydra/Controller/Admin.pm at line 317
    [2.1110]
    [2.1110]
    print "Clearing bazaar cache\n";
    $c->model('DB::CachedBazaarInputs')->delete_all;
  • edit in src/lib/Hydra/Helper/AddBuilds.pm at line 383
    [6.8578]
    [6.2117]
    sub fetchInputBazaar {
    my ($db, $project, $jobset, $name, $type, $value, $checkout) = @_;
    my $uri = $value;
    my $sha256;
    my $storePath;
    my $stdout; my $stderr;
    my $clonePath;
    mkpath(scmPath);
    $clonePath = scmPath . "/" . sha256_hex($uri);
    if (! -d $clonePath) {
    (my $res, $stdout, $stderr) = captureStdoutStderr(600,
    ("bzr", "branch", $uri, $clonePath));
    die "Error cloning bazaar branch at `$uri':\n$stderr" unless $res;
    }
    chdir $clonePath or die $!;
    (my $res, $stdout, $stderr) = captureStdoutStderr(600,
    ("bzr", "pull"));
    die "Error pulling latest change bazaar branch at `$uri':\n$stderr" unless $res;
    # First figure out the last-modified revision of the URI.
    my @cmd = (["bzr", "revno"],
    "|", ["sed", 's/^ *\([0-9]*\).*/\1/']);
    die "Cannot get head revision of Bazaar branch at `$uri':\n$stderr"
    unless IPC::Run::run(@cmd, \$stdout, \$stderr);
    my $revision = $stdout; chomp $revision;
    die unless $revision =~ /^\d+$/;
    (my $cachedInput) = $db->resultset('CachedBazaarInputs')->search(
    {uri => $uri, revision => $revision});
    if (defined $cachedInput && isValidPath($cachedInput->storepath)) {
    $storePath = $cachedInput->storepath;
    $sha256 = $cachedInput->sha256hash;
    } else {
    # Then download this revision into the store.
    print STDERR "checking out Bazaar input ", $name, " from $uri revision $revision\n";
    $ENV{"NIX_HASH_ALGO"} = "sha256";
    $ENV{"PRINT_PATH"} = "1";
    $ENV{"NIX_PREFETCH_BZR_LEAVE_DOT_BZR"} = "$checkout";
    (my $res, $stdout, $stderr) = captureStdoutStderr(600,
    ("nix-prefetch-bzr", $clonePath, $revision));
    die "Cannot check out Bazaar branch `$uri':\n$stderr" unless $res;
    ($sha256, $storePath) = split ' ', $stdout;
    txn_do($db, sub {
    $db->resultset('CachedBazaarInputs')->create(
    { uri => $uri
    , revision => $revision
    , sha256hash => $sha256
    , storepath => $storePath
    });
    });
    }
  • edit in src/lib/Hydra/Helper/AddBuilds.pm at line 447
    [6.2118]
    [3.249]
    return
    { type => $type
    , uri => $uri
    , storePath => $storePath
    , sha256hash => $sha256
    , revision => $revision
    };}
  • replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 554
    [4.109][6.10014:10019](),[6.2701][6.10014:10019](),[6.10014][6.10014:10019]()
    [4.109]
    [6.10019]
    elsif ($type eq "bzr") {
    return fetchInputBazaar($db, $project, $jobset, $name, $type, $value, 0);
    }
    elsif ($type eq "bzr-checkout") {
    return fetchInputBazaar($db, $project, $jobset, $name, $type, $value, 1);
    }
  • replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 563
    [6.10135][6.10135:10146]()
    }
    [6.10135]
    [6.10146]
    }
  • replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 567
    [6.10306][6.10306:10317]()
    }
    [6.10306]
    [6.10317]
    }
  • edit in src/root/common.tt at line 9
    [14.633]
    [6.5885]
    , "bzr" = "Bazaar export"
    , "bzr-checkout" = "Bazaar checkout"
  • edit in src/sql/hydra.sql at line 318
    [6.5990]
    [6.5990]
    create table CachedBazaarInputs (
    uri text not null,
    revision integer not null,
    sha256hash text not null,
    storePath text not null,
    primary key (uri, revision)
    );
  • edit in src/sql/hydra.sql at line 541
    [16.427]
    [5.0]
    create index IndexCachedBazaarInputsOnUriRevision on CachedBazaarInputs(uri, revision);