commit-womb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-womb] gnumaint Makefile gm


From: Karl Berry
Subject: [commit-womb] gnumaint Makefile gm
Date: Fri, 15 Feb 2008 01:35:42 +0000

CVSROOT:        /sources/womb
Module name:    gnumaint
Changes by:     Karl Berry <karl>       08/02/15 01:35:42

Modified files:
        .              : Makefile gm 

Log message:
        list maintainers nophysical

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnumaint/Makefile?cvsroot=womb&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnumaint/gm?cvsroot=womb&r1=1.7&r2=1.8

Patches:
Index: Makefile
===================================================================
RCS file: /sources/womb/gnumaint/Makefile,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- Makefile    30 Dec 2007 17:05:09 -0000      1.13
+++ Makefile    15 Feb 2008 01:35:41 -0000      1.14
@@ -32,7 +32,10 @@
 #      gnumaint list packages maintainer karl $(sep)
        gnumaint list packages maintainer arenn $(sep)
 
-test-gm:
+test-nocontact:
+       gm list maintainers nophysical
+
+test-unanswered:
        gm list packages unanswered
 
 test-help:

Index: gm
===================================================================
RCS file: /sources/womb/gnumaint/gm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- gm  12 Feb 2008 18:55:29 -0000      1.7
+++ gm  15 Feb 2008 01:35:41 -0000      1.8
@@ -1,8 +1,8 @@
 #!/usr/bin/env perl
-# $Id: gm,v 1.7 2008/02/12 18:55:29 karl Exp $
+# $Id: gm,v 1.8 2008/02/15 01:35:41 karl Exp $
 # More gnumaint-related stuff, since I think better in Perl than TCL.
 # 
-# Copyright 2007 Free Software Foundation Inc.
+# Copyright 2007, 2008 Free Software Foundation Inc.
 # 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -28,18 +28,13 @@
 
 sub main
 {
-  my $op = $ARGV[2];  # xx just hardwire for now, assume "list packages".
-  
-  my @lines;
-  if ($op eq "bymaintainer") {
-    @lines = &list_packages_bymaintainer ();
-  
-  } elsif ($op eq "unanswered") {
-    @lines = &list_packages_unanswered ();
-
-  } else {
-    die "$0: unknown operation address@hidden'\n";
-  }
+  my $cmd = "list";
+  my $arg1 = $ARGV[1];
+  my $arg2 = $ARGV[2];
+  
+  my $fn = "list_${arg1}_${arg2}";
+  my @lines = eval "&$fn ()";
+  die "$0 failed: address@hidden" if $@;
 
   print map { "$_\n" } @lines;
 
@@ -74,7 +69,7 @@
       }
 
 
-      if ($name =~ /^[a-z]/ && $name ne "unmaintained") {
+      if ($m->{"is_generic"} && $name ne "unmaintained") {
         # Assume that if a name starts with a lowercase letter, it is
         # generic.  If we ever have a maintainer whose real name starts
         # with a lowercase letter, we can invent a field to distinguish.
@@ -135,9 +130,34 @@
 
 
 
-# Read $MAINTAINERS_FILE according to $HOW, at present, just "by-package".
-# We return a hash.  With "by-package", the keys are package names 
-# and the values are a list of maintainer hash references.
+sub list_maintainers_nophysical
+{
+  my @maints = ();
+  my %maints = &read_maintainers ("by-maintainer");
+
+  for my $m (sort keys %maints) {
+    my $m_ref = $maints{$m};
+    my %m = %$m_ref;
+    next if $m{"is_generic"};  # no contact info needed
+    next if $m{"address"} || $m{"phone"};  # have contact info
+    (my $packages = $m{"package"}) =~ tr/|/ /;
+    push (@maints, "$m{best_email} ($m{name} - $packages)");
+  }
+  
+  return @maints;
+}
+
+
+# Read $MAINTAINERS_FILE according to $HOW, either "by-package" or
+# "by-maintainer" We return a hash.  With "by-package", the keys are
+# package names and the values are a list of maintainer hash references.
+# With "by-maintainer", the keys are maintainer names and the value is a
+# hash reference with the maintainer information.
+# 
+# Special maintainer keys we synthesize, that are not in the actual
+# maintainers file: is_generic, for whether it is an actual person or a
+# generic address; best_email, which uses privateemail where present, in
+# preference to email.
 # 
 sub read_maintainers
 {
@@ -153,7 +173,7 @@
   }
   
   # read the real information.
-  my %maint;
+  my %maint;  # info we are accumulating for one maintainer
   while (<MAINTAINERS_FILE>) {
     chomp;
     next if /^#/;  # ignore comments
@@ -161,7 +181,13 @@
     # at a blank line, save the maintainer info we've accumulated, if any.
     if (/^\s*$/) {
       &debug_hash ($., %maint);
-      if (keys %maint) {
+      next unless keys %maint;
+      
+      # record whether this is a generic maintainer.
+      $maint{"is_generic"} = $maint{"name"} =~ m/^[a-z]/;
+      
+      # record best email to use for the maintainer.
+      $maint{"best_email"} = $maint{"privateemail"} || $maint{"email"};
 
         if ($how eq "by-package") {
           # split apart the package value we've accumulated..
@@ -179,12 +205,25 @@
             warn "no packages for $maint{name}";
           }
 
+      } elsif ($how eq "by-maintainer") {
+        if (! exists $maint{"name"}) {
+          warn "no name for maintainer";
+          next;
+        }
+        my $name = $maint{"name"};
+        if (exists $ret{$name}) {
+          warn "ignoring second entry for maintainer $name";
+          next;
+        }
+        my %copy = %maint;
+        $ret{$name} = \%copy;
+
         } else {
           die "can't read_maintainers($how)";
         }
         
         undef %maint;  # clear out for next maintainer.
-      }
+
       last if /^\f$/;  # form feed marks end of info.
       next;
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]