#!/bin/sh # # A script to parse the history file to pick out # all the active tags related to a given integration # release. # # Allow terminated tags: # # MakeIntRetags v4_9_0: 4.9.0.retags # # will retrieve v4_9_0 tags from amongts 4.9.0, 4.9.0preN and # 4.9.0intN tags. While # # MakeIntRetags v4_9_0 4.9.0x.retags # # will contain the pre and int tags as well. # # Only add packages tagged on the head by default if # .newrel is revision 1.1 in repository. # # Add packages which, by default are to be tagged on the HEAD # of the repository ( the latest revisions ). These will be # processed such that any REAL tag will override them. # Default_tag_on_head="Distribution \ SRT_CDF \ Validation" # CDF_CVSROOT=":pserver:anonymous@cdfcvs.fnal.gov:/cdf/code/cdfcvs/run2" tag=${1} output_file=`pwd`/${2} time=${3} [ "${time}" = "" ] && time="21 days ago" hp='\['${tag} [ -f ${output_file} ] && rm ${output_file} [ -f ${output_file}.tmp ] && rm ${output_file}.tmp [ -f ${output_file}.tmp1 ] && rm ${output_file}.tmp1 [ -f /tmp/CDF_hist ] && rm /tmp/CDF_hist [ -f /tmp/ZOOM_hist ] && rm /tmp/ZOOM_hist [ -f /tmp/SRT_hist ] && rm /tmp/SRT_hist touch "${output_file}" touch "${output_file}".tmp UPS_SHELL=sh;export UPS_SHELL . `$UPS_DIR/bin/ups setup ups` #setup cdfsoft2 development #My_dir=$CDFSOFT2_DIR/Release/Scripts; export My_dir [ -d /tmp/MakeIntRetags.$$ ] && rm -r /tmp/MakeIntRetags.$$ mkdir /tmp/MakeIntRetags.$$ cd /tmp/MakeIntRetags.$$ cvs -Q -d ${CDF_CVSROOT} checkout Distribution/packages if [ -z "${My_dir}" ] then cvs -Q -d ${CDF_CVSROOT} checkout Release/Scripts if [ -f /tmp/MakeIntRetags.$$/Release/Scripts/Prebuild_new_release ] then My_dir=/tmp/MakeIntRetags.$$/Release/Scripts; export My_dir else echo ' ERROR: Failed to get Release scripts for use' cd [ -d /tmp/MakeIntRetags.$$ ] && rm -r /tmp/MakeIntRetags.$$ exit fi # exec ${My_dir}/MakeIntRetags fi CVSROOT=`${My_dir}/Find_cvs_root CDF-REP | cut -f1 -d','` cvs -d $CVSROOT history -T -D"${time}" -a | grep ${hp} | grep -v ':D]' | \ grep -v 4.1.0pre > \ /tmp/CDF_hist CVSROOT=`${My_dir}/Find_cvs_root ZOOM-REP | cut -f1 -d','` cvs -d $CVSROOT history -T -D"${time}" -a | grep ${hp} | grep -v ':D]' >> \ /tmp/ZOOM_hist CVSROOT=`${My_dir}/Find_cvs_root SRT-REP | cut -f1 -d','` cvs -d $CVSROOT history -T -D"${time}" -a | grep ${hp} | grep -v ':D]' >> \ /tmp/SRT_hist cat /tmp/CDF_hist /tmp/ZOOM_hist /tmp/SRT_hist > /tmp/$$_hist echo '' echo "Processing history of ${tag} activity" while read hist_str do set ${hist_str} module=${6} tag_inf=`echo ${7}|cut -f1 -d':'|cut -c2-` package=`echo ${module} | cut -f1 -d'/'` if [ "`echo $module | sed s%${package}%%`" = '/' ] then module=${package} fi p_test=`grep '^'${package}'$' /tmp/MakeIntRetags.$$/Distribution/packages` if [ "$p_test" != '' ] then Rep=`${My_dir}/Find_cvs_root ${package} | cut -f3 -d','` if [ "`grep ${package} /tmp/${Rep}_hist | grep ${tag_inf}':'`" = "" ] then [ "`grep ${package} /tmp/CDF_hist|grep ${tag_inf}':'`" != '' ] && \ w_rep=CDF [ "`grep ${package} /tmp/ZOOM_hist|grep ${tag_inf}':'`" != '' ] && \ w_rep="${w_rep} ZOOM" [ "`grep ${package} /tmp/SRT_hist|grep ${tag_inf}':'`" != '' ] && \ w_rep="${w_rep} SRT" echo '' echo '* '"$package was tagged as ${tag_inf} in ${w_rep} repository" echo '* '"But not in ${Rep} repository." echo ${hist_str} echo "Skipping ${module}" else echo ${module} '-r' ${tag_inf} >> ${output_file}.tmp fi o_package=${package} fi done < /tmp/$$_hist rm /tmp/$$_hist if [ -f ${output_file}.tmp ] then if [ "`echo ${tag} | grep int`" ] then CVSROOT=`${My_dir}/Find_cvs_root CDF-REP | cut -f1 -d','` # cvsroot cdf > /dev/null o_wd=`pwd` cd $CDFSOFT2_DIR rel=`echo $tag | cut -c2- | tr '_' '.' | cut -f1 -d'i'` int=`echo $tag | cut -f2 -d 't' | cut -c1` release=${rel}int${int} test=`cvs -d $CVSROOT status \ Release/Releases/${release}.newrel 2>/dev/null | \ grep "Working revision:" | sed 's%Working revision:%%'` if [ -n "$test" ] then set $test test=${1} else test='1.1' fi if [ "${test}" != "1.1" -a \ "${test}" != "no" -a \ "${test}" != "No" ] then Default_tag_on_head="" fi cd ${o_wd} for p in ${Default_tag_on_head} do echo ${p} '-r +HEAD' >> ${output_file}.tmp done fi sort -u -k1,1 -k3r ${output_file}.tmp > ${output_file}.tmp1 else echo "No tags match ${tag} - quitting" [ -d /tmp/MakeIntRetags.$$ ] && rm -r /tmp/MakeIntRetags.$$ exit fi echo '' echo "Formatting ${output_file} for retagger" Package_only=no p_tag='' ${My_dir}/prepare_retags ${output_file}.tmp1 mv ${output_file}.tmp1 ${output_file} #rm ${output_file}.tmp #[ -f /tmp/CDF_hist ] && rm /tmp/CDF_hist [ -f /tmp/ZOOM_hist ] && rm /tmp/ZOOM_hist [ -f /tmp/SRT_hist ] && rm /tmp/SRT_hist echo '' echo " Please review ${output_file} for logical inconsistancies" echo '' [ -d /tmp/MakeIntRetags.$$ ] && rm -r /tmp/MakeIntRetags.$$ echo Done.