]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - scripts/added-to-stable
429a513232ac72db8d199c94e9ca24768e2f5204
[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 KERNEL_MINOR_VERSION='22'
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 SUBJECT=`grep "Subject:" $PATCH`
113 # SUBJECT=$(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 echo makemail -to $AUTHOR -from=$FROM -subject="patch $PATCH added to -stable tree" -date="$(date -R)" -reply_to=$MESSAGE_ID
137 echo smtpsend -server=$SMTP_SERVER $to -from=$FROM
138
139
140 (
141 echo
142 echo -n "This is a note to let you know that we have just queued up the "
143 echo "patch titled"
144 echo
145 echo " " $SUBJECT
146 echo
147 echo "to the "$KERNEL"-stable tree. Its filename is"
148 echo
149 echo " " $PATCH
150 echo
151 echo "A git repo of this tree can be found at "
152 echo " http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary"
153 echo
154 echo
155 cat $PATCH
156 echo
157 echo
158 echo -n "Patches currently in stable-queue which might be from "
159 echo "$FIRST_AUTHOR are"
160 echo
161 grep -lR $FIRST_AUTHOR /home/gregkh/linux/stable/stable-queue/queue-$KERNEL/ 2> /dev/null |
162 sed -e 's/\/home\/gregkh\/linux\/stable\/stable-queue\///'
163 ) |
164 makemail -to $AUTHOR -from=$FROM -cc="$STABLE, $STABLE_COMMITS" \
165 -subject="patch $PATCH queued to -stable tree" \
166 -date="$(date -R)" \
167 -reply_to="$MESSAGE_ID" | \
168 # talk to the suse network instead of localhost (due to the way suse.de now handles email...)
169 # smtpsend -server=$SMTP_SERVER $to -from=$FROM
170 msmtp $to
171 }
172
173 for patch_file in $*
174 do
175 reply $patch_file
176 echo "acknowledged $patch_file"
177 echo "-----------------------------------------------"
178 echo
179 done