[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-womb] gnumaint gnumaint template-active.txt recent.re...
From: |
Karl Berry |
Subject: |
[Commit-womb] gnumaint gnumaint template-active.txt recent.re... |
Date: |
Wed, 07 Mar 2007 17:47:22 +0000 |
CVSROOT: /sources/womb
Module name: gnumaint
Changes by: Karl Berry <karl> 07/03/07 17:47:22
Modified files:
. : gnumaint template-active.txt
Added files:
. : recent.rel sendmaintmail
Log message:
omission of recently active maintainers/packages
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnumaint/gnumaint?cvsroot=womb&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnumaint/template-active.txt?cvsroot=womb&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnumaint/recent.rel?cvsroot=womb&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnumaint/sendmaintmail?cvsroot=womb&rev=1.1
Patches:
Index: gnumaint
===================================================================
RCS file: /sources/womb/gnumaint/gnumaint,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- gnumaint 19 Feb 2007 00:07:04 -0000 1.32
+++ gnumaint 7 Mar 2007 17:47:22 -0000 1.33
@@ -1,6 +1,6 @@
#!/usr/bin/env tclsh
# gnumaint - GNU maintainers file maintenance (/gd/gnuorg/maintainers)
-# $Id: gnumaint,v 1.32 2007/02/19 00:07:04 karl Exp $
+# $Id: gnumaint,v 1.33 2007/03/07 17:47:22 karl Exp $
#
# Copyright 2007 Free Software Foundation Inc.
#
@@ -26,11 +26,11 @@
variable mailtemplate_active "template-active.txt"
variable log_file "email.log"
variable report_file "activity-report.txt"
-variable discarded_email "discarded-email.txt"
-variable processed_email "processed-email.txt"
+variable discarded_mbox "discarded-email.mbox"
+variable processed_mbox "processed-email.mbox"
+variable sent_mbox "sent-email.mbox"
variable formail "/usr/bin/formail"
-variable sendmail "/usr/sbin/sendmail"
-variable lockfile_command "/usr/bin/lockfile"
+variable sendmail "sendmaintmail"
variable email_originator "address@hidden"
variable email_reply "address@hidden"
@@ -301,13 +301,13 @@
if {!$maintainer_found} then {
;# Maintainer not found => discard email
add_to_log "discarded msg from unknown maintainer $from"
- discard_email $email_contents
+ archive_email $discarded_mbox $email_contents
return
}
;# Log the operation
add_to_log "received activity reply from $from"
- archive_email $email_contents
+ archive_email $processed_mbox $email_contents
;# Annotate this packages into the activity file
activity_annotate $maintainer_email
@@ -315,23 +315,13 @@
default {
;# Unknown email type. Discard it.
add_to_log "discarded strange email from $from about $subject"
- discard_email $email_contents
+ archive_email $discarded_mbox $email_contents
}
}
}
-proc discard_email {email_contents} {
- variable discarded_email
-
- set fout [open $discarded_email a]
- puts $fout $email_contents
- close $fout
-}
-
-proc archive_email {email_contents} {
- variable processed_email
-
- set fout [open $processed_email a]
+proc archive_email {mbox email_contents} {
+ set fout [open $mbox a]
puts $fout $email_contents
close $fout
}
@@ -412,7 +402,8 @@
variable mailtemplate_active
variable email_originator
variable email_reply
- set maintainer_count 0
+ set maintainer_sent 0
+ set maintainer_omit 0
;# Read the email template
set email_contents_file [open $mailtemplate_active r]
@@ -427,7 +418,7 @@
set maintainer_pkgs [lindex $maintainer 3]
;# Skip unmaintained and generic addresses.
- puts "checking $maintainer_name"
+ ;#puts "checking $maintainer_name"
if {[regexp {^[a-z]} $maintainer_name] == 1} then {
puts "skipping $maintainer_name"
continue
@@ -495,32 +486,44 @@
;# Build the email with formail
set out_email_contents \
- [exec $formail -i "Reply-To: $email_reply" -i \
- "From: $email_originator" \
+ [exec $formail -i "Reply-To: $email_reply" \
+ -i "From: $email_originator" \
-i "To: $maintainer_email" \
-i "Subject: $subject_contents" \
-i "Precedence: bulk" \
<< $email_contents]
set out_email_contents \
- [exec $formail -k -X Date -X Reply-to: -X From: -X Subject: -X To:
<< $out_email_contents]
+ [exec $formail -k -X Date -X Reply-to: -X From: -X Subject: -X To: \
+ << $out_email_contents]
+ append out_email_contents "\n";# be sure we end with blank line
+
+ ;# redo the linebreaks where requested.
+ set out_email_contents \
+ [exec fmt --prefix=fmt: <<$out_email_contents | sed s/fmt:// \
+ << $out_email_contents]
- ;# Send the email using sendmail
- ;#exec fmt --prefix=fmt: <<$out_email_contents | sed s/fmt:// \
- ;# | $sendmail -t -bm
- puts "\f --- Would send email to $maintainer_name:"
- set msg [exec fmt --prefix=fmt: <<$out_email_contents | sed s/fmt://]
- puts $msg
+ ;# (Maybe) send the email.
+ puts -nonewline "--- Email to $maintainer_name <$maintainer_email>:"
+ set ret [exec $sendmail << $out_email_contents]
+ if {[string length $ret] == 0} {
+ set log_str "sent"
+ incr maintainer_sent
+ variable sent_mbox
+ archive_email $sent_mbox $out_email_contents
+ } else {
+ set log_str "omitted ($ret)";
+ incr maintainer_omit;
+ }
- ;# Append an entry into the log file
- add_to_log "sent activity control email to $maintainer_email for
$pkg_list_str"
+ puts " $log_str.";
+ add_to_log "$log_str activity check to $maintainer_email
($maintainer_name) for $pkg_list_str"
- incr maintainer_count;
}
;# Annotate the sendemail operation
sendemail_annotate
- puts "Sent email to $maintainer_count maintainers."
+ puts "Sent email to $maintainer_sent maintainers, omitted $maintainer_omit."
}
proc do_list_operation {opargs} {
Index: template-active.txt
===================================================================
RCS file: /sources/womb/gnumaint/template-active.txt,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- template-active.txt 18 Feb 2007 00:05:48 -0000 1.7
+++ template-active.txt 7 Mar 2007 17:47:22 -0000 1.8
@@ -17,7 +17,7 @@
records.
We'd also like to collect package maintainers' postal addresses and
-phone numbers, so that when email addresses stop working, we have some
+phone numbers, so that if email addresses stop working, we have some
backup. Would you please mail that contact information to
address@hidden so we can note it down?
Index: recent.rel
===================================================================
RCS file: recent.rel
diff -N recent.rel
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ recent.rel 7 Mar 2007 17:47:22 -0000 1.1
@@ -0,0 +1,37 @@
+# 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
+
Index: sendmaintmail
===================================================================
RCS file: sendmaintmail
diff -N sendmaintmail
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sendmaintmail 7 Mar 2007 17:47:22 -0000 1.1
@@ -0,0 +1,117 @@
+#!/usr/local/bin/perl
+# $Id: sendmaintmail,v 1.1 2007/03/07 17:47:22 karl Exp $
+# Send or refrain from sending a message to a maintainer.
+#
+# Copyright 2007 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Originally written by Karl Berry.
+#
+# If the email address is recent enough in activity-report.txt, omit.
+# If the package is recent enough in activity-report.txt, omit.
+# If the package is in recent.rel, omit.
+# Otherwise send.
+#
+# When we omit, we write a short string to stdout describing why.
+# When we send, we write nothing to stdout.
+# (The TCL exec function works most naturally this way.)
+#
+# Although we could of course do the filtering in gnumaint, it was
+# easier for me to implement it in this separate script.
+
+exit (&main ());
+
+sub main
+{
+ my ($maint_email, $pkgref, @msg) = &read_msg ();
+ my @maint_pkgs = @$pkgref;
+
+ # Check if any of these package names appear in the recent.rel file.
+ # If so, we're done.
+ chomp (my @recent_rel = `cat recent.rel`);
+ #
+ for my $p (@maint_pkgs) {
+ if (grep { $_ eq $p } @recent_rel) {
+ print "recent release of $p\n";
+ return 0;
+ }
+ }
+
+ # Check if either the maintainer email or any package occurs
+ # recently enough in activity-report.txt.
+ #
+ my $now = time ();
+ my $cutoff = $now - 300 * 24 * 60 * 60; # don't bother them for 300 days
+ #warn "cutoff seconds: $cutoff\n";
+ #
+ chomp (my @activity = `cat activity-report.txt`);
+ @activity = reverse @activity; # newest first
+ #
+ for my $a (@activity) {
+ my ($email,$pkg,$time) = split (/\|/, $a);
+ $time =~ tr/./ /; # date -d wants a space between date and time
+ chomp (my $seconds = `date +%s -d "$time"`);
+ last if $seconds < $cutoff;
+
+ #warn "checking $email|$pkg|$seconds\n";
+ if ($email eq $maint_email) {
+ print "recent activity for $email/$pkg\n";
+ return 0;
+ } elsif (grep { $_ eq $pkg } @maint_pkgs) {
+ print "recent activity for $pkg/$email\n";
+ return 0;
+ }
+ }
+
+ #warn "would send mail";
+ #print @msg;
+
+ return 0;
+}
+
+
+# return maintainer email, package list reference, and original message
+# from msg on stdin.
+#
+sub read_msg
+{
+ my @msg = ();
+ my ($to,$subject);
+ for my $line (<>) {
+ push (@msg, $line);
+ ($to = $line) =~ s/^To: // if $line =~ /^To: /;
+ ($subject = $line) =~ s/^Subject: // if $line =~ /^Subject: /;
+ }
+
+ die "no To: in @msg\n" unless $to;
+ die "no Subject: in @msg\n" unless $subject;
+ chomp ($to);
+ chomp ($subject);
+ #warn "found $to, $subject\n";
+
+ # extract package names from subject, which looks like this:
+ # Subject: GNU package maintenance: a and b
+ # or
+ # Subject: GNU package maintenance: a, b and c
+ $subject =~ s/^.*: *//;
+ $subject =~ s/ and /, /;
+ my @pkgs = split (/, /, $subject);
+ #warn "pkgs @pkgs from $subject";
+
+ # We can assume the maintainer email is just the value of the To:
+ # header, since we generated it ourselves in gnumaint.
+ return ($to, address@hidden, @msg);
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-womb] gnumaint gnumaint template-active.txt recent.re...,
Karl Berry <=