This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 50017a6  WHIMSY-236 take account of badrcptto
50017a6 is described below

commit 50017a690ea94038e9c554556e970b22dcec3702
Author: Sebb <[email protected]>
AuthorDate: Tue Feb 12 09:07:23 2019 +0000

    WHIMSY-236 take account of badrcptto
    
    part 2 of 2 use the files when checking ids
---
 lib/whimsy/asf/icla.rb | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/lib/whimsy/asf/icla.rb b/lib/whimsy/asf/icla.rb
index 92d592e..8fd81ab 100644
--- a/lib/whimsy/asf/icla.rb
+++ b/lib/whimsy/asf/icla.rb
@@ -171,12 +171,44 @@ module ASF
         lines.sort_by {|line| lname(line + "\n")}.join("\n") + "\n"
     end
 
+    # list of mails rejected by badrcptto and badrcptto_patterns
+    # Not intended for external use
+    def self.badmails
+      qmc = ASF::SVN['qmail_control']
+      # non-patterns
+      brt = File.join(qmc, 'badrcptto')
+      badmails = File.read(brt).scan(/^(\w.+)@apache\.org\s*$/).flatten
+      # now parse patterns
+      brtpat = File.join(qmc, 'badrcptto_patterns')
+      File.read(brtpat).each_line do |line|
+        m = line.match(/^\^(\w.+)\\@/)
+        if m
+          badmails << m[1]
+          next
+        end
+        # ^(abc|def|ghi)(jkl|mno|pqr)\@
+        m = line.match(/^\^\(([|\w]+)\)\(([|\w]+)\)\\@/)
+        if m
+          m[1].split('|').each do |one|
+            m[2].split('|').each do |two|
+              badmails << "#{one}#{two}"
+            end
+          end
+        else
+          Wunderbar.warn "Error parsing #{brtpat} : could not match #{line}"
+        end
+      end
+      badmails.uniq
+    end
+
     # list of reserved availids
     def self.availids_reserved
       return @@availids_reserved if @@availids_reserved
       archive = ASF::SVN['officers']
       reserved = File.read(File.join(archive, 'reserved-ids.yml')).scan(/^- 
(\S+)/).flatten.uniq
-      @@availids_reserved = reserved
+      # Add in badrcptto
+      reserved += self.badmails
+      @@availids_reserved = reserved.uniq
     end
 
     # list of all availids that are are taken or reserved

Reply via email to