From fe6c62b9fa5988d78911d07e228a371f5398437e Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Mon, 26 Jun 2023 20:36:09 -0500 Subject: [PATCH] Add accessor method to packet object for "replace" option --- gatekeeper.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index ab485e9..6b4f862 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -1646,6 +1646,7 @@ sub find_package { sub file_name_stem { (shift)->{stem} } sub has_uploaded_file { return 0 } + sub allow_overwrite { return 0 } sub target_directory; sub target_filename; @@ -1687,8 +1688,9 @@ sub find_package { ::validate_directive($self, $self->{oplist}); } - sub target_directory { (shift)->{oplist}->[0][1]->{directory} } - sub target_filename { (shift)->{oplist}->[0][1]->{filename} } + sub allow_overwrite { (shift)->{oplist}->[0][1]->{options}{replace} } + sub target_directory { (shift)->{oplist}->[0][1]->{directory} } + sub target_filename { (shift)->{oplist}->[0][1]->{filename} } sub target_filepair { my $filename = (shift)->target_filename; @@ -3308,7 +3310,7 @@ foreach my $packet (@packets) { # each list element is an array reference (CONF_DIR_Public, @directory, $install_as.'.sig'); if (-e $final_signature || -e $final_upload) { - unless ($op_header->{options}{replace}) { + unless ($packet->allow_overwrite) { throw processing_error => command => $step, summary => $pubfinal." exists and 'replace' was not selected"; } -- 2.25.1