From: Jeff Garzik <jgarzik@pobox.com>
To: Martin Waitz <tali@admingilde.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: script to send changesets per mail
Date: Thu, 03 Mar 2005 13:23:40 -0500 [thread overview]
Message-ID: <4227562C.70503@pobox.com> (raw)
In-Reply-To: <20050303105950.GH8617@admingilde.org>
Martin Waitz wrote:
> hoi :)
>
> I just tested my little script that can send changesets per mail.
> okok, it still had a bug when I first tested it but that should be
> fixed now.
>
> If anyone is interested (perhaps for Documentation/BK-usage), here it
> is:
Putting this in Documentation/BK-usage would be fine.
> #!/usr/bin/perl -w
>
> # after sending an announcement (created by Documentation/BK-usage/bk-make-sum)
> # just pipe your mail through this script.
> # It will create one new mail per Changeset, properly threaded.
>
> # Copyright © 2005 Martin Waitz <tali@admingilde.org>
>
> use strict;
>
> my $from;
> my $to;
> my $cc;
> my $references;
>
> # all local repositories are in ~/src/.
> # you have to adjust this function if you keep them elsewhere.
> sub local_repository($) {
> my $repo;
>
> $repo= shift;
>
> $repo =~ s,.*/,"$ENV{HOME}/src/",e;
> return $repo;
> }
>
> # this checks if we are allowed to send mails with this sender
> # please modify the regexp to check for your adress!
> sub check_from($) {
> my $from = shift;
>
> exit 1 unless $from =~ /insert-your-email-here/; #FIXME
> }
Move 'insert email here' into a default variable, a variable that can be
overridden by an environment variable.
> # send one changeset.
> # Parameters: the cset number, description prefix and the actual description.
> sub send_cset($$$$) {
> my ($cset, $serial, $desc, $longdesc) = @_;
>
> open (MAIL, "| /usr/sbin/sendmail -t") or die "fork sendmail: $!";
> print MAIL "From: $from\n";
> print MAIL "To: $to\n";
> print MAIL "Cc: $cc\n" if $cc;
> print MAIL "References: $references\n" if $references;
> print MAIL "Subject: [PATCH $serial] $desc\n";
> print MAIL "\n";
> print MAIL "$desc\n";
> print MAIL "$longdesc\n";
> print MAIL "\n";
> print MAIL `bk export -tpatch -du -r $cset`;
> close (MAIL) or die "could not send mail: error code $?";
I would suggest '-hdu' to avoid the patch header, but some may disagree.
> # Parse header
> while (<>) {
> chomp;
> last if /^$/;
>
> if (/^From:\s+(.+)$/i) {
> $from = $1;
> } elsif (/^To:\s+(.+)$/i) {
> $to = $1;
> } elsif (/^Cc:\s+(.+)$/i) {
> $cc = $1;
> } elsif (/^Message-Id:\s+(.+)$/i) {
> $references = $1;
> }
note that this misses multi-line headers. multi-line headers are those
where the second, and succeeding lines begin with whitespace.
next prev parent reply other threads:[~2005-03-03 18:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-03 10:59 script to send changesets per mail Martin Waitz
2005-03-03 18:23 ` Jeff Garzik [this message]
2005-03-13 11:31 ` Sam Ravnborg
[not found] <fa.f2usg94.a5sd8q@ifi.uio.no>
[not found] ` <fa.hdaug7i.n7qkqg@ifi.uio.no>
2005-03-14 23:22 ` Bodo Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4227562C.70503@pobox.com \
--to=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tali@admingilde.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox