CVSROOT ciabot,1.3,1.4
Nathaniel Smith <[email protected]> Mon, 02 Jun 2003 05:56:22 -0500
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/CVSROOT
In directory purcel:/tmp/cvs-serv23577
Modified Files:
ciabot
Log Message:
Super-duper ciabot script (now, with extra teeth-brightening power!
and more options, too).
I hope it works.
Index: ciabot
===================================================================
RCS file: /cvs/fresco/CVSROOT/ciabot,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ciabot 2 Jun 2003 10:12:43 -0000 1.3
+++ ciabot 2 Jun 2003 10:56:20 -0000 1.4
@@ -1,29 +1,37 @@
#!/bin/bash
-# This version hacked by njs to include module name and give feedback
-# while running.
-# It should be called as "ciabot %{}" from loginfo.
+# This script should be called as "ciabot %{}" from loginfo.
+# Sample loginfo line:
+# ALL $CVSROOT/CVSROOT/ciabot %{}
+# Then commit this file to your CVSROOT, and add it to CVSROOT/checkoutlist
projectname="fresco"
+returnaddress="[email protected]"
+stripnewlines=false
+#stripnewlines=true
+
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`
-oldmessage="$message"
-message=`echo "$message" | head -n 5`
-if [ "$oldmessage" != "$message" ]; then
- message="${message}${newline}<...>"
+if $stripnewlines; then
+ message=`echo -n "$message" | tr '\n\r' ' '`
+fi
+
+if [ "$message" != `echo -n "$message" | head -n $maxlines` ]; then
+ message="`echo -n \"$message\" | head -n $(($maxlines - 1))`$newline<...>"
fi
module=`echo $1 | cut -d/ -f1`
tmpfile="/tmp/$RANDOM-$projectname"
cat <<EOF >$tmpfile
-From: [email protected]
+From: $returnaddress
To: [email protected]
Content-Type: text/plain;
Subject: Announce $projectname
@@ -32,17 +40,17 @@
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
- fi
-else
+ 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
+ fi
+else
+ cat $tmpfile | /usr/sbin/sendmail -t
+ mv $tmpfile /tmp/lastlog-$projectname
fi
echo "done."