commit-womb
[Top][All Lists]
Advanced

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

[Commit-womb] gnumaint gnumaint


From: Jose E. Marchesi
Subject: [Commit-womb] gnumaint gnumaint
Date: Thu, 25 Jan 2007 13:37:13 +0000

CVSROOT:        /cvsroot/womb
Module name:    gnumaint
Changes by:     Jose E. Marchesi <jemarch>      07/01/25 13:37:13

Modified files:
        .              : gnumaint 

Log message:
        Use of the `report_file' file to store incoming activity responses.
        Get maintainer emails from From: fields on the incoming messages.
        use `discarded_email' file for unrecognized emails.
        The sendemail operation annotates a "last_sendemail" with a timestamp
        on the report_file

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnumaint/gnumaint?cvsroot=womb&r1=1.20&r2=1.21

Patches:
Index: gnumaint
===================================================================
RCS file: /cvsroot/womb/gnumaint/gnumaint,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- gnumaint    13 Jan 2007 17:05:08 -0000      1.20
+++ gnumaint    25 Jan 2007 13:37:13 -0000      1.21
@@ -30,6 +30,8 @@
 variable email_originator     "address@hidden"
 variable email_reply          "address@hidden"
 variable lockfile_command     "/usr/bin/lockfile"
+variable report_file          "activity-report"
+variable discarded_email      "discarded-email"
 
 proc do_help_usage {} {
   global maintainers_file
@@ -283,62 +285,45 @@
     set email_contents [read -nonewline stdin]
 
     ;# Get data fields from the received email
-    set from [exec $formail -c -xFrom << $email_contents]
+    set from [exec $formail -c -xFrom: << $email_contents]
     set subject [exec $formail -c -xSubject << $email_contents]
     set reply_to [exec $formail -c -xReply-To << $email_contents]
     set body [exec $formail -I \"\" << $email_contents]
 
     ;# Infer the nature of the email from the subject content
     set subject [string trim $subject]
+
     switch -glob $subject {
 
-       "*ACK*" {
+       "*GNU package maintenance*" {
            ;#
            ;# Activity response email
            ;#
 
-            ;# Search for maintainer email on the control line
-            set maintainer_email {}
-            set maintainer_name {}
-            set maintainer_email_regexp "\\\$mntemail:(\[^$\]*)\\\$"
-            regexp $maintainer_email_regexp $body -> maintainer_email
-            foreach mnt $maintainersdb {
+            ;# Get the maintainer email
+            set maintainer_email [string trim $from]
 
-                set maintainer_name [lindex $mnt 0]
-                if {$maintainer_email == [lindex $mnt 1]} then {
+            ;# Make sure this maintainer exist on the dabase
+            set maintainer_found false
+            foreach maintainer $maintainersdb {
 
-                    ;# Maintainer found
-                    break
+                if {[lindex $maintainer 1] == $maintainer_email} then {
+                    set maintainer_found true
                 }
             }
-            if {$maintainer_name == ""} then {
-
+            if {!$maintainer_found} then {
                 ;# Maintainer not found => discard email
-                break
+                discard_email $email_contents
+                return
             }
 
-           ;# Search for package names on the control line
-           set pkgs {}
-           set package_name_regexp "\\\$pkgname:(\[^$\]*)\\\$"
-            set inline_pkgs [regexp -inline -all -- $package_name_regexp $body]
-            foreach inline_pkg $inline_pkgs {
-
-                if {![regexp "^\\\$pkgname:.*" $inline_pkg]} then {
-                    lappend pkgs $inline_pkg
-                }
-            }
-
-           if {[llength $pkgs] == 0} then {
-               ;# No package marks => discard this email
-           } else {
-
                 ;# Log the operation
                 add_to_log \
-                    "received activity control email reply from 
$maintainer_name for packages $pkgs"
+                "received activity control email reply from $maintainer_email"
 
                 ;# Annotate this packages into the activity file
-                ;#activity_annotate $pkgs $maintainer_name
-            }
+            activity_annotate $maintainer_email
+
         }
        default {
            ;# Unknown email type. Ignore it.
@@ -346,7 +331,64 @@
     }
 }
 
-proc activity_annotate {} {
+proc discard_email {email_contents} {
+
+    variable discarded_email
+
+    set fout [open $discarded_email a]
+
+    puts $fout $email_contents
+
+    close $fout
+}
+
+proc sendemail_annotate {} {
+
+    variable report_file
+
+    set fout [open $report_file a]
+    
+    set line "last_sendemail : [timestamp]"
+    puts $fout $line
+    
+    close $fout
+}
+
+proc activity_annotate {maintainer_email} {
+
+    variable report_file
+    variable maintainersdb
+
+    set maintainer_name {}
+    set maintainer_packages {}
+
+    ;# Collect information for this maintainer
+    foreach maintainer $maintainersdb {
+
+        if {[lindex $maintainer 1] == $maintainer_email} then {
+
+            set maintainer_packages [lindex $maintainer 3]
+
+            break;
+        }
+    }
+
+    ;# Make an annotation on file
+    set fout [open $report_file a]
+
+    foreach pkg $maintainer_packages {
+
+        set pkgline "$pkg : $maintainer_email : [timestamp]"
+
+        puts $fout $pkgline
+    }
+
+    close $fout
+}
+
+proc timestamp {} {
+
+    return [clock format [clock seconds]]
 }
 
 # 
@@ -489,6 +531,9 @@
         incr maintainer_count;
     }
 
+    ;# Annotate the sendemail operation
+    sendemail_annotate
+
   puts "Sent email to $maintainer_count maintainers."
 }
 




reply via email to

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