| #!/bin/bash |
| |
| # Layer on a patch queue pending for a stable release. |
| # |
| # We pretend it is a quilt series queue, but we don't |
| # use quilt or "git quiltimport", since the latter can |
| # construct missing fields that quilt doesn't care about. |
| # Since we format-patch'd them, we might as well git-am |
| # them. |
| |
| |
| # BASE_VER=v2.6.34 |
| |
| if [ ! -f Makefile ]; then |
| echo No Makefile found, are you in a bare clone? |
| exit 1 |
| fi |
| |
| VERSION=`grep '^VERSION =' Makefile |awk '{print $3}'` |
| PATCHLEVEL=`grep '^PATCHLEVEL =' Makefile |awk '{print $3}'` |
| SUBLEVEL=`grep '^SUBLEVEL =' Makefile |awk '{print $3}'` |
| |
| BASE_VER=v$VERSION.$PATCHLEVEL.$SUBLEVEL |
| |
| # Length of review cycle. |
| HOURS=72 |
| |
| HERE=`dirname $0` |
| HEADER=$HERE/../misc/header |
| QUEUE_PATH=$HERE/../queue |
| |
| SERIES=$QUEUE_PATH/series |
| if [ ! -f $SERIES ];then |
| echo no series file in $QUEUE_PATH |
| exit 1 |
| fi |
| |
| DOT=0 |
| while [ 1 ]; do |
| EXTRA_VER=$BASE_VER.$DOT |
| git rev-parse $BASE_VER.$[$DOT+1] > /dev/null 2>&1 |
| if [ $? != 0 ]; then |
| break |
| fi |
| DOT=$[$DOT+1] |
| done |
| |
| if [ $DOT = 0 ];then |
| echo failed to find tags for $BASE_VER in $PWD |
| echo check you are in a kernel git repo for stable |
| exit 1 |
| fi |
| |
| DOT=$[$DOT+1] |
| |
| # Only used in the dir name for the gse patch queue |
| DATE=`date --iso-8601=date` |
| |
| BRANCH=$BASE_VER.$DOT-queue-$DATE |
| git checkout -b $BRANCH $EXTRA_VER |
| if [ $? != 0 ]; then |
| echo failed to checkout a branch based on $EXTRA_VER |
| exit 1 |
| fi |
| |
| # Manually AM the list |
| COUNT=0 |
| for i in `cat $SERIES | grep '^[a-zA-Z0-9_]'` |
| do |
| COUNT=$[$COUNT+1] |
| if [ ! -f "$QUEUE_PATH/$i" ];then |
| echo File $QUEUE_PATH/$i doesnt exist |
| exit 1 |
| fi |
| |
| echo -n "$COUNT: " |
| git am --keep-non-patch $QUEUE_PATH/$i |
| if [ $? != 0 ];then |
| echo commit $COUNT: git am of $i failed. STBU. |
| exit 1 |
| fi |
| done |
| |
| # Crap them back out as a numbered, prefixed group for gse. |
| |
| PATCHLOG=`mktemp` |
| |
| if [ -d $BRANCH-patches ]; then |
| echo moving old $BRANCH-patches to $BRANCH-patches~ |
| mv -f $BRANCH-patches $BRANCH-patches~ |
| fi |
| |
| echo Creating patches in $BRANCH-patches |
| git format-patch --cover-letter --subject-prefix="v2.6.34-stable" \ |
| -o $BRANCH-patches $EXTRA_VER..$BRANCH > $PATCHLOG 2>&1 |
| if [ $? != 0 ]; then |
| echo format patch didnt return zero - check results\! |
| echo Log is in $PATCHLOG |
| exit 1 |
| fi |
| rm -f $PATCHLOG |
| |
| NEWCOUNT=`ls -1 $BRANCH-patches/|grep -v 0000-cover-letter.patch|wc -l` |
| if [ $COUNT -ne $NEWCOUNT ];then |
| echo incorrect patch count, expected $COUNT, got $NEWCOUNT |
| exit 1 |
| fi |
| |
| # Now fixup the cover letter. |
| MESSAGE=`mktemp` |
| cat <<EOF > $MESSAGE |
| This is the start of the longterm review cycle for the $BASE_VER.$DOT release. |
| There are $COUNT patches in this series, all will be posted as a response |
| to this one. If anyone has any issues with these being applied, please |
| let us know. If anyone is a maintainer of the proper subsystem, and |
| wants to add a Signed-off-by: line to the patch, please respond with it. |
| |
| The full queue can be found at: |
| http://git.kernel.org/?p=linux/kernel/git/paulg/longterm-queue-2.6.34.git |
| |
| Please try to get reponses made within $HOURS hours, or it may be too late. |
| |
| Thanks, |
| Paul. |
| --- |
| EOF |
| |
| sed -i 's/\*\*\* SUBJECT HERE \*\*\*/'$BASE_VER.$DOT' longterm review/' \ |
| $BRANCH-patches/0000-cover-letter.patch |
| |
| ( echo '/BLURB HERE/d' ;echo ".-1r $MESSAGE" ; echo w ; echo q) |\ |
| ed -s $BRANCH-patches/0000-cover-letter.patch |
| |
| # And munge a header onto each patch... |
| for i in `ls -1 $BRANCH-patches/|grep -v 0000-cover-letter.patch` ; do |
| (echo '/^$/,r '$HEADER ; echo w ; echo q ) | ed -s $BRANCH-patches/$i |
| if [ $? != 0 ];then |
| echo adding header to $i failed |
| exit 1 |
| fi |
| done |
| |
| MT=`find $BRANCH-patches -empty` |
| if [ -n "$MT" ]; then |
| echo something evil happened. You have zero sized patches in: |
| echo $MT |
| exit 1 |
| fi |
| |
| exit 0 |