Skip to content

Commit

Permalink
Merge pull request #14151 from mlschroe/master
Browse files Browse the repository at this point in the history
[backend] set repo to broken if there is an error in the project config
  • Loading branch information
mlschroe committed Apr 13, 2023
2 parents 74a3e7a + 87a84fd commit f5344ed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/backend/BSRepServer/Checker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ sub setup {
die("no repo $repoid in project $projid?\n") unless $repo;
$ctx->{'repo'} = $repo;
my $bconf = $ctx->getconfig($projid, $repoid, $myarch, $ctx->{'prpsearchpath'});
die("project config: $bconf->{'parse_error'}\n") if $bconf->{'parse_error'} && !$BSConfig::ignore_project_config_errors;
$ctx->{'conf'} = $bconf;
my $crosshostarch;
if ($repo->{'hostsystem'}) {
Expand All @@ -116,6 +117,7 @@ sub setup {
die("crosshostarch mismatch\n") if ($repo->{'crosshostarch'} || '') ne ($crosshostarch || '');
if ($crosshostarch && $crosshostarch ne $myarch) {
my $bconf_host = $ctx->getconfig($projid, $repoid, $crosshostarch, $ctx->{'prpsearchpath_host'});
die("cross project config: $bconf_host->{'parse_error'}\n") if $bconf_host->{'parse_error'} && !$BSConfig::ignore_project_config_errors;
$ctx->{'conf_host'} = $bconf_host;
}
my $pdatas = $projpacks->{$projid}->{'package'};
Expand Down
2 changes: 2 additions & 0 deletions src/backend/BSSched/Checker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ sub setup {
return ('broken', "no config ($lastprojid)");
}
$ctx->{'conf'} = $bconf;
return ('broken', "project config: $bconf->{'parse_error'}") if $bconf->{'parse_error'} && !$BSConfig::ignore_project_config_errors;
if ($bconf->{'hostarch'} && !$BSCando::knownarch{$bconf->{'hostarch'}}) {
return ('broken', "bad hostarch ($bconf->{'hostarch'})");
}
Expand Down Expand Up @@ -400,6 +401,7 @@ sub setup {
my $lastprojid = (split('/', $prpsearchpath_host->[-1]))[0];
return ('broken', "no config ($lastprojid)");
}
return ('broken', "cross project config: $bconf_host->{'parse_error'}") if $bconf_host->{'parse_error'} && !$BSConfig::ignore_project_config_errors;
if ($bconf_host->{'hostarch'} && $bconf_host->{'hostarch'} ne $bconf->{'hostarch'}) {
return ('broken', "$bconf->{'hostarch'} is not native");
}
Expand Down
8 changes: 8 additions & 0 deletions src/backend/bs_srcserver
Original file line number Diff line number Diff line change
Expand Up @@ -1746,6 +1746,10 @@ sub getprojpack {
$rinfo->{'error'} = $conf->{'error'};
next;
}
if ($conf->{'parse_error'} && !$BSConfig::ignore_project_config_errors && $cgi->{'buildinfo'}) {
$rinfo->{'error'} = $conf->{'parse_error'};
next;
}
if ($repo->{'hostsystem'}) {
$repo->{'crosshostarch'} = $conf->{'hostarch'} || $arch;
my $path = $expandedrepos{"$projid/$repoid/hostsystem"};
Expand Down Expand Up @@ -1782,6 +1786,10 @@ sub getprojpack {
$rinfo->{'error'} = $conf->{'error'};
next;
}
if ($conf->{'parse_error'} && !$BSConfig::ignore_project_config_errors && $cgi->{'buildinfo'}) {
$rinfo->{'error'} = $conf->{'parse_error'};
next;
}
if ($conf->{'hostarch'} && $conf->{'hostarch'} ne $arch) {
$rinfo->{'error'} = "native arch confusion: $conf->{'hostarch'}";
next;
Expand Down

0 comments on commit f5344ed

Please sign in to comment.