commit-womb
[Top][All Lists]
Advanced

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

[commit-womb] gnumaint Makefile sendmaintmail gm recentrel.tx...


From: Karl Berry
Subject: [commit-womb] gnumaint Makefile sendmaintmail gm recentrel.tx...
Date: Thu, 10 May 2007 01:28:27 +0000

CVSROOT:        /sources/womb
Module name:    gnumaint
Changes by:     Karl Berry <karl>       07/05/10 01:28:27

Modified files:
        .              : Makefile sendmaintmail 
Added files:
        .              : gm recentrel.txt 
Removed files:
        .              : recent.rel 

Log message:
        utility

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnumaint/Makefile?cvsroot=womb&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/gnumaint/sendmaintmail?cvsroot=womb&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnumaint/gm?cvsroot=womb&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnumaint/recentrel.txt?cvsroot=womb&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnumaint/recent.rel?cvsroot=womb&r1=1.3&r2=0

Patches:
Index: Makefile
===================================================================
RCS file: /sources/womb/gnumaint/Makefile,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- Makefile    30 Apr 2007 01:00:15 -0000      1.11
+++ Makefile    10 May 2007 01:28:27 -0000      1.12
@@ -4,6 +4,8 @@
 # are permitted in any medium without royalty provided the copyright
 # notice and this notice are preserved.
 
+default: test-gm
+
 test-rece:
 #      gnumaint recemail </etc/issue
 #      gnumaint recemail <testjunk1.msg
@@ -30,6 +32,9 @@
 #      gnumaint list packages maintainer karl $(sep)
        gnumaint list packages maintainer arenn $(sep)
        
+test-gm:
+       gm list packages unanswered
+
 test-help:
        gnumaint help sendemail $(sep)
        gnumaint help list $(sep)

Index: sendmaintmail
===================================================================
RCS file: /sources/womb/gnumaint/sendmaintmail,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- sendmaintmail       21 Mar 2007 18:19:50 -0000      1.3
+++ sendmaintmail       10 May 2007 01:28:27 -0000      1.4
@@ -1,5 +1,5 @@
 #!/usr/bin/env perl
-# $Id: sendmaintmail,v 1.3 2007/03/21 18:19:50 karl Exp $
+# $Id: sendmaintmail,v 1.4 2007/05/10 01:28:27 karl Exp $
 # Send or refrain from sending a message to a maintainer.
 # 
 # Copyright 2007 Free Software Foundation Inc.
