From da68da5ebaab39d28422c3305f38c3420bbceae3 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Thu, 17 Nov 2022 21:58:17 -0600 Subject: [PATCH] Merge execute_commands into top-level --- gatekeeper.pl | 55 ++++++++++++++++++--------------------------------- 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index 3660c00..6c13798 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -2611,40 +2611,6 @@ sub execute_rmsymlink { "removed symlink $step->[1] in ".File::Spec::Unix->catdir(@$directory); } -=item execute_commands ( $oplist ) - -Execute the commands in OPLIST. - -=cut - -sub execute_commands { - my $oplist = shift; - - our $Scratch_dir; our $Public_dir; - - abort "invalid internal operation list" - unless $oplist->[0][0] eq 'header'; - my $header = $oplist->[0][1]; - my @directory = File::Spec::Unix->splitdir($header->{directory}); - - foreach my $step (@{$oplist}[1..$#$oplist]) { # skip the header - if ($step->[0] eq 'install') { - install_files($header, $step); - } elsif ($step->[0] eq 'symlink') { - execute_symlink(\@directory, $step); - } elsif ($step->[0] eq 'rmsymlink') { - execute_rmsymlink(\@directory, $step); - } elsif ($step->[0] eq 'archive') { - # We now also allow archiving entire directories - archive_filepair(\@directory, $step->[1]); - } elsif (IN_TEST_MODE && $step->[0] eq 'no-op') { - # do nothing - } else { - abort "unknown internal operation: $step->[0]"; - } - } -} - =back @@ -2831,8 +2797,25 @@ foreach my $packet (@packets) { # each list element is an array reference if find_directive_elements($directive, 'filename'); $Phase = 'EX'; - # do the work - execute_commands($oplist); + + my @directory = File::Spec::Unix->splitdir($op_header->{directory}); + + foreach my $step (@{$oplist}[1..$#$oplist]) { # skip the header + if ($step->[0] eq 'install') { + install_files($op_header, $step); + } elsif ($step->[0] eq 'symlink') { + execute_symlink(\@directory, $step); + } elsif ($step->[0] eq 'rmsymlink') { + execute_rmsymlink(\@directory, $step); + } elsif ($step->[0] eq 'archive') { + # We now also allow archiving entire directories + archive_filepair(\@directory, $step->[1]); + } elsif (IN_TEST_MODE && $step->[0] eq 'no-op') { + # do nothing + } else { + abort "unknown internal operation: $step->[0]"; + } + } $complete = 1; }; -- 2.25.1