Enlightenment CVS committal

Author  : raster
Module  : CVSROOT

Dir     : CVSROOT


Modified Files:
        ciabot.sh loginfo 


Log Message:


new ciabot?

===================================================================
RCS file: /cvsroot/enlightenment/CVSROOT/ciabot.sh,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- ciabot.sh   2 Jun 2003 09:36:38 -0000       1.7
+++ ciabot.sh   25 Jun 2003 02:27:57 -0000      1.8
@@ -1,34 +1,102 @@
-#!/bin/sh
+#!/bin/bash
+
+# This script should be called as "ciabot %{}" from loginfo.
+# Sample loginfo line:
+# ALL $CVSROOT/CVSROOT/ciabot %{sVv}
+# Put that in your CVSROOT/loginfo, then set the variables at the top of this
+# script.  Then commit this file to your CVSROOT, and add it to
+# CVSROOT/checkoutlist, and
+#   echo | mail -s "JoinChannel #myproject" [EMAIL PROTECTED]
+
+projectname="e"  # will announce to channel #<whatever you put here>
+returnaddress="@enlightenment.org"
+
+# You should turn stripnewlines on if you tend to write short blocks
+# of text, and off if you tend to have any formatting.  If you stick
+# full changelog entries in your commit messages, definitely turn it
+# off.
+stripnewlines=false
+#stripnewlines=true
+
+# If your logs don't include the name of the modified file, and you want to
+# show it, turn this on
+includefilename=false
+#includefilename=true
+
+# Deliver directly to the bot:
+commitaddress="[EMAIL PROTECTED]"
+# Sourceforge projects might need to deliver via users.sf.net (slower)
+#commitaddress="[EMAIL PROTECTED]"
+
+#################### End of what you'll generally need to change
+
+echo -n "Notifying #${projectname}..."
+
+maxlines=6
 message=`cat`
 uname=`id -un`
 lineno=`echo "$message" | grep -n "Log Message:" | awk -F: ' { print $1 } '`
 message=`echo "$message" | sed "1,${lineno}d"`
+newline=`echo`
+
+if [ "$message" != "`echo \"$message\" | head -n $maxlines`" ]; then
+# The following line appears to be the only way to insert a newline at
+# that place.
+    message="`echo \"$message\" | head -n $(($maxlines - 1))`
+<...>"
+fi
+
+if $stripnewlines; then
+    message=`echo -n "$message" | tr '\n\r' ' '`
+fi
 
-projectname="e"
-tmpfile="/tmp/$RANDOM-$projectname"
-message=`echo "$message" | head -n 5`
+module=`echo $1 | cut -d/ -f1`
+
+## disabled, as it might cause repeated messages
+#if $includefilename; then
+#      directory=`echo $1 | cut -d" " -f1`
+#      filename=`echo $1 | cut -d" " -f2 | cut -d"," -f1`
+#      module="$directory/$filename"
+#fi
+
+# the /tmp directory often has its sticky bit set, so do things
+# in a private subdir so we can have shared state
+tmpdir="/tmp/ciabot.cvs"
+if [ ! -d $tmpdir ]; then
+    mkdir $tmpdir;
+    chmod 0777 $tmpdir
+fi
+tmpfile="$tmpdir/$RANDOM-$projectname"
 
 cat <<EOF >$tmpfile
-From: [EMAIL PROTECTED]
-To: [EMAIL PROTECTED]
+From: $returnaddress
+To: $commitaddress
 Content-Type: text/plain;
 Subject: Announce $projectname
 
-Commit by: $uname
-Where:     $@
-$message
+commit by $uname to $module: $message
 EOF
 
-if [ -e /tmp/lastlog-$projectname ]; then
-        if ! diff /tmp/lastlog-$projectname $tmpfile &>/dev/null; then
-                # there are differences, so this is a different commit
-                cat $tmpfile | /usr/sbin/sendmail -t
-                mv $tmpfile /tmp/lastlog-$projectname
-        else
-                # it's just cvs spamming us from another directory
-                rm $tmpfile
+lastlog="$tmpdir/lastlog-$projectname"
+if [ -r $lastlog ]; then
+    if ! diff $lastlog $tmpfile &>/dev/null; then
+        # there are differences, so this is a different commit
+        cat $tmpfile | /usr/sbin/sendmail -t
+        # try to replace the lastlog if we're allowed
+        if [ -w $lastlog ]; then
+            mv $tmpfile $lastlog
+            # allow the next person to overwrite
+            chmod a+w $lastlog
         fi
+    else
+        # it's just cvs spamming us from another directory
+        rm $tmpfile
+    fi
 else
-        cat $tmpfile | /usr/sbin/sendmail -t
-        mv $tmpfile /tmp/lastlog-$projectname
+    cat $tmpfile | /usr/sbin/sendmail -t
+    mv $tmpfile $lastlog
+    # To ensure that the next person to commit will be able to overwrite
+    chmod a+w $lastlog
 fi
+
+echo "done."
===================================================================
RCS file: /cvsroot/enlightenment/CVSROOT/loginfo,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- loginfo     2 Jun 2003 09:18:40 -0000       1.21
+++ loginfo     25 Jun 2003 02:27:57 -0000      1.22
@@ -26,4 +26,4 @@
 #DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
 # added myself (testing)
 DEFAULT /usr/bin/perl $CVSROOT/CVSROOT/commit.pl %{sVv}
-ALL $CVSROOT/CVSROOT/ciabot.sh %{s}
+ALL $CVSROOT/CVSROOT/ciabot.pl %s $USER




-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to