]>
Commit | Line | Data |
---|---|---|
9831ae87 GKH |
1 | #!/bin/bash |
2 | ||
3 | STABLE_VERSION=".37" | |
4 | EMAIL_ADDRESS='<gregkh@suse.de>' | |
5 | ||
6 | extract_addr() | |
7 | { | |
8 | read l | |
9 | read l | |
10 | read l | |
11 | read l | |
12 | a=$(echo "$l" | sed -n -e 's/.*<\(.*@[^>]*\).*/\1/p') | |
13 | echo $a | |
14 | } | |
15 | ||
16 | if [ x"$EMAIL_ADDRESS" = x ] | |
17 | then | |
18 | echo "You must set the EMAIL_ADDRESS environment variable to your email address" | |
19 | exit 1 | |
20 | fi | |
21 | FROM=$EMAIL_ADDRESS | |
22 | ||
23 | TO="" | |
24 | CC="" | |
25 | STABLE='<stable@kernel.org>' | |
26 | STABLE_COMMITS='<stable-commits@vger.kernel.org>' | |
27 | ||
28 | author() | |
29 | { | |
30 | first_author="" | |
31 | TXT=$2 | |
32 | if [ ! -f $TXT ] | |
33 | then | |
34 | echo "$TXT is missing" | |
35 | exit 1 | |
36 | fi | |
37 | author="" | |
38 | while read l | |
39 | do | |
40 | # skip the Message-ID: line so we don't send email to the wrong place | |
41 | #echo "$l" | |
42 | reply=$(echo "$l" | grep -i Message-ID:) | |
43 | if [ x"$reply" != x ] | |
44 | then | |
45 | continue | |
46 | fi | |
47 | ||
48 | # if this is the start of the diff, then it's time to stop looking | |
49 | diff=$(echo "$l" | grep "^---") | |
50 | if [ x"$diff" != x ] | |
51 | then | |
52 | #echo "diffstart!!!!!" | |
53 | break | |
54 | fi | |
55 | ||
56 | for x in $l | |
57 | do | |
58 | a=$(echo "$x" | sed -n -e 's/.*<\(.*@[^>]*\).*/\1/p') | |
59 | if [ x"$a" != x ] | |
60 | then | |
61 | if [ x"$author" == x ] | |
62 | then | |
63 | author=$a | |
64 | first_author=$a | |
65 | else | |
66 | author="$author $a" | |
67 | fi | |
68 | fi | |
69 | done | |
70 | done < $TXT | |
71 | author=$(echo "$author" | tr ' ' '\n' | grep -v "$first_author" | | |
72 | sort | uniq) | |
73 | author="$first_author $author" | |
74 | eval $1=$(echo $author | sed -e 's/ /,/g') | |
75 | if [ x"$3" != x ] | |
76 | then | |
77 | eval $3=$first_author | |
78 | fi | |
79 | } | |
80 | ||
81 | ||
82 | ||
83 | reply() | |
84 | { | |
85 | PATCH=$1 | |
86 | # patch_name=$(stripit $1) | |
87 | # PATCH=$P/patches/$patch_name.patch | |
88 | # TXT=$P/txt/$patch_name.txt | |
89 | # if [ ! -f $TXT ] | |
90 | # then | |
91 | # echo $TXT is missing | |
92 | # exit 1 | |
93 | # fi | |
94 | #echo "PATCH=$PATCH" | |
95 | # SUBJECT=`grep "Subject:" $PATCH` | |
96 | SUBJECT=`grep "Subject:" $PATCH | sed s/Subject\:\ //` | |
97 | # SUBJECT=$(head -n 2 $PATCH | tail -n 1) | |
98 | MESSAGE_ID=`grep -i "^Message-ID:" $PATCH | cut -f 2 -d ' ' | cut -f 2 -d '<' | cut -f 1 -d '>'` | |
99 | author AUTHOR $1 FIRST_AUTHOR | |
100 | #echo "author said $AUTHOR" | |
101 | #echo "first_author said $FIRST_AUTHOR" | |
102 | if [ x"$AUTHOR" == "x" ] | |
103 | then | |
104 | echo "nobody to notify" | |
105 | exit 0 | |
106 | fi | |
107 | to="" | |
108 | for i in $(echo "$AUTHOR" | sed -e 's/,/ /g') | |
109 | do | |
110 | if ! echo "$TO" | grep "$i" | |
111 | then | |
112 | to=$to" -to $i" | |
113 | fi | |
114 | done | |
115 | if [ x"$cc" != x ] | |
116 | then | |
117 | cc="-cc $cc" | |
118 | fi | |
119 | ||
120 | CHARSET=$(guess-charset "$PATCH") | |
121 | if test "x$CHARSET" = "ANSI_X3.4-1968"; then | |
122 | CHARSET= | |
123 | else | |
124 | CHARCMD="-charset=$CHARSET" | |
125 | fi | |
126 | ||
127 | ID=`make_message_id` | |
128 | ||
129 | #echo "makemail -to $AUTHOR -from=$FROM -subject=\"patch $PATCH added to gregkh tree\" -date=\"$(date -R)\" -message=$ID $CHARCMD" | |
130 | echo "sending to $AUTHOR" | |
131 | ||
132 | ( | |
133 | echo | |
134 | echo "The patch below does not apply to the $STABLE_VERSION-stable tree." | |
135 | echo "If someone wants it applied there, or to any other stable or longterm" | |
136 | echo "tree, then please email the backport, including the original git commit" | |
137 | echo "id to <stable@kernel.org>." | |
138 | echo | |
139 | echo "thanks," | |
140 | echo | |
141 | echo "greg k-h" | |
142 | echo | |
143 | echo "------------------ original commit in Linus's tree ------------------" | |
144 | echo | |
145 | cat $PATCH | |
146 | echo | |
147 | # echo | |
148 | # echo -n "Patches currently in gregkh-2.6 which might be from " | |
149 | # echo "$FIRST_AUTHOR are" | |
150 | # echo | |
151 | # grep -lR $FIRST_AUTHOR /home/gregkh/linux/patches/ 2> /dev/null | | |
152 | # sed -e 's/\/home\/gregkh\/linux\/patches\///' | |
153 | ) | | |
154 | makemail -to "$AUTHOR" \ | |
155 | -from="$FROM" \ | |
156 | -cc="$STABLE" \ | |
157 | -subject="patch \"$SUBJECT\" failed to apply to $STABLE_VERSION-stable tree" \ | |
158 | -date="$(date -R)" \ | |
159 | -message_id="$ID" \ | |
160 | "$CHARCMD" | \ | |
161 | # talk to the suse network instead of localhost (due to the way suse.de now handles email...) | |
162 | #msmtp $to | |
163 | # ~/bin/msmtp-enqueue.sh -a suse $to | |
164 | ~/bin/msmtp-enqueue.sh -a coco $to | |
165 | } | |
166 | ||
167 | ||
168 | ||
169 | for git_id in $* | |
170 | do | |
171 | TMPFILE=`mktemp bad_patch.XXXXX` || exit 1 | |
172 | git show --pretty=email $git_id > $TMPFILE | |
173 | reply $TMPFILE | |
174 | rm $TMPFILE | |
175 | done | |
176 | ||
177 | #for patch_file in $* | |
178 | #do | |
179 | # reply $patch_file | |
180 | # echo "acknowledged $patch_file" | |
181 | # echo "-----------------------------------------------" | |
182 | # echo | |
183 | #done |