#!/bin/sh # # Get_release_differences_by_package # # A script to display the differences between the the versions # of a package in two releases, or between a release and either # development or the head of the repository. # # Usage: # Get_release_differences_by_package options base_rel package comp_rel # # Options: # -m Display only the names of the files which # differ. # -v Display all detail about changes in files, # including output of the lines which differ. # -N Detect new files. # default Display the names of the changed files, the # revisions and the number of changes for each # file. Do not detect new files. # # CAUTION: The -N option can produce HUGE outputs with # -v. It can greatly extend the execution time # in default mode. However, in packages which are # expected to be relatively stable (few additional # files) it can provide a warning that something # has gone awry. # # Arguments: # base_rel The release to be compared. # package The name of the package to be singled # out for comparison. # comp_rel OPTIONAL # defaults to the head of the repository. # rep_opt='' diff_opt='' while getopts mvN OPT; do case $OPT in m) rep_opts='minimal' ;; v) rep_opts='verbose' ;; N) diff_opt='-N' ;; esac done shift `expr $OPTIND - 1` release1=${1} package=${2} release2=${3} [ -z "${release1}" ] && error=1 if [ -z "${release2}" ] then opt2='-D Now' elif [ "${release2}" = "development" ] then opt2='' else opt2='-r ${release2}' fi [ "${release1}" = "${release2}" ] && error=1 if [ "${error}" = "1" ] then echo "" echo 'Usage:' ${0} 'release1 package_name [release2]' echo "" echo Where release1 and release2 are different releases echo "" exit fi My_dir=$BFDIST/releases/development/Release/Scripts Work_space=`${My_dir}/define_work_area` cd ${Work_space} UPS_SHELL=sh; export UPS_SHELL . `$UPS_DIR/bin/ups setup ups` setup cdfsoft2 development #cvsroot if [ -d Release ] then rm -r Release fi cvs -Q checkout Release/Releases if [ ! -d Release ] then echo "" echo "Checkout of Release package, needed to continue, has failed" echo "" exit fi cd Release/Releases if [ ! -r ${release1}.newrel ] then echo "" echo "Nothing known about release ${release1}" echo "" exit fi if [ ! -r ${release2}.newrel -a "${release2}" != "" -a \ "${release2}" != "development" ] then echo "" echo "Nothing known about release ${release2}" echo "" exit fi cd $CDFSOFT2_DIR xtmp=`grep "^${package} " ${Work_space}/Release/Releases/${release1}.newrel` if [ "${xtmp}" = "" ] then echo '' echo ${package} is not known in release ${release1} exit fi set ${xtmp} pack=${1} tag=${2} if [ ! -z "${release2}" -a "${release2}" != "development" ] then xtmp=`grep "^${package} " ${Work_space}/Release/Releases/${release2}.newrel` if [ "${xtmp}" = "" ] then echo '' echo ${package} is not known in release ${release2} exit fi set ${xtmp} pack2=${1} tag2=${2} if [ "${tag2}" = "${tag}" ] then echo $pack unchanged exit else echo comparing ${pack} ${tag} \(${release1}\) with ${pack} ${tag2} \ \(${release2}\) cvs diff ${diff_opt} -r ${tag} -r ${tag2} ${pack} 2>/dev/null > \ ${Work_space}/${pack}_diff.log fi elif [ "${release2}" = "development" ] then echo comparing $pack ${tag} \(${release1}\) against development cvs diff ${diff_opt} -r ${tag} ${pack} 2>/dev/null > \ ${Work_space}/${pack}_diff.log else echo comparing ${pack} ${tag} \(${release1}\) against HEAD cvs diff ${diff_opt} -r ${tag} ${opt2} ${pack} 2>/dev/null > \ ${Work_space}/${pack}_diff.log fi if [ "${rep_opts}" = "verbose" ] then echo ' < indicates that the line was removed' echo ' > indicates the the line was added' echo '' cat ${Work_space}/${pack}_diff.log elif [ "${rep_opts}" = "minimal" ] then echo '' echo " The following files were changed :" echo "" grep "^Index: " ${Work_space}/${pack}_diff.log | sed 's%Index: % %g' else diff=0 while read -r diff_str do first_stuff="`echo ${diff_str} | cut -c1-4`" [ "${first_stuff}" = '====' ] && continue [ "${first_stuff}" = 'RCS f' ] && continue if [ "${first_stuff}" = 'retr' ] then not_new=1 continue fi if [ "${first_stuff}" = 'Inde' ] then if [ ${diff} -ne 0 ] then echo " ${diff} changes" diff=0 fi echo '----------------------------------------------' echo '' echo "`echo ${diff_str} | sed 's%Index: %%g'`" not_new=0 fi if [ "${first_stuff}" = 'diff' ] then if [ ${not_new} -eq 0 ] then echo "This file did not exist in ${release1}" else echo "`echo ${diff_str} | sed 's%diff% revisions:%' | \ sed 's%-r% %g'`" fi fi [ ${not_new} -eq 0 ] && continue first_char=`echo ${first_stuff} | cut -c1` if [ ${first_char} = '<' -o ${first_char} = '>' ] then diff=`expr ${diff} + 1` fi done < ${Work_space}/${pack}_diff.log [ ${diff} -ne 0 ] && echo " ${diff} changes" fi rm -r ${Work_space}/Release rm -r ${Work_space}/${pack}_diff.log