From cfad79a1039a5ff818c926f831b78328dc1e4627 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 28 Sep 2010 06:46:20 +0000 Subject: [PATCH] Added diffstat generation. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2294 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/generate-kernel-patch | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index 15dcec29b..2088b2cdf 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -124,14 +124,24 @@ function specialize_patch { # and write the output either to stdout or to the file $1 (if not empty), # depending on the value of the variable ${multiple_patches}. function process_patch { + local tmppatch if [ "${multiple_patches}" = "true" ]; then if [ "$1" != "" ]; then if [ -e "${patchdir}/$1" ]; then echo "Warning: overwriting ${patchdir}/$1" fi - ( - specialize_patch - ) >"${patchdir}/$(basename $1)" + tmppatch="/tmp/scst-tmp-patch-$$" + ( + specialize_patch + ) >"${tmppatch}" + touch "${tmppatch}" + { + awk 'BEGIN{h=1}/^diff/{h=0}/^---/{h=0}h!=0{print}' < "${tmppatch}"; + echo "---"; diffstat "${tmppatch}"; echo ""; + awk 'BEGIN{h=1}/^diff/{h=0}/^---/{h=0}h==0{print}' < "${tmppatch}"; + } \ + > "${patchdir}/$(basename $1)" + rm -f "${tmppatch}" else # echo "Discarded $(wc -l) lines." true