diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2022-12-28 12:53:30 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2022-12-28 20:08:38 +0000 |
commit | 3cb09a47af3a55f646d7808cd3bb78d0b907b36e (patch) | |
tree | 20eee87918a70281323e4738f03f46c96593b261 /infra/dgit-repos-policy-debian | |
parent | f1112d968a030f9948f3172341611a47bfbb2b44 (diff) |
tainted-objects: Move message construction to module
This will allow us to reuse it.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'infra/dgit-repos-policy-debian')
-rwxr-xr-x | infra/dgit-repos-policy-debian | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/infra/dgit-repos-policy-debian b/infra/dgit-repos-policy-debian index 467a417..fc7f1b1 100755 --- a/infra/dgit-repos-policy-debian +++ b/infra/dgit-repos-policy-debian @@ -471,46 +471,33 @@ END my $ti = $taintinfoq->fetchrow_hashref(); die "($taintid)" unless $ti; - my $timeshow = defined $ti->{time} - ? " at time ".strftime("%Y-%m-%d %H:%M:%S Z", gmtime $ti->{time}) - : ""; - my $pkgshow = length $ti->{package} - ? "package $ti->{package}" - : "any package"; - - $stderr .= <<END; - -History contains tainted $objtype $objid -Taint recorded$timeshow for $pkgshow -Reason: $ti->{comment} -END - printdebug "SQL overrides: @overridesv $taintid /\n$overridesstmt\n"; $overridesq ||= $poldbh->prepare($overridesstmt); $overridesq->execute(@overridesv, $taintid); my ($ovwhy) = $overridesq->fetchrow_array(); + my $ovstatus; if (!defined $ovwhy) { $overridesanyq ||= $poldbh->prepare(<<END); SELECT 1 FROM taintoverrides WHERE taint_id = ? LIMIT 1 END $overridesanyq->execute($taintid); my ($ovany) = $overridesanyq->fetchrow_array(); - $stderr .= $ovany ? <<END : <<END; -Could be forced using --deliberately. Consult documentation. -END -Uncorrectable error. If confused, consult administrator. -END + $ovwhy = $ovany ? '' : undef; $mustreject = 1; } else { - $stderr .= <<END; -Forcing due to $ovwhy -END $untaintq ||= $poldbh->prepare(<<END); DELETE FROM taints WHERE taint_id = ? END $untaintq->execute($taintid); } + + $stderr .= tainted_objects_message { + %$ti, + gitobjid => $objid, + gitobjtype => $objtype, + }, $ovstatus; + } close CHKOUT; |