whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Simplify list matching
Date Mon, 15 Feb 2021 11:51:21 GMT
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 24fb123  Simplify list matching
24fb123 is described below

commit 24fb12356861b8d3bb57e143d9979120f6ad0b70
Author: Sebb <sebb@apache.org>
AuthorDate: Mon Feb 15 11:51:12 2021 +0000

    Simplify list matching
    
    Old-style podling lists have all been shut down
---
 lib/whimsy/asf/mlist.rb | 38 ++++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/lib/whimsy/asf/mlist.rb b/lib/whimsy/asf/mlist.rb
index beb65be..00f835b 100644
--- a/lib/whimsy/asf/mlist.rb
+++ b/lib/whimsy/asf/mlist.rb
@@ -121,6 +121,19 @@ module ASF
       response
     end
 
+    # helper function for matching against mod and subs entries
+    # does the target mail_domain match the current list?
+    def self.matches_list?(mail_domain, dom, list)
+        # normal tlp style (now also podlings):
+        #/home/apmail/lists/commons.apache.org/dev/mod
+        #Apache lists (e.g. some non-PMCs)
+        #/home/apmail/lists/apache.org/list/mod
+        return "#{mail_domain}.apache.org" == dom ||
+               (dom == 'apache.org' && 
+                (list == mail_domain || list.start_with?("#{mail_domain}-"))
+               )
+    end
+
     # for a mail domain, extract related lists and their moderators
     # also returns the time when the data was last checked
     # If podling==true, then also check for old-style podling names
@@ -136,16 +149,9 @@ module ASF
         next if list =~ /^infra-[a-z]$/
         next if dom == 'incubator.apache.org' && list =~ /^infra-dev2?$/
 
-        # normal tlp style:
-        #/home/apmail/lists/commons.apache.org/dev/mod
-        # possible podling styles (new, old):
-        #/home/apmail/lists/batchee.apache.org/dev/mod
-        #/home/apmail/lists/incubator.apache.org/blur-dev/mod
-        #Apache lists (e.g. some non-PMCs)
-        #/home/apmail/lists/apache.org/list/mod
-        next unless "#{mail_domain}.apache.org" == dom or
-           (dom == 'apache.org' && list =~ /^#{mail_domain}(-|$)/) or
-           (podling && dom == 'incubator.apache.org' && list =~ /^#{mail_domain}-/)
+        # does the list match our target?
+        next unless matches_list?(mail_domain, dom, list)
+
         moderators["#{list}@#{dom}"] = subs.sort
       end
       return moderators.to_h, (File.mtime(LIST_TIME) rescue File.mtime(LIST_MODS))
@@ -179,16 +185,8 @@ module ASF
         # normal tlp style:
         #/home/apmail/lists/commons.apache.org/dev/mod
 
-        # possible podling styles (new, old):
-        #/home/apmail/lists/batchee.apache.org/dev/mod
-        #/home/apmail/lists/incubator.apache.org/blur-dev/mod
-
-        #Apache lists (e.g. some non-PMCs)
-        #/home/apmail/lists/apache.org/list/mod
-
-        next unless "#{mail_domain}.apache.org" == dom or
-           (dom == 'apache.org' && list =~ /^#{mail_domain}(-|$)/) or
-           (podling && dom == 'incubator.apache.org' && list =~ /^#{mail_domain}-/)
+        # does the list match our target?
+        next unless matches_list?(mail_domain, dom, list)
 
         if skip_archivers
           subscribers["#{list}@#{dom}"] = list_subs ? subs.reject {|sub| is_archiver?(sub)}.sort
: subs.reject {|sub| is_archiver?(sub)}.size


Mime
View raw message