[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu-arch-users] ArchNotify supybot plugin
From: |
Andrew Suffield |
Subject: |
Re: [Gnu-arch-users] ArchNotify supybot plugin |
Date: |
Wed, 17 Sep 2003 01:38:21 +0100 |
User-agent: |
Mutt/1.5.4i |
On Tue, Sep 16, 2003 at 07:15:20PM -0400, Colin Walters wrote:
> I really like the #commits IRC channel on freenode, but its bot doesn't
> support arch.
I have been sending commit notices for dancer there for months.
When I first looked at your script, I thought "Wow. That's huge. I
wonder what it does that mine doesn't". Then I read the rest of your
mail, and realised "nothing".
My script is shorter than the license notice in yours, let alone the
code. (being totally trivial, copyright does not subsist in mine at
all). Nonetheless, it generates pretty much exactly the same output,
ignoring a couple of trivial formatting differences (I used colour).
A good example of over-engineering (coupled with the wrong tools).
----------- ciabot_notify
#!/bin/sh
project_name="$1"
return_address="address@hidden"
sendmail_command="/usr/sbin/sendmail -t"
cia_address="address@hidden"
(
echo "From: $return_address"
echo "To: $cia_address"
echo "Content-Type: text/plain;"
echo "Subject: Announce $project_name"
echo
echo "{yellow}$ARCH_ARCHIVE/$ARCH_REVISION{normal}"
tla cat-archive-log -A $ARCH_ARCHIVE $ARCH_REVISION | formail -X Summary: |
sed 's/^Summary: //'
) | $sendmail_command
-----------
You call this from a hook script like this:
ciabot_notify dancer
Filling in whatever project prefix you want. I use a little perl to
generate it, like this:
my %cia_notify = (
"dancer--main" => "dancer",
"dgmtp--main" => "dancer",
);
if ($cia_notify{"$category--$branch"})
{
print "Notifying ciabot\n";
system("ciabot_arch", $cia_notify{"$category--$branch"});
}
But there's no real reason that couldn't be hardcoded in a single
line. I rapidly discovered that I didn't want to send notifications
for very many archives.
--
.''`. ** Debian GNU/Linux ** | Andrew Suffield
: :' : http://www.debian.org/ |
`. `' |
`- -><- |
signature.asc
Description: Digital signature