]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - scripts/added-to-stable
add some helper scripts that I have started using to notify people when patches are...
[thirdparty/kernel/stable-queue.git] / scripts / added-to-stable
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 EMAIL_ADDRESS='<gregkh@suse.de>'
13
14 STABLE='<stable@kernel.org>'
15
16 extract_addr()
17 {
18 read l
19 read l
20 read l
21 read l
22 a=$(echo "$l" | sed -n -e 's/.*<\(.*@[^>]*\).*/\1/p')
23 echo $a
24 }
25
26 if [ x"$SMTP_SERVER" = x ]
27 then
28 SMTP_SERVER=localhost:25
29 fi
30
31 if [ x"$EMAIL_ADDRESS" = x ]
32 then
33 echo "You must set the EMAIL_ADDRESS environment variable to your email address"
34 exit 1
35 fi
36 FROM=$EMAIL_ADDRESS
37
38 TO=""
39 CC=""
40
41 author()
42 {
43 first_author=""
44 TXT=$2
45 if [ ! -f $TXT ]
46 then
47 echo $TXT is missing
48 exit 1
49 fi
50 author=""
51 while read l
52 do
53 # skip the Message-ID: line so we don't send email to the wrong place
54 echo $l
55 reply=$(echo "$l" | grep -i Message-ID:)
56 if [ x"$reply" != x ]
57 then
58 continue
59 fi
60
61 # if this is the start of the diff, then it's time to stop looking
62 diff=$(echo "$l" | grep "^---")
63 if [ x"$diff" != x ]
64 then
65 echo "diffstart!!!!!"
66 break
67 fi
68
69 for x in $l
70 do
71 a=$(echo "$x" | sed -n -e 's/.*<\(.*@[^>]*\).*/\1/p')
72 if [ x"$a" != x ]
73 then
74 if [ x"$author" == x ]
75 then
76 author=$a
77 first_author=$a
78 else
79 author="$author $a"
80 fi
81 fi
82 done
83 done < $TXT
84 author=$(echo $author | tr ' ' '\n' | grep -v "$first_author" |
85 sort | uniq)
86 author="$first_author $author"
87 eval $1=$(echo $author | sed -e 's/ /,/g')
88 if [ x"$3" != x ]
89 then
90 eval $3=$first_author
91 fi
92 }
93
94
95
96 reply()
97 {
98 PATCH=$1
99 # patch_name=$(stripit $1)
100 # PATCH=$P/patches/$patch_name.patch
101 # TXT=$P/txt/$patch_name.txt
102 # if [ ! -f $TXT ]
103 # then
104 # echo $TXT is missing
105 # exit 1
106 # fi
107 echo "PATCH=$PATCH"
108 SUBJECT=`grep "Subject:" $PATCH`
109 # SUBJECT=$(head -n 2 $PATCH | tail -n 1)
110 MESSAGE_ID=`grep -i "^Message-ID:" $PATCH | cut -f 2 -d ' ' | cut -f 2 -d '<' | cut -f 1 -d '>'`
111 author AUTHOR $1 FIRST_AUTHOR
112 echo author said $AUTHOR
113 echo first_author said $FIRST_AUTHOR
114 if [ x"$AUTHOR" == "x" ]
115 then
116 echo nobody to notify
117 exit 0
118 fi
119 to=""
120 for i in $(echo $AUTHOR | sed -e 's/,/ /g')
121 do
122 if ! echo "$TO" | grep "$i"
123 then
124 to=$to" -to $i"
125 fi
126 done
127 if [ x"$cc" != x ]
128 then
129 cc="-cc $cc"
130 fi
131
132 echo makemail -to $AUTHOR -from=$FROM -subject="patch $PATCH added to gregkh tree" -date="$(date -R)" -reply_to=$MESSAGE_ID
133 echo smtpsend -server=$SMTP_SERVER $to -from=$FROM
134
135
136 (
137 echo
138 echo -n "This is a note to let we have just queued up the "
139 echo "patch titled"
140 echo
141 echo " " $SUBJECT
142 echo
143 echo "to the 2.6.18-stable tree. Its filename is"
144 echo
145 echo " " $PATCH
146 echo
147 echo "A git repo of this tree can be found at "
148 echo " http://www.kernel.org/git/?p=linux/kernel/git/gregkh/stable-queue.git;a=summary"
149 echo
150 echo
151 cat $PATCH
152 echo
153 echo
154 echo -n "Patches currently in stable-queue which might be from "
155 echo "$FIRST_AUTHOR are"
156 echo
157 grep -lR $FIRST_AUTHOR /home/greg/linux/stable/stable-queue/queue-2.6.18/ 2> /dev/null |
158 sed -e 's/\/home\/greg\/linux\/stable\/stable-queue\///'
159 ) |
160 makemail -to $AUTHOR -from=$FROM -cc=$STABLE\
161 -subject="patch $PATCH queued to -stable tree" \
162 -date="$(date -R)" \
163 -reply_to="$MESSAGE_ID" | \
164 # talk to the suse network instead of localhost (due to the way suse.de now handles email...)
165 # smtpsend -server=$SMTP_SERVER $to -from=$FROM
166 msmtp $to
167 }
168
169 for patch_file in $*
170 do
171 reply $patch_file
172 echo "acknowledged $patch_file"
173 echo "-----------------------------------------------"
174 echo
175 done