Optimize fetch-git.
[?]
Apr 15, 2012, 1:17 AM
HE3GX5IPS6XA7KLNP5WZY2YU27WQS663WSKAL5FHWBSJ5GMM633ACDependencies
- [2]
ENYUXIFPsupport git branches as input in stead of only master branch - [3]
VXY434VY - [4]
UVNQPK3THydra/56: handle failed builds with result only at build level, not buildsteps - [5]
KW3M6NSRhydra: run nix-prefetch-git on local clone of git repo - [6]
RBZRCTALhydra: fixed and re-enabled evaluation tests - [7]
V2ALOFRRFix the test - [8]
EDRUQ4UKDie TABs die - [9]
4FWDVNWAPass additional attributes for Git inputs - [10]
DAKY4N64Allow use of a single Git clone for several branches. - [11]
WFJ3ZPRMadd tests for scm inputs - [12]
5SMQ2PLKFix tests - [13]
TM6XBAG2git branches can share local clones - [14]
VJ4BZV5RAdd branch to local clone path of git repositories for now. - [15]
7YBYT2LQ - [16]
ZHBEOOUQshow evaluation errors in log of tests - [17]
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. - [18]
WWUOQ7V4* hydra: indentation and fixed duplicate key in cachedgitinputs bug - [19]
2WUNXJGWHydra/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 - [20]
KX5L74EYadd nix-prefetch- scripts for now, were externals in svn - [21]
CHQEG6WYHydra/29: Added timeout to svn/git checkouts, job evaluation - [22]
2WRTOU2ZCleanup - [23]
BMSQD2ZHIndentation - [24]
HABC6L4GRevert "Use git fetch --all to update local clone in stead of git pull. Also, do not use --branch in initial clone." - [25]
FAIJDQKZ - [26]
BD3GRK4B* Get rid of "positive failures" and separate log phases. - [27]
6ZSLRO7MfetchInputGit: Populate TopGit branches when on a topic branch. - [28]
SBKX3YH2cleanup - [29]
JTRG7RDQadd support for git as jobinput - [30]
C7CXMZ66hydra: do not perform git clone every time. in stead work on local clone and pull - [31]
HQ4QHAOFmake default branch default, remove quotes - [32]
UO67NQMRChange `fetchInputGit' to do `git clone -b BRANCH' instead of `git clone'. - [33]
M73H45NEadd support for mercurial tags/revs - [34]
3I6BNF4Shydra: do not use refs/heads while checking for latest commit in branch - [35]
G3IUM7VLhydra: add support for succeedOnFailure feature in stdenv - [36]
V2MLUZRPRandom indentation fix - [37]
KQS7DSKJ* Clean up indentation. - [38]
O25D52TAinitial support for mercurial - [39]
HX4QYOYAadd first evaluations tests - [40]
W6J4PVRPremove debug statement - [41]
ARD6Z67TDo incremental SVN checkouts - [42]
PNPT3Y7RUse git fetch --all to update local clone in stead of git pull. Also, do not use --branch in initial clone. - [*]
OOQ2D3KC* Refactoring: move fetchInput out of hydra_scheduler into a separate
Change contents
- replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 318
(my $uri, my $branch) = split ' ', $value;$branch = defined $branch ? $branch : "master";(my $uri, my $branch, my $deepClone) = split ' ', $value;$branch = defined $branch ? $branch : "master"; - replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 328
my $stdout; my $stderr;my $stdout = ""; my $stderr = ""; my $res; - replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 330
(my $res, $stdout, $stderr) = captureStdoutStderr(600,# Clone everything and fetch the branch.# TODO: Optimize the first clone by using "git init $clonePath" and "git remote add origin $uri".($res, $stdout, $stderr) = captureStdoutStderr(600, - edit in src/lib/Hydra/Helper/AddBuilds.pm at line 337
# git pull + check rev - replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 338[11.227]→[11.116:175](∅→∅),[11.456]→[11.116:175](∅→∅),[11.120]→[11.116:175](∅→∅),[11.175]→[10.55:90](∅→∅),[11.86]→[11.483:563](∅→∅),[10.90]→[11.483:563](∅→∅),[11.97]→[11.483:563](∅→∅),[11.483]→[11.483:563](∅→∅)
(my $res, $stdout, $stderr) = captureStdoutStderr(600,("git", "pull", "--all"));die "Error pulling latest change git repo at `$uri':\n$stderr" unless $res;if (defined $deepClone) {# This fetch every branches from the remote repository and create a# local branch for each heads of the remote repository. This is# necessary to provide a working git-describe.($res, $stdout, $stderr) = captureStdoutStderr(600,("git", "pull", "--ff-only", "-fu", "--all", "origin"));die "Error pulling latest change from git repo at `$uri':\n$stderr" unless $res;} else {# This command force the update of the local branch to be in the same as# the remote branch for whatever the repository state is. This command mirror# only one branch of the remote repository.($res, $stdout, $stderr) = captureStdoutStderr(600,("git", "fetch", "-fu", "origin", "+$branch:$branch"));die "Error fetching latest change from git repo at `$uri':\n$stderr" unless $res;} - replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 355
(my $res1, $stdout, $stderr) = captureStdoutStderr(600,("git", "ls-remote", $clonePath, $branch));die "Cannot get head revision of Git branch '$branch' at `$uri':\n$stderr" unless $res1 ;($res, $stdout, $stderr) = captureStdoutStderr(600,("git", "rev-parse", "$branch"));die "Error getting revision number of Git branch '$branch' at `$uri':\n$stderr" unless $res; - replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 359
# Take the first commit ID returned by `ls-remote'. The# assumption is that `ls-remote' returned both `refs/heads/BRANCH'# and `refs/remotes/origin/BRANCH', and that both point at the# same commit.my ($first) = split /\n/, $stdout;(my $revision, my $ref) = split ' ', $first;my ($revision) = split /\n/, $stdout; - edit in src/lib/Hydra/Helper/AddBuilds.pm at line 361
die "Error getting a well-formated revision number of Git branch '$branch' at `$uri':\n$stdout" unless $res; - replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 363
if (-f ".topdeps") {# This is a TopGit branch. Fetch all the topic branches so# that builders can run "tg patch" and similar.(my $res, $stdout, $stderr) = captureStdoutStderr(600,("tg", "remote", "--populate", "origin"));my $ref = "refs/heads/$branch";# If deepClone is defined, then we look at the content of the repository# to determine if this is a top-git branch.if (defined $deepClone) {# Checkout the branch to look at its content.($res, $stdout, $stderr) = captureStdoutStderr(600,("git", "checkout", "$branch"));die "Error checking out Git branch '$branch' at `$uri':\n$stderr" unless $res; - replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 374
print STDERR "Warning: `tg remote --populate origin' failed:\n$stderr" unless $res;if (-f ".topdeps") {# This is a TopGit branch. Fetch all the topic branches so# that builders can run "tg patch" and similar.($res, $stdout, $stderr) = captureStdoutStderr(600,("tg", "remote", "--populate", "origin"));print STDERR "Warning: `tg remote --populate origin' failed:\n$stderr" unless $res;} - replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 384
# Some simple caching: don't check a uri/branch more than once every hour, but prefer exact match on uri/branch/revision.# Some simple caching: don't check a uri/branch/revision more than once.# TODO: Fix case where the branch is reset to a previous commit. - edit in src/lib/Hydra/Helper/AddBuilds.pm at line 396
- replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 397
print STDERR "checking out Git input from $uri\n";print STDERR "checking out Git branch $branch from $uri\n"; - replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 400[11.6803]→[11.352:357](∅→∅),[11.352]→[11.352:357](∅→∅),[11.357]→[11.6804:7115](∅→∅),[11.7169]→[11.704:709](∅→∅),[11.704]→[11.704:709](∅→∅),[11.709]→[11.7170:7419](∅→∅)
# 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";# 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";$ENV{"NIX_PREFETCH_GIT_LEAVE_DOT_GIT"} = "0";$ENV{"NIX_PREFETCH_GIT_DEEP_CLONE"} = "";if (defined $deepClone) {# 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";# 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";} - replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 417
(my $res, $stdout, $stderr) = captureStdoutStderr(600,($res, $stdout, $stderr) = captureStdoutStderr(600, - replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 537
my $stdout; my $stderr;my $stdout = ""; my $stderr = ""; - replacement in src/lib/Hydra/Helper/AddBuilds.pm at line 709
return (undef, undef, undef);return (undef, "", "timeout\n"); - replacement in src/script/hydra-build at line 374
}} - replacement in src/script/nix-prefetch-git at line 66
--deepClone Clone submodules recursively.--no-deepClone Do not clone submodules.--deepClone Clone history until a tag is found as parent.--no-deepClone Clone the minimum history. - replacement in src/script/nix-prefetch-git at line 120
return 1# To make git describe works, we need to fetch all tags.if git fetch -t ${builder:+--progress} --depth 1 origin; thenreturn 1else# There is no tag, don't try to recover git-describe mechanism.deepClone=falsefi - replacement in src/script/nix-prefetch-git at line 219
echo "removing \`.git'..." >&2test -n "$QUIET" || echo "removing \`.git'..." >&2 - replacement in src/script/nix-prefetch-git at line 258
if ! test -n "$QUIET"; then echo "hash is $hash" >&2; fitest -n "$QUIET" || echo "hash is $hash" >&2; - replacement in src/script/nix-prefetch-git at line 269
if ! test -n "$QUIET"; then echo "path is $finalPath" >&2; fitest -n "$QUIET" || echo "path is $finalPath" >&2 - replacement in tests/Setup.pm at line 11
our @EXPORT = qw(hydra_setup nrBuildsForJobset queuedBuildsForJobset nrQueuedBuildsForJobset createBaseJobset createJobsetWithOneInput evalSucceeds runBuild);our @EXPORT = qw(hydra_setup nrBuildsForJobset queuedBuildsForJobset nrQueuedBuildsForJobset createBaseJobset createJobsetWithOneInput evalSucceeds runBuild updateRepository); - edit in tests/Setup.pm at line 75
}sub updateRepository {my ($scm, $update, $repo) = @_;my ($res, $stdout, $stderr) = captureStdoutStderr(60, ($update, $repo));die "Unexpected update error with $scm: $stderr\n" unless $res;print STDOUT "Update $scm repository: $stdout" if $stdout ne "";return $stdout ne ""; - replacement in tests/evaluation-tests.pl at line 10
use Test::Simple tests => 28;use Test::Simple tests => 48; - replacement in tests/evaluation-tests.pl at line 60[11.253]→[11.2401:2625](∅→∅),[11.357]→[11.2054:2056](∅→∅),[11.2625]→[11.2054:2056](∅→∅),[11.2054]→[11.2054:2056](∅→∅)
ok(evalSucceeds($jobset), "Evaluating jobs/$scm-input.nix should exit with return code 0.");ok(nrQueuedBuildsForJobset($jobset) == 1, "Evaluating jobs/$scm-input.nix should result in 1 build in queue");}my $c = 1;my $q = 1;do {# Verify that it can be fetched and queued.ok(evalSucceeds($jobset), "$c Evaluating jobs/$scm-input.nix should exit with return code 0."); $c++;ok(nrQueuedBuildsForJobset($jobset) == $q, "$c Evaluating jobs/$scm-input.nix should result in 1 build in queue"); $c++; - edit in tests/evaluation-tests.pl at line 67[11.1]
# Verify that it is deterministic and not queued again.ok(evalSucceeds($jobset), "$c Evaluating jobs/$scm-input.nix should exit with return code 0."); $c++;ok(nrQueuedBuildsForJobset($jobset) == $q, "$c Evaluating jobs/$scm-input.nix should result in $q build in queue"); $c++;$q++;} while(updateRepository($scm, getcwd . "/jobs/$scm-update.sh", getcwd . "/$scm-repo/"));} - file addition: bzr-checkout-update.sh[11.1729]
#! /bin/sh - file addition: bzr-update.sh[11.1729]
#! /bin/sh - file addition: git-update.sh[11.1729]
#! /bin/shcd "$1"STATE_FILE=.stateif test -e $STATE_FILE; thenstate=$(cat $STATE_FILE)elsestate=0;ficase $state in(0)echo "Add new file."touch git-file-2git add git-file-2 >&2git commit -m "add git file 2" git-file-2 >&2;;(1)echo "Rewrite commit."echo 1 > git-file-2git add git-file-2 >&2git commit --amend -m "add git file 2" git-file-2 >&2;;esacecho $(($state + 1)) > $STATE_FILE - file addition: hg-update.sh[11.1729]
#! /bin/sh - file addition: svn-checkout-update.sh[11.1729]
#! /bin/sh - file addition: svn-update.sh[11.1729]
#! /bin/sh