commit-womb
[Top][All Lists]
Advanced

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

[commit-womb] gnumaint gm


From: Karl Berry
Subject: [commit-womb] gnumaint gm
Date: Sun, 20 May 2007 21:51:19 +0000

CVSROOT:        /sources/womb
Module name:    gnumaint
Changes by:     Karl Berry <karl>       07/05/20 21:51:19

Modified files:
        .              : gm 

Log message:
        generate list by package for rms grep purposes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnumaint/gm?cvsroot=womb&r1=1.2&r2=1.3

Patches:
Index: gm
===================================================================
RCS file: /sources/womb/gnumaint/gm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- gm  12 May 2007 23:11:45 -0000      1.2
+++ gm  20 May 2007 21:51:19 -0000      1.3
@@ -1,6 +1,5 @@
 #!/usr/bin/env perl
-# $Id: gm,v 1.2 2007/05/12 23:11:45 karl Exp $
-# Report packages whose maintainer has not responded.
+# $Id: gm,v 1.3 2007/05/20 21:51:19 karl Exp $
 
 $DEBUG = 0;
 $ACTIVITY_FILE = "activity-report.txt";
@@ -11,13 +10,50 @@
 
 sub main
 {
-  my @pkgs = &list_packages_unanswered ();
-  print map { "$_\n" } @pkgs;
+  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 ();
+  }
+
+  print map { "$_\n" } @lines;
+
   return 0;
 }
 
 
 
+# Return all packages with all their maintainers, one maintainer per
+# line, like the original format of the maintainers file.  We run this
+# from cron.
+# 
+sub list_packages_bymaintainer
+{
+  my @ret = ();
+  
+  my %pkgs = &read_maintainers ("by-package");
+  
+  for my $p (sort { lc($a) cmp lc($b) } keys %pkgs) {
+    my @entries = ();
+    for my $m (@{$pkgs{$p}}) {
+      my $entry = "$m->{name}" if exists $m->{"name"};
+      $entry .= " " if $entry;
+      $entry .= "<$m->{email}>" if exists $m->{"email"};
+      push (@entries, $entry);
+    }
+    
+    push (@ret, "$p - " . join (", ", @entries));
+  }
+  
+  return @ret;
+}
+
+
+
 # Return list of packages for whom no maintainer has answered.
 # 
 sub list_packages_unanswered
@@ -52,7 +88,9 @@
 
 
 
-# Read $MAINTAINERS_FILE according to $HOW.
+# 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 read_maintainers
 {
@@ -77,22 +115,22 @@
     if (/^\s*$/) {
       &debug_hash ($., %maint);
       if (keys %maint) {
+
         if ($how eq "by-package") {
-          # split apart package field.
+          # split apart the package value we've accumulated..
           if (exists $maint{"package"}) {
-            my @pkgs = ();
-            if ($maint{"package"} =~ /\|/) {
-              @pkgs = split (/\|/, $maint{"package"});
-            } else {
-              $pkgs[0] = $maint{"package"};  # only one.
-            }
-            #&debug_hash ($maint{package}, %maint);
+            my @pkgs = split (/\|/, $maint{"package"});
 
-            # xx for now, don't worry about overwriting.
+            # append this maintainer to the list for each of his/her packages.
+            # no doubt this could be done with hairier syntax.
             my %copy = %maint;
-            $ret{$_} = \%copy foreach @pkgs;
+            for my $p (@pkgs) {
+              my @x = exists $ret{$p} ? @{$ret{$p}} : ();
+              push (@x, \%copy);
+              $ret{$p} = address@hidden;
+            }
           } else {
-            warn "no packages";
+            warn "no packages for $maint{name}";
           }
 
         } else {




reply via email to

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