#! /bin/bash # creating a broken out RT patch set #----- process script arguments diff_patches=0 diff_series=0 save_diff=0 verbose=0 old_argc=0 while [[ ($# != ${old_argc}) && ($# > 0) ]] ; do old_argc=$# case $1 in -h | -help | --help ) shift $# ;; --patches ) diff_patches=1 shift 1;; --sd ) save_diff=1 diff_file=$2 shift 2;; --series ) diff_series=1 shift 1;; -v | --verbose ) verbose=1 shift ;; esac done if (( ($# < 1) || ($# > 2) )) ; then echo "" >&2 echo "usage: `basename $0` OLD_RT_KERNEL_VERSION NEW_RT_KERNEL_VERSION" >&2 echo " -h print this usage text" >&2 echo " -help synonym for -h" >&2 echo " --help synonym for -h" >&2 echo " --sd FILE save diff file as FILE" >&2 echo " -v verbose output" >&2 echo " -verbose synonym for -v" >&2 echo " --verbose synonym for -v" >&2 echo "" >&2 echo " examples:" >&2 echo " compare 3.0.12-rt29 to 3.0.32-rt52" >&2 echo " `basename $0` 3.0.12-rt29 3.0.32-rt52" >&2 echo "" >&2 echo " notes:" >&2 echo "" >&2 echo " --patches does not show changes to the series file," >&2 echo " contents of deleted patches, and contents" >&2 echo " of added patches" >&2 echo "" >&2 exit 1 fi # Choose the versions to be compared #old_rt_version=3.0.12-rt29 #new_rt_version=3.0.23-rt38 old_rt_version=$1 old_patch_dir=patches_${old_rt_version} new_rt_version=$2 new_patch_dir=patches_${new_rt_version} #----- error checks if [[ ! -d ${old_patch_dir} ]] ; then echo "" >&2 echo "ERROR:" >&2 echo " Root patch directory ${old_patch_dir} does not exist" >&2 echo "" >&2 exit 1 fi if [[ ! -d ${new_patch_dir} ]] ; then echo "" >&2 echo "ERROR:" >&2 echo " Root patch directory ${new_patch_dir} does not exist" >&2 echo "" >&2 exit 1 fi if [[ "${diff_patches}" == "0" && "${diff_series}" == "0" ]] ; then echo "" >&2 echo "ERROR:" >&2 echo " no type of diff specified" >&2 echo "" >&2 exit 1 fi #----- patches added or deleted # two different ways to see the same info, comment out the second way if [[ "${diff_series}" == "1" ]] ; then echo diff -u {${old_patch_dir},${new_patch_dir}}/series \ | grep -v "^--- " \ | grep -v "^\+\+\+ " \ | grep "^[-]" \ | sort echo diff -u {${old_patch_dir},${new_patch_dir}}/series \ | grep -v "^--- " \ | grep -v "^\+\+\+ " \ | grep "^[+]" \ | sort # echo # echo # # cat ${diff_file} | grep "^Only in ${old_patch_dir}" | sort # # echo # # cat ${diff_file} | grep "^Only in ${new_patch_dir}" | sort echo fi #----- Changes to patch files if [[ "${diff_patches}" == "1" ]] ; then if [[ "${save_diff}" == "1" ]] ; then if [[ "${diff_file}" == "" ]] ; then echo "" >&2 echo "ERROR:" >&2 echo " -sd FILE name is blank" >&2 echo "" >&2 exit 1 fi if [[ -a ${diff_file} ]] ; then echo "" >&2 echo "ERROR:" >&2 echo " ${diff_file} already exists" >&2 echo "" >&2 exit 1 fi else diff_file=`mktemp` fi diff -x series -ru ${old_patch_dir}/ ${new_patch_dir}/ > ${diff_file} # (the files which are listed, but contain no # + or - lines are due to # changed commit IDs and Subject lines from rebasing) # # Changes that are "^[+-][+-]" are changes to the patch. # # Changes that are "^[+-] " are changes of context. cat ${diff_file} \ | grep -v "^[+-]From " \ | grep -v "^[+-]Subject: " \ | grep -v "^--- ${old_patch_dir}" \ | grep -v "^+++ ${new_patch_dir}" \ | grep -E "(^diff |^[+-])" \ | grep -v "^[+-]index " \ | grep -v "^[+-]@@ " #----- clean up if [[ "${save_diff}" == "0" ]] ; then rm ${diff_file} fi fi #=============================================================================== #_______________________________________________________________________________ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ #* _________________________________________________________________________ */ #* vi config follows: */ #* ~/.exrc must contain "set modelines" for tabs to be set automatically */ #* ex:set tabstop=3 shiftwidth=3 sts=3: */