From: Jacob Bachmeyer Date: Tue, 27 Jun 2023 01:44:56 +0000 (-0500) Subject: Remove kludge of storing extra messages in the operation list header X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5dc8cbecccacda9190e2d753e9de2a4901c6d6f5;p=gatekeeper.git Remove kludge of storing extra messages in the operation list header Packet objects now have a direct facility for storing extra messages. --- diff --git a/gatekeeper.pl b/gatekeeper.pl index 6b4f862..22abc11 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -1638,9 +1638,14 @@ sub find_package { until substr($file, 0, length $stem) eq $stem; } - bless { files => \@files, stem => $stem }, $class + bless { files => \@files, stem => $stem, notices => [] }, $class } + # store additional messages that should appear in the report + sub add_notice { my $self = shift; push @{$self->{notices}}, @_ } + # return list of messages stored for the report + sub notices { return @{(shift)->{notices}} } + # scaffolding for now... sub files { @{(shift)->{files}} } sub file_name_stem { (shift)->{stem} } @@ -3314,8 +3319,8 @@ foreach my $packet (@packets) { # each list element is an array reference throw processing_error => command => $step, summary => $pubfinal." exists and 'replace' was not selected"; } - push @{$op_header->{notices}}, - "Archived and overwrote $pubfinal with uploaded version"; + $packet->add_notice + ("Archived and overwrote $pubfinal with uploaded version"); } } } @@ -3375,9 +3380,11 @@ foreach my $packet (@packets) { # each list element is an array reference to => \@email_addresses, subject => $op_header->{package}; } else { my @messages = ("upload of $upload_file and $sig_file complete"); - unshift @messages, @{$op_header->{notices}}, '' if $op_header->{notices}; - # The "notices" key in the oplist header is a kludge, but seems to be - # the best immediate step to only send mail during the report phase. + # add notices stored in the packet object... + unshift @messages, $packet->notices, ''; + # ...and remove any leading blank lines... + shift @messages while $messages[0] eq ''; + # ...before sending the report mail join("\n", @messages), to => \@email_addresses, subject => $op_header->{package}; }