[xiph-cvs] cvs commit: CVSROOT ciabot_cvs.sh checkoutlist loginfo

Ralph Giles giles at xiph.org
Mon Sep 29 07:00:28 PDT 2003



giles       03/09/29 10:00:28

  Modified:    .        checkoutlist loginfo
  Added:       .        ciabot_cvs.sh
  Log:
  Send commit announcements to the CIA bot for announcement on irc. Some
  stats are available at http://navi.picogui.org/cgi-bin/cia_stats.cgi

Revision  Changes    Path
1.3       +2 -0      CVSROOT/checkoutlist

Index: checkoutlist
===================================================================
RCS file: /usr/local/cvsroot/CVSROOT/checkoutlist,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- checkoutlist	5 Sep 2000 19:40:54 -0000	1.2
+++ checkoutlist	29 Sep 2003 14:00:28 -0000	1.3
@@ -17,3 +17,5 @@
 cvs_acls.pl moo4
 log_accum.pl moo5
 mailto moo6
+ciabot_cvs.sh Moo! It's the CIA!
+

<p><p>1.3       +5 -0      CVSROOT/loginfo

Index: loginfo
===================================================================
RCS file: /usr/local/cvsroot/CVSROOT/loginfo,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- loginfo	5 Sep 2000 19:46:35 -0000	1.2
+++ loginfo	29 Sep 2003 14:00:28 -0000	1.3
@@ -24,4 +24,9 @@
 #DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
 # or
 #DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
+
+# email the logs
 DEFAULT $CVSROOT/CVSROOT/log_accum.pl %s
+
+# notify irc/stats bot
+DEFAULT $CVSROOT/CVSROOT/ciabot_cvs.sh %{sVv}

<p><p>1.1                  CVSROOT/ciabot_cvs.sh

Index: ciabot_cvs.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" commits at picogui.org

projectname="xiph"  # will announce to channel #<whatever you put here>
returnaddress="cvs-admin at xiph.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="commits at picogui.org"
# Sourceforge projects might need to deliver via users.sf.net (slower)
#commitaddress="cia at users.sf.net"

#################### 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

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: $returnaddress
To: $commitaddress
Content-Type: text/plain;
Subject: Announce $projectname

commit by $uname to $module: $message
EOF

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 $lastlog
    # To ensure that the next person to commit will be able to overwrite
    chmod a+w $lastlog
fi

echo "done."

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list