foreach my $packet (@packets) { # each list element is an array reference
# variables preserved for the report if an exception is thrown
- my $directive_text; my $directive; my $oplist;
+ my $directive_text; my $oplist;
my $dsig_info; # directive signature information
my $fsig_info; # file signature information
my $complete = 0; # direct flag to indicate successful processing
- # scaffolding to be cleaned up as the internal API is improved
- my $directive_only = not $packet->has_uploaded_file;
- my $directive_file = $packet->directive_file_name;
- my $upload_file = ''; my $sig_file = '';
-
- unless ($directive_only) {
- foreach ($packet->files) {
- if (m/[.]sig$/) { $sig_file =$_ } else { $upload_file = $_ }
- }
- }
-
eval { # trap exceptions encountered while processing a packet
local $Phase = 'PS';
# scaffolding to be cleaned up later
$directive_text = $packet->{directive_text};
- $directive = $packet->{directive};
$oplist = $packet->{oplist};
$Phase = 'AA';
# If the upload carries a file, check it for known Automake CVE issues.
check_automake_vulnerabilities
(File::Spec->catfile(CONF_DIR_Scratch, $packet->target_filename))
- if find_directive_elements($directive, 'filename');
+ if $packet->has_uploaded_file;
my @directory = File::Spec::Unix->splitdir($packet->target_directory);
$Phase = 'EX';
# If the upload carries a file, transfer (with signature) to staging area.
- if (find_directive_elements($directive, 'filename')) {
+ if ($packet->has_uploaded_file) {
# Do we need a subdirectory on CONF_DIR_Staging as well? Can't quite
# picture when we'd have a collision, so skip that for now.
move_filepair
if $fsig_info;
# report success
- if ($directive_only) {
- mail "processing of $directive_file complete",
+ if (not $packet->has_uploaded_file) {
+ mail 'processing of '.$packet->directive_file_name.' complete',
to => \@email_addresses, subject => $packet->target_package;
} else {
- my @messages = ("upload of $upload_file and $sig_file complete");
+ my @messages =
+ ('upload of '.join(' and ', $packet->target_filepair).' complete');
# add notices stored in the packet object...
unshift @messages, $packet->notices, '';
# ...and remove any leading blank lines...
}
# unlink the directive file
- unlink File::Spec->catfile(CONF_DIR_Scratch, $directive_file)
- or warn "unlink($directive_file) failed: $!";
+ unlink File::Spec->catfile(CONF_DIR_Scratch, $packet->directive_file_name)
+ or warn 'unlink('.$packet->directive_file_name.') failed: '.$!;
} else {
local $Phase = 'RP';
}
# clean up files if we abort while processing a triplet
- cleanup ($sig_file, $upload_file, $directive_file)
+ cleanup ($packet->files)
}
}