Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 197 lines (176 sloc) 4.577 kb
6fdf2496 »
2010-05-12 initial import from old git tree
1 #!/bin/bash
2
3 #. patchfns 2>/dev/null ||
4 #. /usr/lib/patch-scripts/patchfns 2>/dev/null ||
5 #. $PATCHSCRIPTS_LIBDIR/patchfns 2>/dev/null ||
6 #{
7 # echo "Impossible to find my library 'patchfns'."
8 # echo "Check your install, or go to the right directory"
9 # exit 1
10 #}
11
12 KERNEL_MINOR_VERSION='33'
13 KERNEL="2.6.$KERNEL_MINOR_VERSION"
14
15 EMAIL_ADDRESS='<gregkh@suse.de>'
16
17 STABLE='<stable@kernel.org>'
18 STABLE_COMMITS='<stable-commits@vger.kernel.org>'
19
20 extract_addr()
21 {
22 read l
23 read l
24 read l
25 read l
26 a=$(echo "$l" | sed -n -e 's/.*<\(.*@[^>]*\).*/\1/p')
27 echo $a
28 }
29
30 if [ x"$SMTP_SERVER" = x ]
31 then
32 SMTP_SERVER=localhost:25
33 fi
34
35 if [ x"$EMAIL_ADDRESS" = x ]
36 then
37 echo "You must set the EMAIL_ADDRESS environment variable to your email address"
38 exit 1
39 fi
40 FROM=$EMAIL_ADDRESS
41
42 TO=""
43 CC=""
44
45 author()
46 {
47 first_author=""
48 TXT=$2
49 if [ ! -f $TXT ]
50 then
51 echo "$TXT is missing"
52 exit 1
53 fi
54 author=""
55 while read l
56 do
57 # skip the Message-ID: line so we don't send email to the wrong place
58 echo "$l"
59 reply=$(echo "$l" | grep -i Message-ID:)
60 if [ x"$reply" != x ]
61 then
62 continue
63 fi
64
65 # if this is the start of the diff, then it's time to stop looking
66 diff=$(echo "$l" | grep "^---")
67 if [ x"$diff" != x ]
68 then
69 echo "diffstart!!!!!"
70 break
71 fi
72
73 for x in $l
74 do
75 a=$(echo "$x" | sed -n -e 's/.*<\(.*@[^>]*\).*/\1/p')
76 if [ x"$a" != x ]
77 then
78 if [ x"$author" == x ]
79 then
80 author=$a
81 first_author=$a
82 else
83 author="$author $a"
84 fi
85 fi
86 done
87 done < $TXT
88 author=$(echo "$author" | tr ' ' '\n' | grep -v "$first_author" |
89 sort | uniq)
90 author="$first_author $author"
91 eval $1=$(echo $author | sed -e 's/ /,/g')
92 if [ x"$3" != x ]
93 then
94 eval $3=$first_author
95 fi
96 }
97
98
99
100 reply()
101 {
102 PATCH=$1
103 # patch_name=$(stripit $1)
104 # PATCH=$P/patches/$patch_name.patch
105 # TXT=$P/txt/$patch_name.txt
106 # if [ ! -f $TXT ]
107 # then
108 # echo $TXT is missing
109 # exit 1
110 # fi
111 echo "PATCH=$PATCH"
112 TITLE=`grep "Subject:" $PATCH`
113 # TITLE=$(head -n 2 $PATCH | tail -n 1)
114 MESSAGE_ID=`grep -i "^Message-ID:" $PATCH | cut -f 2 -d ' ' | cut -f 2 -d '<' | cut -f 1 -d '>'`
115 author AUTHOR $1 FIRST_AUTHOR
116 echo "author said $AUTHOR"
117 echo "first_author said $FIRST_AUTHOR"
118 if [ x"$AUTHOR" == "x" ]
119 then
120 echo "nobody to notify"
121 exit 0
122 fi
123 to=""
124 for i in $(echo "$AUTHOR" | sed -e 's/,/ /g')
125 do
126 if ! echo "$TO" | grep "$i"
127 then
128 to=$to" -to $i"
129 fi
130 done
131 if [ x"$cc" != x ]
132 then
133 cc="-cc $cc"
134 fi
135
136 SUBJECT="patch $PATCH added to $KERNEL-stable tree"
137
138 CHARSET=$(guess-charset "$PATCH")
139 if test "x$CHARSET" = "ANSI_X3.4-1968"; then
140 CHARSET=
141 else
142 CHARCMD="-charset=$CHARSET"
143 fi
144
145 ID=`make_message_id`
146
147 echo "makemail -to $AUTHOR -from=$FROM -subject=\"$SUBJECT\" -date=\"$(date -R)\" -reply_to=$MESSAGE_ID --message=$ID $CHARCMD"
148 # echo "smtpsend -server=$SMTP_SERVER $to -from=$FROM"
149
150
151 (
152 echo
153 echo -n "This is a note to let you know that we have just queued up the "
154 echo "patch titled"
155 echo
156 echo " $TITLE"
157 echo
158 echo "to the $KERNEL-stable tree. Its filename is"
159 echo
160 echo " $PATCH"
161 echo
162 echo "A git repo of this tree can be found at "
163 echo " http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary"
164 echo
165 echo
166 cat $PATCH
167 echo
168 echo
169 echo -n "Patches currently in stable-queue which might be from "
170 echo "$FIRST_AUTHOR are"
171 echo
172 grep -lR $FIRST_AUTHOR /home/gregkh/linux/stable/stable-queue/queue-$KERNEL/ 2> /dev/null |
173 sed -e 's/\/home\/gregkh\/linux\/stable\/stable-queue\///'
174 ) |
175 makemail -to "$AUTHOR" \
176 -from="$FROM" \
177 -cc="$STABLE, $STABLE_COMMITS" \
178 -subject="$SUBJECT" \
179 -date="$(date -R)" \
180 -reply_to="$MESSAGE_ID" \
181 -message_id="$ID" \
182 "$CHARCMD" \
183 | \
184 # talk to the suse network instead of localhost (due to the way suse.de now handles email...)
185 # smtpsend -server=$SMTP_SERVER $to -from=$FROM
186 # ~/bin/msmtp-enqueue.sh -a suse "$to"
187 ~/bin/msmtp-enqueue.sh -a coco "$to"
188 #msmtp $to
189 }
190
191 for patch_file in $*
192 do
193 reply $patch_file
194 echo "acknowledged $patch_file"
195 echo "-----------------------------------------------"
196 echo
197 done
Something went wrong with that request. Please try again.