Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 81 lines (65 sloc) 1.722 kB
30058ca @gregkh add mbox2send to help with stable kernel stuff
authored
1 #!/usr/bin/perl -W
2 #
3 # This takes a mbox of email, created with 'quilt mail --mbox'
4 # and formats it in the proper way to send off a -stable kernel review.
5 #
6 # This means:
7 # - strip off some quilt headers and the threading
8 # - add some text at the top of every message.
9 #
10 # Written in perl because the bash version is broken, it doesn't pass
11 # through the patch correctly :(
12 #
13
14 my $line;
15
eaf8478 @gregkh mbox2send update
authored
16 my $version = shift;
30058ca @gregkh add mbox2send to help with stable kernel stuff
authored
17
18 if ($version eq "") {
19 print "must provide kernel version number\n";
20 die;
21 }
22
eaf8478 @gregkh mbox2send update
authored
23 my $mbox = shift;
30058ca @gregkh add mbox2send to help with stable kernel stuff
authored
24
25 if ($mbox eq "") {
26 print "must provide the name of the mbox file\n";
27 die;
28 }
29
30 $mboxnew = "$mbox.new";
31 chomp($mboxnew);
32
33 open MBOX, "$mbox" || die "Failed to open $mbox";
34 open FILE, ">$mboxnew" || die "Failed to create $mboxnew";
35
36 my $header = "true";
37 my $eat = "false";
38
39 while ($line = <MBOX>) {
40 $eat = "false";
41
42 if ($header eq "false") {
43 if ($line =~ m/^From /) {
44 # start of a message, this is the header
45 $header = "true";
46 }
47 }
48
49 if ($header eq "true") {
50 # strip out References line
51 if ($line =~ m/^References:/) {
52 # eat the line
53 $eat = "true";
54 }
55 # strip out the Content-Disposition line
56 if ($line =~ m/Content-Disposition:/) {
57 # eat the line
58 $eat = "true";
59
60 # we are now out of the header
61 $header = "false";
62
63 # write out our custom header too
64 print FILE "\n";
d6ac299 @gregkh face it, I'm the only stable developer now...
authored
65 print FILE "$version-stable review patch. If anyone has any objections, please let me know.\n";
30058ca @gregkh add mbox2send to help with stable kernel stuff
authored
66 print FILE "\n";
67 print FILE "------------------\n";
68 }
69 }
70
71 if ($eat eq "false") {
72 print FILE $line;
73 }
74 }
75 close MBOX;
76 close FILE;
77
979eb0c @gregkh mbox2send update
authored
78 print "# New mailbox is in $mboxnew\n";
79 print "# To send the patches out, do:\n";
80 print "cat $mboxnew | formail -A \"In-Reply-To: <FOO>\" -s msmtp-enqueue.sh\n";
Something went wrong with that request. Please try again.