#!/bin/sh # # Purpose : a simple script to find the packages depending on a set of patches. Adapted # from sections of the script "Apply_patches". # # Modifications : # ------------------------------------------------------------------------------------- # 05.02.2001 Dave Waters Initial creation. The check to see whether # the dependency files are present is not # currently adequate. # usage() { echo "" echo 'Usage: Find_dependencies ' echo " Where:" echo " o is the release (development, or 3.8.0, or whatever) against which dependencies are to be checked. o is the file, either full path or relative to the current directory, containing the list of patches. CAUTION: This is a bourne shell script. USE \$HOME not '~'" echo "" } # Prepare the CDF software for a setup : # -------------------------------------- CDFSOFT_HOME=`csh -f -c "echo ~cdfsoft"` . ${CDFSOFT_HOME}/cdf2.shrc base_release=$1 patch_file=$2 error=0 old_cwd=`pwd` log_file=$HOME/patch.log echo "Output is being copied to : $log_file" if [ -f $log_file ] then rm -f $log_file fi # Perform some basic checks on the arguments : # -------------------------------------------- if [ "${base_release}" = "" ] then echo "ERROR: A base release is required." | tee -a ${log_file} error=1 elif [ ! -d ${BFDIST}/releases/${base_release} ] then echo "ERROR: Base release $BFDIST/releases/${base_release} does not exist." | \ tee -a ${log_file} error=1 else setup cdfsoft2 ${base_release} if [ "`echo ${CDFSOFT2_DIR} | grep ${base_release}`" = "" ] then echo "ERROR: Failed to setup cdfsoft2 ${base_release}." | tee -a ${log_file} error=1 fi fi if [ "${patch_file}" = "" ] then echo "ERROR: A file of patches must be specified." | tee -a ${log_file} error=1 elif [ ! -f ${patch_file} ] then echo "ERROR: Cannot find ${patch_file}." | tee -a ${log_file} error=1 fi # Bail out if an error of any sort was reported in the above checks : # ------------------------------------------------------------------- if [ ${error} -eq 1 ] then usage exit 1 fi # Find out if dependencies have been found for this frozen release : # ------------------------------------------------------------------ echo "***************************************************************************" echo "* You must check that depend files exist for the specified base release. **" num_ybos_depends=0 ls $CDFSOFT2_DIR/tmp/$BFARCH/ybos/*/*.d >& /tmp/lsdepend.tmp if [ `grep -c "No such" /tmp/lsdepend.tmp` -eq 0 ] then num_ybos_depends=`grep -c ".d" /tmp/lsdepend.tmp` fi rm -rf /tmp/lsdepend.tmp if [ ${num_ybos_depends} -eq 0 ] then echo "* ERROR : no .d files exist for the ybos package. Dependencies have **" echo "* probably not been found for this base release. **" echo "* Log in as cdfsoft and do a 'gmake depend' for this base **" echo "* release. **" echo "***************************************************************************" exit 1 else echo "* ${num_ybos_depends} depend files exist for package ybos : assuming eveything OK. **" echo "***************************************************************************" fi # Form an absolute path : # ----------------------- if [ "`echo ${patch_file}|cut -c1`" != '/' ] then if [ "`echo ${patch_file}|cut -c1-2`" = './' ] then patch_file=`echo ${patch_file}|cut -c3-` fi patch_file=${old_cwd}/${patch_file} fi # Loop throught the list of patches specified in the patch file : # --------------------------------------------------------------- while read patch_string do # echo "${patch_string}" | tee -a ${log_file} # Skip blank lines : if [ "${patch_string}" = "" ] then continue fi # Skip comment lines : if [ "`echo ${patch_string} | cut -c1`" = '#' ] then continue fi set ${patch_string} module=$1 shift cvs_update_options="$@" package=`echo ${module}|cut -f1 -d'/'` filetype=`echo ${module}|cut -f2 -d'.'` if [ "${filetype}" = "hh" -o "${filetype}" = "h" -o "{filetype}" = "icc" -o "$filetype}" = "inc" ] then file=`echo ${module}|cut -f2- -d'/'` echo "*** Dependencies for file ${file} :" | tee -a ${log_file} # depend -q ${file} | cut -f1 -d'/' >> /tmp/$$.dependents depend -q ${file} | cut -f1 -d'/' | tee -a ${log_file} echo "" | tee -a ${log_file} # (Currently do nothing for packages) # elif [ "${package}" = "${module}" ] # then # echo "*** Dependencies for package ${package} :" # depend -q ${package} | cut -f1 -d'/' >> /tmp/$$.dependents # depend -q ${package} | cut -f1 -d'/' # echo "" fi done < ${patch_file} #if [ -f /tmp/$$.dependents ] #then # echo "" | tee -a ${log_file} # echo "Retrieving dependent packages" | tee -a ${log_file} # echo '-----------------------------' | tee -a ${log_file} # sort -u -o /tmp/$$.sorted_dependents /tmp/$$.dependents # while read dep_pkg # do # if [ "`echo ${UNNEEDEDPACKAGES}|grep :${dep_pkg}:`" != "" ] # then # continue # fi # echo Read ${dep_pkg} # if [ ! -d ${dep_pkg} ] # then # cvsroot=`${BFDIST}/releases/development/Release/Scripts/Find_cvs_root ${package}` # if [ "${cvsroot}" != "" ] # then # cvs_stuff="-d `echo ${cvsroot}|cut -f1 -d','`" # else # cvs_stuff="" # fi # addpkg -Q ${cvs_stuff} ${dep_pkg} | tee -a ${log_file} # fi # done < /tmp/$$.sorted_dependents #fi exit