]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - scripts/quilt-mail
add Ben to the first email...
[thirdparty/kernel/stable-queue.git] / scripts / quilt-mail
1 #!/bin/bash
2
3 # locations of some things that you might want to override if you are a
4 # different developer than gregkh
5 STABLE_QUEUE="/home/gregkh/linux/stable/stable-queue/"
6 TMP_DIR="/home/gregkh/linux/tmp/"
7
8
9 SCRIPT_NAME=`basename ${0}`
10 MBOX="$1"
11 if [ "${MBOX}" == "" ] ; then
12 echo "ERROR, you must specify a mailbox name."
13 echo "usage:"
14 echo " ${SCRIPT_NAME} mailbox_name"
15 exit
16 fi
17
18 FULL_VERSION=`kv`
19 BASE_VERSION=${FULL_VERSION/-rc?/}
20 VERSION=`basename \`pwd\``
21 ROOT_VERSION=${VERSION/\.y/}
22 ROOT_VERSION=${ROOT_VERSION/linux-/}
23
24 REL_ARRAY=(${FULL_VERSION//./ })
25 MAJOR=${REL_ARRAY[0]}
26 VER="${MAJOR}.x"
27
28 DATE=`date -u --date="2 days"`
29
30 if [ ${FULL_VERSION} == ${BASE_VERSION} ] ; then
31 echo "Makefile says the version is ${FULL_VERSION}, did you forget to set the -rc version?"
32 exit
33 fi
34
35
36 # create a directory for everything to live in
37 TMP_DIR=`mktemp -d ${TMP_DIR}/stable-${ROOT_VERSION}-XXXX` || exit 1
38
39 # Generate the Makefile diff, with just the version number change in it
40 # relies on filterdiff from the wonderful patchutils package
41 git diff Makefile | filterdiff --hunks 1 > ${TMP_DIR}/Makefile.patch
42
43
44 # make a git tree to create the log file in the format that Linus likes.
45 echo "Creating a git tree of the commits..."
46 ORIGINAL_DIR=`pwd`
47 TMP_TREE=`mktemp -d ${TMP_DIR}/stable-${ROOT_VERSION}-XXXX` || exit 1
48 TMP_LOG=`mktemp ${TMP_DIR}/stable-log-XXXX` || exit 1
49 git clone -s . ${TMP_TREE}
50 cd ${TMP_TREE}
51 git checkout -b temp_branch
52 git quiltimport --patches=${STABLE_QUEUE}/queue-${ROOT_VERSION}
53
54 # Apply the Makefile patch and commit it
55 patch -p1 < ${TMP_DIR}/Makefile.patch
56 git commit -a -m "Linux ${FULL_VERSION}"
57
58 # Generate the diffstat and patch
59 git diff ${VERSION}..HEAD > ${TMP_DIR}/patch-${FULL_VERSION}
60 git diff --stat ${VERSION}..HEAD > ${TMP_DIR}/diffstat
61
62 # sign the patch
63 gpg -a -b ${TMP_DIR}/patch-${FULL_VERSION}
64
65 # generate the log file
66 git log --abbrev=12 --format="%aN <%aE>%n %s%n" ${VERSION}..HEAD > ${TMP_LOG}
67
68 # clean up the git tree by deleting it
69 cd ${ORIGINAL_DIR}
70 #rm -rf ${TMP_TREE}
71
72
73 echo "Creating the mailbox for kernel release ${FULL_VERSION}"
74 TMPFILE=`mktemp ${TMP_DIR}/stable_header.XXXXXX` || exit 1
75 NUM_PATCHES=`quilt series | wc -l`
76
77 (
78 echo "This is the start of the stable review cycle for the ${BASE_VERSION} release."
79 echo "There are ${NUM_PATCHES} patches in this series, all will be posted as a response"
80 echo "to this one. If anyone has any issues with these being applied, please"
81 echo "let me know."
82 echo ""
83 echo "Responses should be made by ${DATE}."
84 echo "Anything received after that time might be too late."
85 echo ""
86 echo "The whole patch series can be found in one patch at:"
87 echo " kernel.org/pub/linux/kernel/v${VER}/stable-review/patch-${FULL_VERSION}.gz"
88 echo "or in the git tree and branch at:"
89 echo " git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-${ROOT_VERSION}.y"
90 echo "and the diffstat can be found below."
91 echo ""
92 echo "thanks,"
93 echo ""
94 echo "greg k-h"
95 echo ""
96 echo "-------------"
97 echo "Pseudo-Shortlog of commits:"
98 echo ""
99 cat ${TMP_LOG}
100 #stable-shortlog
101 echo ""
102 echo "-------------"
103 echo ""
104 echo "Diffstat:"
105 echo ""
106
107 cat ${TMP_DIR}/diffstat
108 ) > ${TMPFILE}
109
110 FROM="Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
111 TO="linux-kernel@vger.kernel.org"
112 #CC="torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk"
113 #CC="alan@lxorguk.ukuu.org.uk"
114 CC="stable@vger.kernel.org"
115 SUBJECT="${BASE_VERSION}-stable review"
116
117 quilt mail --mbox ${TMP_DIR}/${MBOX} \
118 -m "$(cat ${TMPFILE})" \
119 --sender "${FROM}" \
120 --from "${FROM}" \
121 --to "${TO}" \
122 --cc "${CC}" \
123 --prefix "PATCH ${ROOT_VERSION}" \
124 --subject "${SUBJECT}"
125
126 rm ${TMPFILE} ${TMP_LOG}
127
128 echo "mbox is now in ${TMP_DIR}/${MBOX}"
129
130 #echo "Add:"
131 #echo "Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org"
132 #echo "to the first email."
133
134 #q mail --mbox x -m "$(cat ../stable-queue/00)" --sender gregkh@lf.org --from gregkh@lf.org --to foo@foo --subject "This is the subject"
135
136 cd ${TMP_DIR}
137 ${STABLE_QUEUE}../mbox2send ${ROOT_VERSION} ${FULL_VERSION} ${MBOX}
138 #< ${MBOX}.new formail -ds sh -c 'cat > msg.$FILENO'
139 splitmbox.py ${MBOX}.new .
140
141 # Add Linus and Andrew and others to the first email only:
142 #sed -i -e "s/Cc: alan@lxorguk\.ukuu\.org\.uk/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, alan@lxorguk\.ukuu\.org\.uk/" ${TMP_DIR}/msg.000
143 #sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, stable@vger\.kernel\.org/" ${TMP_DIR}/msg.000
144 #sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, linux@roeck-us\.net, shuah\.kh@samsung\.com, stable@vger\.kernel\.org/" ${TMP_DIR}/msg.000
145 #sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, linux@roeck-us\.net, shuah\.kh@samsung\.com, patches@kernelci\.org stable@vger\.kernel\.org/" ${TMP_DIR}/msg.000
146 sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, linux@roeck-us\.net, shuah\.kh@samsung\.com, patches@kernelci\.org ben\.hutchings@codethink\.co\.uk stable@vger\.kernel\.org/" ${TMP_DIR}/msg.000
147
148
149 # Create a script to upload the patch to kernel.org and to send the patches out
150 echo "#!/bin/bash" > ${TMP_DIR}/send_it_off
151 echo "kup --host=gregkh@geb.kernel.org put patch-${FULL_VERSION} patch-${FULL_VERSION}.asc /pub/linux/kernel/v${VER}/stable-review/patch-${FULL_VERSION}.gz" >> ${TMP_DIR}/send_it_off
152 echo "git send-email msg.*" >> ${TMP_DIR}/send_it_off
153 chmod 755 ${TMP_DIR}/send_it_off
154
155
156 # Push a version of the patches out to the world in a git tree
157 cd ${TMP_TREE}
158 git checkout linux-${ROOT_VERSION}.y
159 #git merge -q temp_branch^
160 git merge -q temp_branch
161 echo "git push --force gitolite@ra.kernel.org:/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-${ROOT_VERSION}.y"
162 git push --force gitolite@ra.kernel.org:/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-${ROOT_VERSION}.y
163
164 # clean up the git tree by deleting it
165 cd ${ORIGINAL_DIR}
166 rm -rf ${TMP_TREE}
167
168 # announce what needs to be done
169 echo "cd ${TMP_DIR}"
170 echo "./send_it_off"