@@ -62,7 +62,9 @@
   #
   for my $a (@activity) {
     my ($email,$pkg,$time) = split (/\|/, $a);
+    next unless $time;         # last_sendemail has two fields
     $time =~ tr/./ /;  # date -d wants a space between date and time
+    substr ($time,13,2) = "";  # wipe out seconds, date -d can't handle
     chomp (my $seconds = `date +%s -d "$time"`);
     last if $seconds < $cutoff;
     
@@ -78,7 +80,8 @@
   
   #warn "would send mail";
   local *SENDMAIL;
-  $SENDMAIL = "|/usr/lib/sendmail -t";
+#  $SENDMAIL = "|/usr/lib/sendmail -t";
+  $SENDMAIL = "|cat >&2";
   open (SENDMAIL) || die "open($SENDMAIL) failed: $!";
   print SENDMAIL @msg;
   close (SENDMAIL) || warn "close($SENDMAIL) failed: $!";

Index: gm
===================================================================
RCS file: gm
diff -N gm
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gm  10 May 2007 01:28:27 -0000      1.1
@@ -0,0 +1,198 @@
+#!/usr/bin/env perl
+# $Id: gm,v 1.1 2007/05/10 01:28:27 karl Exp $
+# Report packages whose maintainer has not responded.
+
+$DEBUG = 0;
+$ACTIVITY_FILE = "activity-report.txt";
+$MAINTAINERS_FILE = "m.link";
+$RECENTREL_FILE = "recentrel.txt";
+
+exit (&main ());
+
+sub main
+{
+  my @pkgs = &list_packages_unanswered ();
+  print map { "$_\n" } @pkgs;
+  return 0;
+}
+
+
+
+# Return list of packages for whom no maintainer has answered.
+# 
+sub list_packages_unanswered
+{
+  my @recentrel = &read_recentrel ();
+  my %activity = &read_activity ("by-package");
+  my %pkgs = &read_maintainers ("by-package");
+  my @pkgs = ();
+  
+  for my $p (sort { lc($a) cmp lc($b) } keys %pkgs) {
+    #&debug_hash ("$p", $pkgs{$p});
+
+    if (0 && grep { $p eq $_ } @recentrel) {
+      &debug ("$p recently released, skipping");
+
+    } elsif (0 && exists $activity{$p}) {
+      # xx have to only check back to a certain date eventually
+      &debug ("$p got activity reply, skipping");
+
+    } elsif (0 && $pkgs{$p}->{"name"} eq "unmaintained") {
+      # xx have to only check back to a certain date eventually
+      &debug ("$p unmaintained, skipping");
+
+    } else {
+      &debug ("$p no activity, returning");
+      push (@pkgs, $p);
+    }
+  }
+  
+  return @pkgs;
+}
+
+
+
+# Read $MAINTAINERS_FILE according to $HOW.
+# 
+sub read_maintainers
+{
+  my ($how) = @_;
+  my %ret;
+  
+  open (MAINTAINERS_FILE) || die "open($MAINTAINERS_FILE) failed: $!";
+
+  # ignore first part of maintainers, through the first form feed.
+  while (<MAINTAINERS_FILE>) {
+    chomp;
+    last if /^\f$/;
+  }
+  
+  # read the real information.
+  my %maint;
+  while (<MAINTAINERS_FILE>) {
+    chomp;
+    
+    # at a blank line, save the maintainer info we've accumulated, if any.
+    if (/^\s*$/) {
+      if (keys %maint) {
+        if ($how eq "by-package") {
+          # split apart package field.
+          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);
+
+            # xx for now, don't worry about overwriting.
+            my %copy = %maint;
+            $ret{$_} = \%copy foreach @pkgs;
+          } else {
+            warn "no packages";
+          }
+
+        } else {
+          die "can't read_maintainers($how)";
+        }
+        
+        undef %maint;  # clear out for next maintainer.
+      }
+      last if /^\f$/;  # form feed marks end of info.
+    }
+
+    # key is everything before the first colon.
+    # value is everything after the first colon and whitespace.
+    my ($key,$val) = split (/:\s*/, $_, 2);
+    
+    # if key already exists, use | to separate values.
+    $val = "$maint{$key}|$val" if exists $maint{$key};
+    
+    # xx eventually parse key of address+ and append.
+    $maint{$key} = $val;
+  }
+  
+  # skip the rest.
+  close (MAINTAINERS_FILE) || warn "close($MAINTAINERS) failed: $!";
+  
+  return %ret;
+}
+
+
+
+# Return hash of $ACTIVITY_FILE according to HOW:
+# if "by-package", keys are package names and values are strings "email|time";
+# if "by-email", keys are email address and values are strings "pkg|time".
+# Latest entry is what counts.
+# 
+sub read_activity
+{
+  my ($how) = @_;
+  my %ret;
+  
+  open (ACTIVITY_FILE) || die "open($ACTIVITY_FILE) failed: $!";
+  while (<ACTIVITY_FILE>) {
+    my ($email,$pkg,$time) = split (/\|/);
+
+    # later entries will simply overwrite earlier ones; seems ok?
+    if ($how eq "by-package") {
+      $ret{$pkg} = "$email|$time";
+    } elsif ($how eq "by-email") {
+      $ret{$email} = "$pkg|$time";
+    } else {
+      die "can't read_activity($how)";
+    }
+  }
+  close (ACTIVITY_FILE) || warn "close($ACTIVITY) failed: $!";
+  
+  return %ret;
+}
+
+
+
+# Return list of entries in $RECENTREL_FILE -- one per line, ignoring
+# comments starting with # and blank lines.
+# 
+sub read_recentrel
+{
+  my @ret;
+  
+  open (RECENTREL_FILE) || die "open($RECENTREL_FILE) failed: $!";
+  while (<RECENTREL_FILE>) {
+    next if /^\s*#/;  # ignore comments
+    next if /^\s*$/;  # ignore blank lines.
+    chomp;
+    push (@ret, @_)
+  }
+  close (RECENTREL_FILE) || warn "close($RECENTREL) failed: $!";
+ 
+  return @ret;
+}
+
+
+
+# print arg on stderr.
+sub debug { warn "$_[0]\n" if $DEBUG; }
+
+# Log LABEL followed by hash elements, all on one line.
+# 
+sub debug_hash
+{
+  my ($label) = shift;
+  my (%hash) = (ref $_[0] && $_[0] =~ /.*HASH.*/) ? %{$_[0]} : @_;
+
+  my $str = "$label: {";
+  my @items = ();
+  for my $key (sort keys %hash) {
+    my $val = $hash{$key};
+    $key =~ s/\n/\\n/g;
+    $val =~ s/\n/\\n/g;
+    push (@items, "$key:$val");
+  }
+  $str .= join (",", @items);
+  $str .= "}";
+
+  warn "$str\n" if $DEBUG;
+}
+

Index: recentrel.txt
===================================================================
RCS file: recentrel.txt
diff -N recentrel.txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ recentrel.txt       10 May 2007 01:28:27 -0000      1.1
@@ -0,0 +1,46 @@
+# released only, no announcement
+gnuradio
+commoncpp
+gcc
+solfege
+smalltalk
+nano
+global
+kawa
+bayonne
+ccscript
+tramp
+gprolog
+libextractor
+gnunet
+ccrtp
+aspell
+gdb
+bpel2owfn
+libcdio
+gettext
+ccaudio
+gettext
+radius
+autoconf
+units
+gnujump
+osip
+mailutils
+inetutils
+cpio
+groff
+jel
+electric
+glibc
+erc
+parted
+ed
+reftex
+bash
+findutils
+libmatheval
+gsl
+glpk
+autogen
+coreutils

Index: recent.rel
===================================================================
RCS file: recent.rel
diff -N recent.rel
--- recent.rel  22 Mar 2007 23:05:44 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,46 +0,0 @@
-# released only, no announcement
-gnuradio
-commoncpp
-gcc
-solfege
-smalltalk
-nano
-global
-kawa
-bayonne
-ccscript
-tramp
-gprolog
-libextractor
-gnunet
-ccrtp
-aspell
-gdb
-bpel2owfn
-libcdio
-gettext
-ccaudio
-gettext
-radius
-autoconf
-units
-gnujump
-osip
-mailutils
-inetutils
-cpio
-groff
-jel
-electric
-glibc
-erc
-parted
-ed
-reftex
-bash
-findutils
-libmatheval
-gsl
-glpk
-autogen
-coreutils




reply via email to

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