]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - scripts/quilt-mail
scripts: quilt-mail: fix up for any number of patches in a series
[thirdparty/kernel/stable-queue.git] / scripts / quilt-mail
CommitLineData
59d5c8eb 1#!/bin/bash
ce36a6e4
GKH
2#
3# Script to take a stable-queue, and turn it into a -rc release to be
4# sent off in email.
5#
59d5c8eb 6
648a1bee
GKH
7# locations of some things that you might want to override if you are a
8# different developer than gregkh
9STABLE_QUEUE="/home/gregkh/linux/stable/stable-queue/"
10TMP_DIR="/home/gregkh/linux/tmp/"
11
e91e330a 12SCRIPT_NAME=`basename ${0}`
ce36a6e4
GKH
13DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
14
15# programs that we depend on in this script
16REQUIREMENTS="kv splitmbox.py kup mbox2send filterdiff"
17# todo check dependancies using hash or something
18
19
e91e330a
GKH
20MBOX="$1"
21if [ "${MBOX}" == "" ] ; then
ce36a6e4
GKH
22 echo "using default 'mbox' name for the mailbox."
23 MBOX="mbox"
e91e330a
GKH
24fi
25
b8d4fad7 26FULL_VERSION=`kv`
59d5c8eb 27BASE_VERSION=${FULL_VERSION/-rc?/}
648a1bee
GKH
28VERSION=`basename \`pwd\``
29ROOT_VERSION=${VERSION/\.y/}
30ROOT_VERSION=${ROOT_VERSION/linux-/}
ccd583c9
GKH
31
32REL_ARRAY=(${FULL_VERSION//./ })
33MAJOR=${REL_ARRAY[0]}
54f3a4af 34VER="${MAJOR}.x"
ccd583c9 35
6dd6cb63
GKH
36RC_ARRAY=(${FULL_VERSION//-/ })
37RC=${RC_ARRAY[1]}
38
78a4731d
GKH
39#DATE=`date -u --date="2 days"`
40DATE=`date -u --rfc-822 --date="2 days"`
59d5c8eb
GKH
41
42if [ ${FULL_VERSION} == ${BASE_VERSION} ] ; then
43 echo "Makefile says the version is ${FULL_VERSION}, did you forget to set the -rc version?"
44 exit
45fi
46
e91e330a 47
648a1bee
GKH
48# create a directory for everything to live in
49TMP_DIR=`mktemp -d ${TMP_DIR}/stable-${ROOT_VERSION}-XXXX` || exit 1
50
6ee96ac1
GKH
51# Generate the Makefile diff, with just the version number change in it
52# relies on filterdiff from the wonderful patchutils package
53git diff Makefile | filterdiff --hunks 1 > ${TMP_DIR}/Makefile.patch
54
648a1bee
GKH
55
56# make a git tree to create the log file in the format that Linus likes.
648a1bee
GKH
57echo "Creating a git tree of the commits..."
58ORIGINAL_DIR=`pwd`
59TMP_TREE=`mktemp -d ${TMP_DIR}/stable-${ROOT_VERSION}-XXXX` || exit 1
60TMP_LOG=`mktemp ${TMP_DIR}/stable-log-XXXX` || exit 1
61git clone -s . ${TMP_TREE}
62cd ${TMP_TREE}
63git checkout -b temp_branch
64git quiltimport --patches=${STABLE_QUEUE}/queue-${ROOT_VERSION}
41d6205e
GKH
65if [ $? -ne 0 ]; then
66 echo "git quilt import failed!!!"
67 exit 1
68fi
6ee96ac1
GKH
69
70# Apply the Makefile patch and commit it
71patch -p1 < ${TMP_DIR}/Makefile.patch
72git commit -a -m "Linux ${FULL_VERSION}"
73
74# Generate the diffstat and patch
75git diff ${VERSION}..HEAD > ${TMP_DIR}/patch-${FULL_VERSION}
76git diff --stat ${VERSION}..HEAD > ${TMP_DIR}/diffstat
77
78# sign the patch
79gpg -a -b ${TMP_DIR}/patch-${FULL_VERSION}
80
81# generate the log file
648a1bee 82git log --abbrev=12 --format="%aN <%aE>%n %s%n" ${VERSION}..HEAD > ${TMP_LOG}
6ee96ac1
GKH
83
84# clean up the git tree by deleting it
648a1bee 85cd ${ORIGINAL_DIR}
f29e8e36 86#rm -rf ${TMP_TREE}
59d5c8eb 87
648a1bee
GKH
88
89echo "Creating the mailbox for kernel release ${FULL_VERSION}"
90TMPFILE=`mktemp ${TMP_DIR}/stable_header.XXXXXX` || exit 1
59d5c8eb
GKH
91NUM_PATCHES=`quilt series | wc -l`
92
93(
94echo "This is the start of the stable review cycle for the ${BASE_VERSION} release."
95echo "There are ${NUM_PATCHES} patches in this series, all will be posted as a response"
96echo "to this one. If anyone has any issues with these being applied, please"
e91e330a 97echo "let me know."
59d5c8eb
GKH
98echo ""
99echo "Responses should be made by ${DATE}."
100echo "Anything received after that time might be too late."
101echo ""
102echo "The whole patch series can be found in one patch at:"
69849ec2 103echo " https://www.kernel.org/pub/linux/kernel/v${VER}/stable-review/patch-${FULL_VERSION}.gz"
f29e8e36 104echo "or in the git tree and branch at:"
69849ec2 105echo " git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-${ROOT_VERSION}.y"
59d5c8eb
GKH
106echo "and the diffstat can be found below."
107echo ""
108echo "thanks,"
109echo ""
110echo "greg k-h"
111echo ""
112echo "-------------"
648a1bee 113echo "Pseudo-Shortlog of commits:"
5a92fab8 114echo ""
648a1bee
GKH
115cat ${TMP_LOG}
116#stable-shortlog
5a92fab8
GKH
117echo ""
118echo "-------------"
119echo ""
120echo "Diffstat:"
121echo ""
122
6ee96ac1 123cat ${TMP_DIR}/diffstat
59d5c8eb
GKH
124) > ${TMPFILE}
125
648a1bee 126FROM="Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
9067845c 127TO="linux-kernel@vger.kernel.org"
9067845c 128CC="stable@vger.kernel.org"
1261bd4e
GKH
129#SUBJECT="${BASE_VERSION}-stable review"
130SUBJECT="${FULL_VERSION} review"
59d5c8eb 131
648a1bee 132quilt mail --mbox ${TMP_DIR}/${MBOX} \
699664de 133 -M "${TMPFILE}" \
59d5c8eb
GKH
134 --sender "${FROM}" \
135 --from "${FROM}" \
136 --to "${TO}" \
137 --cc "${CC}" \
aa2ca693 138 --prefix "PATCH ${ROOT_VERSION}" \
59d5c8eb
GKH
139 --subject "${SUBJECT}"
140
648a1bee
GKH
141rm ${TMPFILE} ${TMP_LOG}
142
143echo "mbox is now in ${TMP_DIR}/${MBOX}"
e91e330a 144
648a1bee 145cd ${TMP_DIR}
6396d71a 146${STABLE_QUEUE}/scripts/mbox2send ${ROOT_VERSION} ${FULL_VERSION} ${MBOX}
a1840513
GKH
147#< ${MBOX}.new formail -ds sh -c 'cat > msg.$FILENO'
148splitmbox.py ${MBOX}.new .
648a1bee 149
f4e925a9
GKH
150# find the "0" email message
151if [ -f "msg.0" ]; then
152 MSG="msg.0"
153elif [ -f "msg.00" ]; then
154 MSG="msg.00"
155elif [ -f "msg.000" ]; then
156 MSG="msg.000"
157elif [ -f "msg.0000" ]; then
158 MSG="msg.0000"
159else
160 echo "mbox.ZERO can not be found???"
161 echo "Aborting!"
162 exit 1
163fi
164echo "MSG=${MSG}"
165
c2d74301 166# Add Linus and Andrew and others to the first email only:
9067845c 167#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
d8f819c5 168#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
468b5721 169#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
c2d74301 170#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
bef0d6c8 171#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
089f4a04 172#sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, linux@roeck-us\.net, shuahkh@osg\.samsung\.com, patches@kernelci\.org, ben\.hutchings@codethink\.co\.uk, stable@vger\.kernel\.org/" ${TMP_DIR}/msg.000
95ce1dfc 173#sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, linux@roeck-us\.net, shuahkh@osg\.samsung\.com, patches@kernelci\.org, ben\.hutchings@codethink\.co\.uk, lkft-triage@lists\.linaro\.org, stable@vger\.kernel\.org/" ${TMP_DIR}/msg.000
b4928eae 174#sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, linux@roeck-us\.net, shuah@kernel\.org, patches@kernelci\.org, ben\.hutchings@codethink\.co\.uk, lkft-triage@lists\.linaro\.org, stable@vger\.kernel\.org/" ${TMP_DIR}/msg.000
200dab58 175#sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, linux@roeck-us\.net, shuah@kernel\.org, patches@kernelci\.org, ben\.hutchings@codethink\.co\.uk, lkft-triage@lists\.linaro\.org, pavel@denx\.de, stable@vger\.kernel\.org/" ${TMP_DIR}/msg.000
2be9ba73 176#sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, linux@roeck-us\.net, shuah@kernel\.org, patches@kernelci\.org, lkft-triage@lists\.linaro\.org, pavel@denx\.de, stable@vger\.kernel\.org/" ${TMP_DIR}/msg.000
b38ab012 177#sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, linux@roeck-us\.net, shuah@kernel\.org, patches@kernelci\.org, lkft-triage@lists\.linaro\.org, pavel@denx\.de, jonathanh@nvidia\.com, stable@vger\.kernel\.org/" ${TMP_DIR}/msg.000
b1a585a9 178#sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, linux@roeck-us\.net, shuah@kernel\.org, patches@kernelci\.org, lkft-triage@lists\.linaro\.org, pavel@denx\.de, jonathanh@nvidia\.com, f\.fainelli@gmail\.com, stable@vger\.kernel\.org/" ${TMP_DIR}/msg.000
f4e925a9
GKH
179#sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, linux@roeck-us\.net, shuah@kernel\.org, patches@kernelci\.org, lkft-triage@lists\.linaro\.org, pavel@denx\.de, jonathanh@nvidia\.com, f\.fainelli@gmail\.com, sudipm\.mukherjee@gmail\.com, stable@vger\.kernel\.org/" ${TMP_DIR}/msg.000
180sed -i -e "s/Cc: stable@vger\.kernel\.org/Cc: torvalds@linux-foundation\.org, akpm@linux-foundation\.org, linux@roeck-us\.net, shuah@kernel\.org, patches@kernelci\.org, lkft-triage@lists\.linaro\.org, pavel@denx\.de, jonathanh@nvidia\.com, f\.fainelli@gmail\.com, sudipm\.mukherjee@gmail\.com, stable@vger\.kernel\.org/" ${TMP_DIR}/${MSG}
6ee96ac1
GKH
181
182
183# Create a script to upload the patch to kernel.org and to send the patches out
184echo "#!/bin/bash" > ${TMP_DIR}/send_it_off
ba4c55c4 185echo "kup --host=git@gitolite.kernel.org --subcmd=kup-server put patch-${FULL_VERSION} patch-${FULL_VERSION}.asc /pub/linux/kernel/v${VER}/stable-review/patch-${FULL_VERSION}.gz" >> ${TMP_DIR}/send_it_off
6dd6cb63
GKH
186
187if [ "${RC}" == "rc1" ] ; then
188 echo "git send-email msg.*" >> ${TMP_DIR}/send_it_off
f4e925a9 189 echo "#git send-email ${MSG}" >> ${TMP_DIR}/send_it_off
6dd6cb63
GKH
190else
191 echo "#git send-email msg.*" >> ${TMP_DIR}/send_it_off
f4e925a9 192 echo "git send-email ${MSG}" >> ${TMP_DIR}/send_it_off
6dd6cb63
GKH
193fi
194
6ee96ac1
GKH
195chmod 755 ${TMP_DIR}/send_it_off
196
f29e8e36
GKH
197
198# Push a version of the patches out to the world in a git tree
199cd ${TMP_TREE}
200git checkout linux-${ROOT_VERSION}.y
5b9cdfb9 201git merge -q temp_branch
cf81b998
GKH
202#echo "git push --force gitolite@ra.kernel.org:/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-${ROOT_VERSION}.y"
203#git push --force gitolite@ra.kernel.org:/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-${ROOT_VERSION}.y
204echo "git push --force git@gitolite.kernel.org:/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-${ROOT_VERSION}.y"
205git push --force git@gitolite.kernel.org:/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-${ROOT_VERSION}.y
f29e8e36 206
b4a0b68d
GKH
207# clean up the git tree by deleting it
208cd ${ORIGINAL_DIR}
209rm -rf ${TMP_TREE}
f29e8e36 210
b4a0b68d 211# announce what needs to be done
648a1bee 212echo "cd ${TMP_DIR}"
6ee96ac1 213echo "./send_it_off"