Cleanup
Don't propagate $type unnecessarily.
This commit is contained in:
parent
6c3f878026
commit
65ea71578f
|
@ -100,7 +100,7 @@ sub attrsToSQL {
|
||||||
|
|
||||||
|
|
||||||
sub fetchInputPath {
|
sub fetchInputPath {
|
||||||
my ($db, $project, $jobset, $name, $type, $value) = @_;
|
my ($db, $project, $jobset, $name, $value) = @_;
|
||||||
|
|
||||||
my $uri = $value;
|
my $uri = $value;
|
||||||
|
|
||||||
|
@ -153,8 +153,7 @@ sub fetchInputPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
{ type => $type
|
{ uri => $uri
|
||||||
, uri => $uri
|
|
||||||
, storePath => $storePath
|
, storePath => $storePath
|
||||||
, sha256hash => $sha256
|
, sha256hash => $sha256
|
||||||
, revision => strftime "%Y%m%d%H%M%S", gmtime($timestamp)
|
, revision => strftime "%Y%m%d%H%M%S", gmtime($timestamp)
|
||||||
|
@ -163,7 +162,7 @@ sub fetchInputPath {
|
||||||
|
|
||||||
|
|
||||||
sub fetchInputSVN {
|
sub fetchInputSVN {
|
||||||
my ($db, $project, $jobset, $name, $type, $value, $checkout) = @_;
|
my ($db, $project, $jobset, $name, $value, $checkout) = @_;
|
||||||
|
|
||||||
# Allow users to specify a revision number next to the URI.
|
# Allow users to specify a revision number next to the URI.
|
||||||
my ($uri, $revision) = split ' ', $value;
|
my ($uri, $revision) = split ' ', $value;
|
||||||
|
@ -227,8 +226,7 @@ sub fetchInputSVN {
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
{ type => $type
|
{ uri => $uri
|
||||||
, uri => $uri
|
|
||||||
, storePath => $storePath
|
, storePath => $storePath
|
||||||
, sha256hash => $sha256
|
, sha256hash => $sha256
|
||||||
, revision => $revision
|
, revision => $revision
|
||||||
|
@ -237,7 +235,7 @@ sub fetchInputSVN {
|
||||||
|
|
||||||
|
|
||||||
sub fetchInputBuild {
|
sub fetchInputBuild {
|
||||||
my ($db, $project, $jobset, $name, $type, $value) = @_;
|
my ($db, $project, $jobset, $name, $value) = @_;
|
||||||
|
|
||||||
my ($projectName, $jobsetName, $jobName, $attrs) = parseJobName($value);
|
my ($projectName, $jobsetName, $jobName, $attrs) = parseJobName($value);
|
||||||
$projectName ||= $project->name;
|
$projectName ||= $project->name;
|
||||||
|
@ -264,8 +262,7 @@ sub fetchInputBuild {
|
||||||
my $version = $2 if $relName =~ /^($pkgNameRE)-($versionRE)$/;
|
my $version = $2 if $relName =~ /^($pkgNameRE)-($versionRE)$/;
|
||||||
|
|
||||||
return
|
return
|
||||||
{ type => "build"
|
{ storePath => $prevBuild->outpath
|
||||||
, storePath => $prevBuild->outpath
|
|
||||||
, id => $prevBuild->id
|
, id => $prevBuild->id
|
||||||
, version => $version
|
, version => $version
|
||||||
};
|
};
|
||||||
|
@ -273,7 +270,7 @@ sub fetchInputBuild {
|
||||||
|
|
||||||
|
|
||||||
sub fetchInputSystemBuild {
|
sub fetchInputSystemBuild {
|
||||||
my ($db, $project, $jobset, $name, $type, $value) = @_;
|
my ($db, $project, $jobset, $name, $value) = @_;
|
||||||
|
|
||||||
my ($projectName, $jobsetName, $jobName, $attrs) = parseJobName($value);
|
my ($projectName, $jobsetName, $jobName, $attrs) = parseJobName($value);
|
||||||
$projectName ||= $project->name;
|
$projectName ||= $project->name;
|
||||||
|
@ -302,8 +299,7 @@ sub fetchInputSystemBuild {
|
||||||
my $version = $2 if $relName =~ /^($pkgNameRE)-($versionRE)$/;
|
my $version = $2 if $relName =~ /^($pkgNameRE)-($versionRE)$/;
|
||||||
|
|
||||||
my $input =
|
my $input =
|
||||||
{ type => "sysbuild"
|
{ storePath => $prevBuild->outpath
|
||||||
, storePath => $prevBuild->outpath
|
|
||||||
, id => $prevBuild->id
|
, id => $prevBuild->id
|
||||||
, version => $version
|
, version => $version
|
||||||
, system => $prevBuild->system
|
, system => $prevBuild->system
|
||||||
|
@ -316,7 +312,7 @@ sub fetchInputSystemBuild {
|
||||||
|
|
||||||
|
|
||||||
sub fetchInputGit {
|
sub fetchInputGit {
|
||||||
my ($db, $project, $jobset, $name, $type, $value) = @_;
|
my ($db, $project, $jobset, $name, $value) = @_;
|
||||||
|
|
||||||
(my $uri, my $branch) = split ' ', $value;
|
(my $uri, my $branch) = split ' ', $value;
|
||||||
$branch = defined $branch ? $branch : "master";
|
$branch = defined $branch ? $branch : "master";
|
||||||
|
@ -406,8 +402,7 @@ sub fetchInputGit {
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
{ type => $type
|
{ uri => $uri
|
||||||
, uri => $uri
|
|
||||||
, storePath => $storePath
|
, storePath => $storePath
|
||||||
, sha256hash => $sha256
|
, sha256hash => $sha256
|
||||||
, revision => $revision
|
, revision => $revision
|
||||||
|
@ -416,7 +411,7 @@ sub fetchInputGit {
|
||||||
|
|
||||||
|
|
||||||
sub fetchInputBazaar {
|
sub fetchInputBazaar {
|
||||||
my ($db, $project, $jobset, $name, $type, $value, $checkout) = @_;
|
my ($db, $project, $jobset, $name, $value, $checkout) = @_;
|
||||||
|
|
||||||
my $uri = $value;
|
my $uri = $value;
|
||||||
|
|
||||||
|
@ -479,8 +474,7 @@ sub fetchInputBazaar {
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
{ type => $type
|
{ uri => $uri
|
||||||
, uri => $uri
|
|
||||||
, storePath => $storePath
|
, storePath => $storePath
|
||||||
, sha256hash => $sha256
|
, sha256hash => $sha256
|
||||||
, revision => $revision
|
, revision => $revision
|
||||||
|
@ -489,7 +483,7 @@ sub fetchInputBazaar {
|
||||||
|
|
||||||
|
|
||||||
sub fetchInputHg {
|
sub fetchInputHg {
|
||||||
my ($db, $project, $jobset, $name, $type, $value) = @_;
|
my ($db, $project, $jobset, $name, $value) = @_;
|
||||||
|
|
||||||
(my $uri, my $id) = split ' ', $value;
|
(my $uri, my $id) = split ' ', $value;
|
||||||
$id = defined $id ? $id : "default";
|
$id = defined $id ? $id : "default";
|
||||||
|
@ -549,8 +543,7 @@ sub fetchInputHg {
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
{ type => $type
|
{ uri => $uri
|
||||||
, uri => $uri
|
|
||||||
, branch => $branch
|
, branch => $branch
|
||||||
, storePath => $storePath
|
, storePath => $storePath
|
||||||
, sha256hash => $sha256
|
, sha256hash => $sha256
|
||||||
|
@ -561,45 +554,49 @@ sub fetchInputHg {
|
||||||
|
|
||||||
sub fetchInput {
|
sub fetchInput {
|
||||||
my ($db, $project, $jobset, $name, $type, $value) = @_;
|
my ($db, $project, $jobset, $name, $type, $value) = @_;
|
||||||
|
my $input;
|
||||||
|
|
||||||
if ($type eq "path") {
|
if ($type eq "path") {
|
||||||
return fetchInputPath($db, $project, $jobset, $name, $type, $value);
|
$input = fetchInputPath($db, $project, $jobset, $name, $value);
|
||||||
}
|
}
|
||||||
elsif ($type eq "svn") {
|
elsif ($type eq "svn") {
|
||||||
return fetchInputSVN($db, $project, $jobset, $name, $type, $value, 0);
|
$input = fetchInputSVN($db, $project, $jobset, $name, $value, 0);
|
||||||
}
|
}
|
||||||
elsif ($type eq "svn-checkout") {
|
elsif ($type eq "svn-checkout") {
|
||||||
return fetchInputSVN($db, $project, $jobset, $name, $type, $value, 1);
|
$input = fetchInputSVN($db, $project, $jobset, $name, $value, 1);
|
||||||
}
|
}
|
||||||
elsif ($type eq "build") {
|
elsif ($type eq "build") {
|
||||||
return fetchInputBuild($db, $project, $jobset, $name, $type, $value);
|
$input = fetchInputBuild($db, $project, $jobset, $name, $value);
|
||||||
}
|
}
|
||||||
elsif ($type eq "sysbuild") {
|
elsif ($type eq "sysbuild") {
|
||||||
return fetchInputSystemBuild($db, $project, $jobset, $name, $type, $value);
|
$input = fetchInputSystemBuild($db, $project, $jobset, $name, $value);
|
||||||
}
|
}
|
||||||
elsif ($type eq "git") {
|
elsif ($type eq "git") {
|
||||||
return fetchInputGit($db, $project, $jobset, $name, $type, $value);
|
$input = fetchInputGit($db, $project, $jobset, $name, $value);
|
||||||
}
|
}
|
||||||
elsif ($type eq "hg") {
|
elsif ($type eq "hg") {
|
||||||
return fetchInputHg($db, $project, $jobset, $name, $type, $value);
|
$input = fetchInputHg($db, $project, $jobset, $name, $value);
|
||||||
}
|
}
|
||||||
elsif ($type eq "bzr") {
|
elsif ($type eq "bzr") {
|
||||||
return fetchInputBazaar($db, $project, $jobset, $name, $type, $value, 0);
|
$input = fetchInputBazaar($db, $project, $jobset, $name, $value, 0);
|
||||||
}
|
}
|
||||||
elsif ($type eq "bzr-checkout") {
|
elsif ($type eq "bzr-checkout") {
|
||||||
return fetchInputBazaar($db, $project, $jobset, $name, $type, $value, 1);
|
$input = fetchInputBazaar($db, $project, $jobset, $name, $value, 1);
|
||||||
}
|
}
|
||||||
elsif ($type eq "string") {
|
elsif ($type eq "string") {
|
||||||
die unless defined $value;
|
die unless defined $value;
|
||||||
return {type => $type, value => $value};
|
$input = { value => $value };
|
||||||
}
|
}
|
||||||
elsif ($type eq "boolean") {
|
elsif ($type eq "boolean") {
|
||||||
die unless defined $value && ($value eq "true" || $value eq "false");
|
die unless defined $value && ($value eq "true" || $value eq "false");
|
||||||
return {type => $type, value => $value};
|
$input = { value => $value };
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
die "Input `" . $name . "' has unknown type `$type'.";
|
die "Input `" . $name . "' has unknown type `$type'.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$input->{type} = $type;
|
||||||
|
return $input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -835,7 +832,7 @@ sub checkBuild {
|
||||||
|
|
||||||
$currentBuilds->{$build->id} = 1;
|
$currentBuilds->{$build->id} = 1;
|
||||||
|
|
||||||
if(isValidPath($outPath)) {
|
if (isValidPath($outPath)) {
|
||||||
print STDERR "marked as cached build ", $build->id, "\n";
|
print STDERR "marked as cached build ", $build->id, "\n";
|
||||||
$build->update({ finished => 1 });
|
$build->update({ finished => 1 });
|
||||||
$build->create_related('buildresultinfo',
|
$build->create_related('buildresultinfo',
|
||||||
|
|
Loading…
Reference in a new issue