Avoid shadowing internal run function by renaming it to runCommand
see https://github.com/NixOS/hydra/issues/1520
This commit is contained in:
@@ -212,7 +212,7 @@ sub checkPath {
|
|||||||
sub serveFile {
|
sub serveFile {
|
||||||
my ($c, $path) = @_;
|
my ($c, $path) = @_;
|
||||||
|
|
||||||
my $res = run(cmd => ["nix", "--experimental-features", "nix-command",
|
my $res = runCommand(cmd => ["nix", "--experimental-features", "nix-command",
|
||||||
"ls-store", "--store", getStoreUri(), "--json", "$path"]);
|
"ls-store", "--store", getStoreUri(), "--json", "$path"]);
|
||||||
|
|
||||||
if ($res->{status}) {
|
if ($res->{status}) {
|
||||||
|
@@ -44,7 +44,7 @@ our @EXPORT = qw(
|
|||||||
readNixFile
|
readNixFile
|
||||||
registerRoot
|
registerRoot
|
||||||
restartBuilds
|
restartBuilds
|
||||||
run
|
runCommand
|
||||||
$MACHINE_LOCAL_STORE
|
$MACHINE_LOCAL_STORE
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -466,7 +466,7 @@ sub readIntoSocket{
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
sub run {
|
sub runCommand {
|
||||||
my (%args) = @_;
|
my (%args) = @_;
|
||||||
my $res = { stdout => "", stderr => "" };
|
my $res = { stdout => "", stderr => "" };
|
||||||
my $stdin = "";
|
my $stdin = "";
|
||||||
@@ -506,7 +506,7 @@ sub run {
|
|||||||
|
|
||||||
sub grab {
|
sub grab {
|
||||||
my (%args) = @_;
|
my (%args) = @_;
|
||||||
my $res = run(%args, grabStderr => 0);
|
my $res = runCommand(%args, grabStderr => 0);
|
||||||
if ($res->{status}) {
|
if ($res->{status}) {
|
||||||
my $msgloc = "(in an indeterminate location)";
|
my $msgloc = "(in an indeterminate location)";
|
||||||
if (defined $args{dir}) {
|
if (defined $args{dir}) {
|
||||||
|
@@ -32,7 +32,7 @@ sub fetchInput {
|
|||||||
my $stdout = ""; my $stderr = ""; my $res;
|
my $stdout = ""; my $stderr = ""; my $res;
|
||||||
if (! -d $clonePath) {
|
if (! -d $clonePath) {
|
||||||
# Clone the repository.
|
# Clone the repository.
|
||||||
$res = run(timeout => 600,
|
$res = runCommand(timeout => 600,
|
||||||
cmd => ["darcs", "get", "--lazy", $uri, $clonePath],
|
cmd => ["darcs", "get", "--lazy", $uri, $clonePath],
|
||||||
dir => $ENV{"TMPDIR"});
|
dir => $ENV{"TMPDIR"});
|
||||||
die "Error getting darcs repo at `$uri':\n$stderr" if $res->{status};
|
die "Error getting darcs repo at `$uri':\n$stderr" if $res->{status};
|
||||||
|
@@ -137,8 +137,8 @@ sub fetchInput {
|
|||||||
my $res;
|
my $res;
|
||||||
if (! -d $clonePath) {
|
if (! -d $clonePath) {
|
||||||
# Clone everything and fetch the branch.
|
# Clone everything and fetch the branch.
|
||||||
$res = run(cmd => ["git", "init", $clonePath]);
|
$res = runCommand(cmd => ["git", "init", $clonePath]);
|
||||||
$res = run(cmd => ["git", "remote", "add", "origin", "--", $uri], dir => $clonePath) unless $res->{status};
|
$res = runCommand(cmd => ["git", "remote", "add", "origin", "--", $uri], dir => $clonePath) unless $res->{status};
|
||||||
die "error creating git repo in `$clonePath':\n$res->{stderr}" if $res->{status};
|
die "error creating git repo in `$clonePath':\n$res->{stderr}" if $res->{status};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,9 +146,9 @@ sub fetchInput {
|
|||||||
# the remote branch for whatever the repository state is. This command mirrors
|
# the remote branch for whatever the repository state is. This command mirrors
|
||||||
# only one branch of the remote repository.
|
# only one branch of the remote repository.
|
||||||
my $localBranch = _isHash($branch) ? "_hydra_tmp" : $branch;
|
my $localBranch = _isHash($branch) ? "_hydra_tmp" : $branch;
|
||||||
$res = run(cmd => ["git", "fetch", "-fu", "origin", "+$branch:$localBranch"], dir => $clonePath,
|
$res = runCommand(cmd => ["git", "fetch", "-fu", "origin", "+$branch:$localBranch"], dir => $clonePath,
|
||||||
timeout => $cfg->{timeout});
|
timeout => $cfg->{timeout});
|
||||||
$res = run(cmd => ["git", "fetch", "-fu", "origin"], dir => $clonePath, timeout => $cfg->{timeout}) if $res->{status};
|
$res = runCommand(cmd => ["git", "fetch", "-fu", "origin"], dir => $clonePath, timeout => $cfg->{timeout}) if $res->{status};
|
||||||
die "error fetching latest change from git repo at `$uri':\n$res->{stderr}" if $res->{status};
|
die "error fetching latest change from git repo at `$uri':\n$res->{stderr}" if $res->{status};
|
||||||
|
|
||||||
# If deepClone is defined, then we look at the content of the repository
|
# If deepClone is defined, then we look at the content of the repository
|
||||||
@@ -156,16 +156,16 @@ sub fetchInput {
|
|||||||
if (defined $deepClone) {
|
if (defined $deepClone) {
|
||||||
|
|
||||||
# Is the target branch a topgit branch?
|
# Is the target branch a topgit branch?
|
||||||
$res = run(cmd => ["git", "ls-tree", "-r", "$branch", ".topgit"], dir => $clonePath);
|
$res = runCommand(cmd => ["git", "ls-tree", "-r", "$branch", ".topgit"], dir => $clonePath);
|
||||||
|
|
||||||
if ($res->{stdout} ne "") {
|
if ($res->{stdout} ne "") {
|
||||||
# Checkout the branch to look at its content.
|
# Checkout the branch to look at its content.
|
||||||
$res = run(cmd => ["git", "checkout", "--force", "$branch"], dir => $clonePath);
|
$res = runCommand(cmd => ["git", "checkout", "--force", "$branch"], dir => $clonePath);
|
||||||
die "error checking out Git branch '$branch' at `$uri':\n$res->{stderr}" if $res->{status};
|
die "error checking out Git branch '$branch' at `$uri':\n$res->{stderr}" if $res->{status};
|
||||||
|
|
||||||
# This is a TopGit branch. Fetch all the topic branches so
|
# This is a TopGit branch. Fetch all the topic branches so
|
||||||
# that builders can run "tg patch" and similar.
|
# that builders can run "tg patch" and similar.
|
||||||
$res = run(cmd => ["tg", "remote", "--populate", "origin"], dir => $clonePath, timeout => $cfg->{timeout});
|
$res = runCommand(cmd => ["tg", "remote", "--populate", "origin"], dir => $clonePath, timeout => $cfg->{timeout});
|
||||||
print STDERR "warning: `tg remote --populate origin' failed:\n$res->{stderr}" if $res->{status};
|
print STDERR "warning: `tg remote --populate origin' failed:\n$res->{stderr}" if $res->{status};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user