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S3ZYIINOOO2MFPHFHSQC
WWUOQ7V4KWGGHG22G22G6FWRHZEDLP3UZHA2C2FOMNT3UU4PFT4AC
KQS7DSKJHTEHALCPTXMWRX2IBOVC5BWU7RWJ4GP5A2JJSBR7HPKAC
O25D52TAMOPAK45N4II5XMWOBMPQJNHLW22M37COVY43EKNQBWJAC
ARD6Z67TDHK2XMW47CSVOXXF327YGOMYK3EAXTSVVXNDAFQYNO5AC
V2MLUZRP7K4WGDM54U35F77ICGJMBHDET4SZUDMQNTYTAYKVBFWAC
BD3GRK4BQUGRQGTAILUITIH3RRSVUH6AKINVMMKYLBAAHAAUSB4AC
7YBYT2LQML2PKEO6UO4444AGSASS664UCDXW2YO3ALB7THQHCEBQC
KX5L74EYLS4YVSFG5H6U5H5TB6BQUFHHFUMLHTUUU6WFJLSRF5ZAC
HX4QYOYAKKFKK4KF6SZ6FQCM5ZF7ZFDTQUR4GS5WPPTYZASYZZUAC
FAIJDQKZH6SUUNCKW5RIOZ37YRAO5ACS6FX76MHRNN53LDBWO6ZQC
ZHBEOOUQS46RWOJUV4AFCKI7JDASDNGT7KVSHPJK7DRBXW7SSROAC
SBKX3YH2EOCYY2IDACGOTXHJZSYSRHD5EC7FB6WGPKHLFYOF6SAAC
WFJ3ZPRMZ52NFPPGRJTVNLYLFFN2DYP3JHNTPVRQAEULEF7VCGGAC
W6J4PVRPLX2IBH2KO4A5DSZBJUJYFJ3LYBSP4YKJIDFBXYVD2DWQC
(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;
}
(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;
# 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;
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;
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;
}
# 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.
# 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";
}
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);
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++;
# 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/"));
}
#! /bin/sh
#! /bin/sh
#! /bin/sh
cd "$1"
STATE_FILE=.state
if test -e $STATE_FILE; then
state=$(cat $STATE_FILE)
else
state=0;
fi
case $state in
(0)
echo "Add new file."
touch git-file-2
git add git-file-2 >&2
git commit -m "add git file 2" git-file-2 >&2
;;
(1)
echo "Rewrite commit."
echo 1 > git-file-2
git add git-file-2 >&2
git commit --amend -m "add git file 2" git-file-2 >&2
;;
esac
echo $(($state + 1)) > $STATE_FILE
#! /bin/sh
#! /bin/sh
#! /bin/sh