Add processing phase tag "PV" for directive parsing and validation phase
authorJacob Bachmeyer <jcb@gnu.org>
Wed, 2 Nov 2022 02:02:32 +0000 (21:02 -0500)
committerJacob Bachmeyer <jcb@gnu.org>
Wed, 2 Nov 2022 02:02:32 +0000 (21:02 -0500)
gatekeeper.pl
testsuite/lib/gatekeeper.exp

index 6c6292e1d3426afe87cc1b6b19b55c0a877cda28..12d527de5c245755d74a489fbca3598ac4ee0af2 100755 (executable)
@@ -2414,6 +2414,7 @@ foreach my $packet (@packets) {   # each list element is an array reference
   my $upload_file = ''; my $sig_file = '';
 
   eval {       # trap exceptions encountered while processing a packet
+    local $Phase = 'PV';
     $directive_text = slurp_clearsigned_message($packet->[0]);
     $directive = read_directive_from_string($directive_text);
 
@@ -2445,7 +2446,7 @@ foreach my $packet (@packets) {   # each list element is an array reference
 
     validate_commands($packet, $oplist);
 
-    local $Phase = 'AA';
+    $Phase = 'AA';
     # Check that we have a keyring for this package:
     my @keyrings = directory_keyrings($op_header->{directory});
     fatal("no keyring for package $op_header->{package}",0) if ($#keyrings < 0);
index 68a6f75a48ecc06e917c260fc404ab7851ee4392..c7d4a1c8a57aa8a0075d6e43f08ab4591b86d268 100644 (file)
@@ -612,7 +612,7 @@ proc analyze_log { base_dir name assess } {
                     exp_continue
                 }
 
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 The directory line should start with the name of the package\
                 for which you / are trying to upload a file[^\r\n]+} {
                     # from email_addresses, when the list cannot be opened
@@ -621,102 +621,102 @@ proc analyze_log { base_dir name assess } {
                 }
        # TODO:  This should be validate,package-no-email instead.
 
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 invalid directory[^\r\n]*} {
                     # from parse_directory_line, when the pattern match fails
                     set A(validate,bad-directory) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 ([0-9]+) levels is too deep, in [^\r\n]+} {
                     # from parse_directory_line, when the directory is too deep
                     set A(validate,bad-directory-depth) 1
                     set A(validate,bad-directory-depth,$expect_out(1,string)) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 Only one directory directive is allowed per [^\r\n]+} {
                     # from parse_directory_line, if directory repeated
                     set A(validate,bad-directory-repeat) 1
                     exp_continue
                 }
 
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 directive file ([^ ]+) has no signature} {
                     # from read_directive_file, when signed message is null
                     set A(unsigned-directive) 1
                     set A(unsigned-directive,$expect_out(1,string)) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 invalid directive 'replace', not supported[^\r\n]+} {
                     # from read_directive_file, if replace used in v1.1
                     set A(validate,bad-replace-flag) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 no directory directive specified in [^\r\n]+} {
                     # from read_directive_file, if no directory key found
                     set A(validate,no-directory-given) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 nothing to do - no commands in directive file} {
                     # from read_directive_file, if no action specified
                     set A(validate,no-op) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 invalid version [0-9.]+, not supported} {
                     # from read_directive_file, if unsupported version
                     set A(validate,bad-version) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 invalid version [^\r\n]+} {
                     # from read_directive_file, if unparsable version
                     set A(validate,bad-version) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 invalid multiple version elements} {
                     # from read_directive_file, if version repeated
                     set A(validate,bad-version-repeat) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 no version specified in directive} {
                     # from read_directive_file, if no version given
                     # This was valid in v1 but v1 is now obsolete.
                     set A(validate,no-version) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 invalid filename [^\r\n]+} {
                     # from read_directive_file, if filename is bogus
                     set A(validate,bad-filename) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 Only one filename directive is allowed per [^\r\n]+} {
                     # from read_directive_file, if filename repeated
                     set A(validate,bad-filename-repeat) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 invalid parameters for ([^ ]+) command[^\r\n]+} {
                     # from read_directive_file, when most commands have
                     # unrecognized or invalid parameters
                     set A(validate,bad-parameter,$expect_out(1,string)) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 Invalid directive line:[^\r\n]+} {
                     # from read_directive_file, if a line is unrecognized
                     set A(validate,bad-directive-line) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 no filename directive specified in ([^\r\n]+)[.]\
                 Upgrade to the latest version![^\r\n]+} {
                     # from read_directive_file, if no filename given
@@ -725,7 +725,7 @@ proc analyze_log { base_dir name assess } {
                     set A(validate,no-filename,$expect_out(1,string)) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 no configuration directory for package ([^\r\n]+)} {
                     # from read_directive_file, if package config not found
                     set A(validate,package-no-config) 1
@@ -738,14 +738,14 @@ proc analyze_log { base_dir name assess } {
                     set A(validate,package-no-keys) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 The filename directive does not match name of the\
                 uploaded file.[^\r\n]+} {
                     # from read_directive_file, on name mismatch
                     set A(validate,filename-mismatch) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\) \[PV\]\
                 filename [^\r\n]+ does not match name of directive[^\r\n]+} {
                     # from read_directive_file, on name mismatch
                     set A(validate,filename-mismatch-directive) 1
@@ -770,24 +770,24 @@ proc analyze_log { base_dir name assess } {
                     exp_continue
                 }
 
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:AA|EX)\])?\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:AA|EX|PV)\])?\
                 DEBUG: [^ ]+ size is [[:digit:]]+} {
                     # from verify_keyring, upon entry
                     # also from check_files, twice, upon entry
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:AA|EX)\])?\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:AA|EX|PV)\])?\
                 DEBUG: gpgv command line: [^\r\n]+} {
                     # from verify_keyring, tracing gpgv call
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:AA|EX)\])?\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:AA|EX|PV)\])?\
                 gpgv exited ([[:digit:]]+)} {
                     # from verify_keyring, when closing pipe from gpgv
                     set A(gpgv,exitcode,$expect_out(1,string)) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:AA|EX)\])?\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:AA|EX|PV)\])?\
                 verified against ([^\r\n]+)} {
                     # from verify_keyring, upon success
                     exp_continue
@@ -795,7 +795,7 @@ proc analyze_log { base_dir name assess } {
                     # is likely to be removed when gpgv is given multiple
                     # keyrings instead of being run repeatedly
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:AA|EX)\])?\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:AA|EX|PV)\])?\
                 gpg verify of directive file failed} {
                     # from verify_keyring, when no keys match
                     set A(gpgv,directive-verify-failed) 1
@@ -870,35 +870,35 @@ proc analyze_log { base_dir name assess } {
                     exp_continue
                 }
 
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:RP|EX|AA)\])?\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:RP|EX|AA|PV)\])?\
                 No uploader e-mail address\(es\) to report this error to!} {
                     # from mail, when no email address is provided
                     set A(mail,no-known-address) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:RP|EX|AA)\])?\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:RP|EX|AA|PV)\])?\
                 NOMAIL is set - not sending email to [^\r\n]+} {
                     # from mail, when mail is inhibited
                     set A(mail,inhibited) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:RP|EX|AA)\])?\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:RP|EX|AA|PV)\])?\
                 Sending email to [^\r\n]+} {
                     # from mail, recording address list
                     set A(mail,addresses) 1
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:RP|EX|AA)\])?\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:RP|EX|AA|PV)\])?\
                 Subject: [^\r\n]+} {
                     # from mail, outgoing Subject line
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:RP|EX|AA)\])?\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:RP|EX|AA|PV)\])?\
                 Error uploading package: [^\r\n]+} {
                     # from mail, when a generic failure is reported
                     exp_continue
                 }
-       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:RP|EX|AA)\])?\
+       -re {^gatekeeper\[[0-9]+\]: \(Test\)(?: \[(?:RP|EX|AA|PV)\])?\
                 Body: [^\r\n]+} {
                     # from mail, recording outgoing message body
                     exp_continue