Use operation list header instead of %info hash in read_directive_file
authorJacob Bachmeyer <jcb@gnu.org>
Wed, 19 Oct 2022 02:50:12 +0000 (21:50 -0500)
committerJacob Bachmeyer <jcb@gnu.org>
Wed, 19 Oct 2022 02:50:12 +0000 (21:50 -0500)
gatekeeper.pl

index 5ee31bbba62097dcf3870241fd36a24919b0d587..f95372cf0c30f256f17bdb845ca79b0320a4876a 100755 (executable)
@@ -1490,7 +1490,8 @@ sub read_directive_file {
   push(@{$info{email}},$1)
     if ($tmp_retval =~ /Good signature from .*?<(.*?)>/);
 
-  my @ops = interpret_directive($directive, $directive_file_contents);
+  my $ops = interpret_directive($directive, $directive_file_contents);
+  my $op_header = $ops->[0][1];
 
   if (exists($info{"replace"}) && ($info{"version"} eq '1.1')) {
     fatal("invalid directive 'replace', not supported prior to version 1.2",
@@ -1500,14 +1501,14 @@ sub read_directive_file {
   # Phone home. E-mail the contents of the directive file to the maintainer,
   # for debugging purposes. After this point, we don't need to pass the
   # $directive_file_contents to any subsequent fatal calls.
-  if (defined $info{'package'}) {
-    debug($directive_file_contents, $info{'package'}) if DEBUG;
+  if (defined $op_header->{package}) {
+    debug($directive_file_contents, $op_header->{package}) if DEBUG;
   } else {
     debug($directive_file_contents, '') if DEBUG;
   }
 
   # They have to specify a directory directive.
-  if (!$info{"directory"}) {
+  unless ($op_header->{directory}) {
     # Send the warning to the upload-ftp script maintainer, and the person who
     # signed the file, if we were able to extract that from the signature on
     # the directive file.
@@ -1554,11 +1555,11 @@ sub read_directive_file {
   }
 
   # Configuration must exist for the package
-  -d $package_config_base . '/' . $info{"package"}
-    or fatal("no configuration directory for package $info{package}",0);
+  -d $package_config_base . '/' . $op_header->{package}
+    or fatal("no configuration directory for package $op_header->{package}",0);
 
   # Check that we have a keyring for this package:
-  my @keyrings = keyring_file ($info{package},$info{directory});
+  my @keyrings = keyring_file ($op_header->{package},$op_header->{directory});
   fatal("no keyring for package $info{package}",0) if ($#keyrings < 0);
 
   if ($filename_required) {
@@ -1587,7 +1588,7 @@ sub read_directive_file {
 
   # They have to specify a version
   fatal("no version directive specified in $directive_file",1)
-    if ! $info{"version"};
+    unless defined $op_header->{version};
 
   my $retval = verify_keyring($directive_file,$directive_file_contents,
                              @keyrings);