#!/bin/bash # locations of some things that you might want to override if you are a # different developer than gregkh STABLE_QUEUE="/home/gregkh/linux/stable/stable-queue/" TMP_DIR="/home/gregkh/linux/tmp/" SCRIPT_NAME=`basename ${0}` MBOX="$1" if [ "${MBOX}" == "" ] ; then echo "ERROR, you must specify a mailbox name." echo "usage:" echo " ${SCRIPT_NAME} mailbox_name" exit fi FULL_VERSION=`kv` BASE_VERSION=${FULL_VERSION/-rc?/} VERSION=`basename \`pwd\`` ROOT_VERSION=${VERSION/\.y/} ROOT_VERSION=${ROOT_VERSION/linux-/} REL_ARRAY=(${FULL_VERSION//./ }) MAJOR=${REL_ARRAY[0]} VER="${MAJOR}.x" DATE=`date -u --date="2 days"` if [ ${FULL_VERSION} == ${BASE_VERSION} ] ; then echo "Makefile says the version is ${FULL_VERSION}, did you forget to set the -rc version?" exit fi # create a directory for everything to live in TMP_DIR=`mktemp -d ${TMP_DIR}/stable-${ROOT_VERSION}-XXXX` || exit 1 # Generate the Makefile diff, with just the version number change in it # relies on filterdiff from the wonderful patchutils package git diff Makefile | filterdiff --hunks 1 > ${TMP_DIR}/Makefile.patch # make a git tree to create the log file in the format that Linus likes. echo "Creating a git tree of the commits..." ORIGINAL_DIR=`pwd` TMP_TREE=`mktemp -d ${TMP_DIR}/stable-${ROOT_VERSION}-XXXX` || exit 1 TMP_LOG=`mktemp ${TMP_DIR}/stable-log-XXXX` || exit 1 git clone -s . ${TMP_TREE} cd ${TMP_TREE} git checkout -b temp_branch git quiltimport --patches=${STABLE_QUEUE}/queue-${ROOT_VERSION} # Apply the Makefile patch and commit it patch -p1 < ${TMP_DIR}/Makefile.patch git commit -a -m "Linux ${FULL_VERSION}" # Generate the diffstat and patch git diff ${VERSION}..HEAD > ${TMP_DIR}/patch-${FULL_VERSION} git diff --stat ${VERSION}..HEAD > ${TMP_DIR}/diffstat # sign the patch gpg -a -b ${TMP_DIR}/patch-${FULL_VERSION} # generate the log file git log --abbrev=12 --format="%aN <%aE>%n %s%n" ${VERSION}..HEAD > ${TMP_LOG} # clean up the git tree by deleting it cd ${ORIGINAL_DIR} #rm -rf ${TMP_TREE} echo "Creating the mailbox for kernel release ${FULL_VERSION}" TMPFILE=`mktemp ${TMP_DIR}/stable_header.XXXXXX` || exit 1 NUM_PATCHES=`quilt series | wc -l` ( echo "This is the start of the stable review cycle for the ${BASE_VERSION} release." echo "There are ${NUM_PATCHES} patches in this series, all will be posted as a response" echo "to this one. If anyone has any issues with these being applied, please" echo "let me know." echo "" echo "Responses should be made by ${DATE}." echo "Anything received after that time might be too late." echo "" echo "The whole patch series can be found in one patch at:" echo " https://www.kernel.org/pub/linux/kernel/v${VER}/stable-review/patch-${FULL_VERSION}.gz" echo "or in the git tree and branch at:" echo " git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-${ROOT_VERSION}.y" echo "and the diffstat can be found below." echo "" echo "thanks," echo "" echo "greg k-h" echo "" echo "-------------" echo "Pseudo-Shortlog of commits:" echo "" cat ${TMP_LOG} #stable-shortlog echo "" echo "-------------" echo "" echo "Diffstat:" echo "" cat ${TMP_DIR}/diffstat ) > ${TMPFILE} FROM="Greg Kroah-Hartman " TO="linux-kernel@vger.kernel.org" #CC="torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk" #CC="alan@lxorguk.ukuu.org.uk" CC="stable@vger.kernel.org" SUBJECT="${BASE_VERSION}-stable review" quilt mail --mbox ${TMP_DIR}/${MBOX} \ -m "$(cat ${TMPFILE})" \ --sender "${FROM}" \ --from "${FROM}" \ --to "${TO}" \ --cc "${CC}" \ --prefix "PATCH ${ROOT_VERSION}" \ --subject "${SUBJECT}" rm ${TMPFILE} ${TMP_LOG} echo "mbox is now in ${TMP_DIR}/${MBOX}" #echo "Add:" #echo "Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org" #echo "to the first email." #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" cd ${TMP_DIR} ${STABLE_QUEUE}../mbox2send ${ROOT_VERSION} ${FULL_VERSION} ${MBOX} #< ${MBOX}.new formail -ds sh -c 'cat > msg.$FILENO' splitmbox.py ${MBOX}.new . # Add Linus and Andrew and others to the first email only: #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 #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 #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 #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 #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 #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 #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 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 # Create a script to upload the patch to kernel.org and to send the patches out echo "#!/bin/bash" > ${TMP_DIR}/send_it_off #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 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 echo "git send-email msg.*" >> ${TMP_DIR}/send_it_off chmod 755 ${TMP_DIR}/send_it_off # Push a version of the patches out to the world in a git tree cd ${TMP_TREE} git checkout linux-${ROOT_VERSION}.y #git merge -q temp_branch^ git merge -q temp_branch echo "git push --force gitolite@ra.kernel.org:/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-${ROOT_VERSION}.y" git push --force gitolite@ra.kernel.org:/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-${ROOT_VERSION}.y # clean up the git tree by deleting it cd ${ORIGINAL_DIR} rm -rf ${TMP_TREE} # announce what needs to be done echo "cd ${TMP_DIR}" echo "./send_it_off"