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