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 f15a263  Archiver listing checks
f15a263 is described below

commit f15a26328356c9c3e0428d204948f329c422556a
Author: Sebb <[email protected]>
AuthorDate: Mon Jan 21 22:41:53 2019 +0000

    Archiver listing checks
---
 www/index.html            |   3 +-
 www/members/archivers.cgi | 126 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 128 insertions(+), 1 deletion(-)

diff --git a/www/index.html b/www/index.html
index b7b9f5e..2538132 100644
--- a/www/index.html
+++ b/www/index.html
@@ -169,7 +169,8 @@
                 <li><a href="members/whatif">STV Explorer</a></li>
                 <li><a href="members/proxy">Proxy form (ASF members 
meeting)</a></li>
                 <li><a href="members/security-subs">Security Mailing List 
Subscriptions</a></li>
-              </ul>
+                <li><a href="members/archivers">CrossCheck of Archiver 
Subscriptions (issues only)</a></li>
+                <li><a href="members/archivers/all">CrossCheck of Archiver 
Subscriptions (all entries)</a></li>
             </div>
           </div>
         </div>
diff --git a/www/members/archivers.cgi b/www/members/archivers.cgi
new file mode 100755
index 0000000..54a8854
--- /dev/null
+++ b/www/members/archivers.cgi
@@ -0,0 +1,126 @@
+#!/usr/bin/env ruby
+
+PAGETITLE = "Archivers Subscription Crosscheck" # Wvisible:members
+$LOAD_PATH.unshift '/srv/whimsy/lib'
+
+require 'wunderbar'
+require 'whimsy/asf'
+require 'whimsy/asf/mlist'
+require 'wunderbar/bootstrap'
+require 'wunderbar/jquery/stupidtable'
+
+ids={}
+binarchives = ASF::Mail.lists(true)
+show_all = (ENV['PATH_INFO'] == '/all')
+
+_html do
+  _body? do
+    _whimsy_body(
+      title: PAGETITLE,
+      related: {
+        '/committers/moderationhelper' => 'Mail List Moderation Helper',
+        'https://lists.apache.org' => 'Apache Ponymail List Archives',
+      },
+      helpblock: -> {
+        _p! do
+          _ 'This script compares bin/.archives with the list of archiver 
addresses that are subscribed to mailing lists'
+          _br
+          _ 'Every entry in bin/.archives should have up to 3 archive 
subscribers, except for the mail aliases, which are not lists.'
+          _br
+          _ 'Every mailing list should have an entry in bin/.archives'
+          _br
+          _ 'Unexpected/missing entries are flagged'
+          _br
+          _ 'Minotaur emails can be either aliases 
([email protected]) or direct 
([email protected]).'
+        end
+      }
+    ) do
+      
+    _table.table do
+      _tr do
+        _th 'id', data_sort: 'string'
+        _th 'list', data_sort: 'string'
+        _th 'Private?', data_sort: 'string'
+        _th 'MINO'
+        _th 'MBOX'
+        _th 'PONY'
+        _th 'Archivers', data_sort: 'string'
+      end
+      ASF::MLIST.list_archivers do |dom, list, arcs|
+
+        id = ASF::Mail.archivelistid(dom, list)
+
+        ids[id] = 1 # TODO check for duplicates
+
+        options = Hash.new # Any fields have warnings/errors?
+
+        pubprv = binarchives[id]
+
+        mino = arcs.select{|e| e[1] == :MINO}.map{|e| e[2]}.first
+        if mino
+          options[:mino]={class: 'info'} unless mino == 'alias'
+        else
+          mino = 'Missing'
+          options[:mino]={class: 'warning'}
+        end 
+        
+        mbox = arcs.select{|e| e[1] == :MBOX}.map{|e| e[2]}.first
+        if mbox
+          options[:mbox] = {class: 'danger'} if pubprv && mbox != pubprv  
+        else
+          mbox = 'Missing'
+          options[:mbox] = {class: 'warning'}
+        end
+
+        pony = arcs.select{|e| e[1] == :PONY}.map{|e| e[2]}.first
+        if pony
+          options[:pony] = {class: 'danger'} if pubprv && pony != pubprv  
+        else
+          pony = 'Missing'
+          options[:pony] = {class: 'warning'}
+        end
+
+          
+        # must be done last
+        unless pubprv
+          pubprv = 'Not listed in bin/.archives'
+          options[:pubprv] = {class: 'warning'} 
+        end
+
+        next unless show_all || options.keys.length > 0 # only show errors 
unless want all
+
+        _tr do
+          _td id
+          _td! do
+            _ list
+            _ '@'
+            _ dom
+          end
+          
+          _td pubprv, options[:pubprv]
+          _td mino, options[:mino]
+          _td mbox, options[:mbox]
+          _td pony, options[:pony]
+          _td arcs.map{|e| e.first}.sort
+        end
+      end
+    end
+
+    _p do
+      _ 'The following entries in bin/.archives do not appear to have an 
associated mailing list (probably they are aliases):'
+      _br
+      _ (binarchives.keys - ids.keys)
+    end    
+    _script %{
+      var table = $(".table").stupidtable();
+      table.on("aftertablesort", function (event, data) {
+        var th = $(this).find("th");
+        th.find(".arrow").remove();
+        var dir = $.fn.stupidtable.dir;
+        var arrow = data.direction === dir.ASC ? "&uarr;" : "&darr;";
+        th.eq(data.column).append('<span class="arrow">' + arrow +'</span>');
+        });
+      }
+    end
+  end
+end

Reply via email to