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 /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 'Debian')
-rw-r--r-- | Debian/Dgit.pm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 829725c..25a149f 100644 --- a/Debian/Dgit.pm +++ b/Debian/Dgit.pm @@ -82,6 +82,7 @@ BEGIN { $negate_harmful_gitattrs changedir git_slurp_config_src gdr_ffq_prev_branchinfo + tainted_objects_message parsecontrolfh parsecontrol parsechangelog getfield parsechangelog_loop playtree_setup playtree_write_gbp_conf); @@ -951,6 +952,44 @@ sub reflog_cache_lookup ($$) { return undef; } +sub tainted_objects_message ($$) { + my ($ti, $override_status) = @_; + # $override_status: + # undef, not overriddeable + # '', not overridden + # $deliberately, overridden + + my $msg = ''; + + 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"; + + $msg .= <<END; + +History contains tainted $ti->{gitobjtype} $ti->{gitobjid} +Taint recorded$timeshow for $pkgshow +Reason: $ti->{comment} +END + + $msg .= + !defined $override_status ? <<END +Uncorrectable error. If confused, consult administrator. +END + : !length $override_status ? <<END +Could be forced using --deliberately. Consult documentation. +END + : <<END; +Forcing due to $override_status +END + + return $msg; +} + # ========== playground handling ========== # terminology: |