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