check_unused.sh revision 6265
10139N/A#!/bin/sh
10139N/A
10139N/A# $Id$
10139N/A#
10139N/A# Search for files in cvs that are not referenced in spec files.
10139N/A# Depending on command line switch, script searches for:
10139N/A# - patches not referenced in any spec file
10139N/A# - ext-sources not referenced in any spec file
10139N/A# - Linux spec files not mentioned in any Solaris spec file.
10139N/A#
10139N/A
10139N/A
10754N/A# Display usage if no arguments on command line.
10139N/Aif [ $# -eq 0 ]
10139N/Athen
10139N/A cat << END_OF_USAGE
10139N/AUsage: `basename $0` [-patches|-ext-sources|-linux-only]
10626N/A
10139N/A-patches list patches not referenced in any spec file.
10469N/A-ext-sources list ext-sources files not referenced in any spec file
10469N/A-linux-only list Linux spec files not mentioned in any Solaris spec file.
10139N/AEND_OF_USAGE
10139N/A exit 1
10139N/Afi
10139N/A
10139N/A
10139N/A# Determine the script directory.
10139N/AScriptDir=`dirname $0` # Get potentially relative script directory.
10491N/AScriptDir=`( cd $ScriptDir; pwd )` # Get absolute directory.
10491N/A
10491N/A# Go to the spec-files directory and ensure other dirs present.
10491N/Acd $ScriptDir/..
10139N/Aif [ ! -d patches -o ! -d Solaris -o ! -d Solaris/patches -o ! -d Solaris/extra-specs -o ! -d ext-sources ]
10139N/Athen
10139N/A echo "ERROR: Expected directory structure not present. Contact gnome-re@sun.com."
10139N/A exit 1
10683N/Afi
10139N/A
10139N/A
10139N/Acase "$1" in
10139N/A # Search for '^Patch.*' in Linux, Solaris and extra-specs spec files.
10139N/A -patches|-p*)
10139N/A for d in patches Solaris/patches
10139N/A do
10139N/A for f in `cd $d; ls *.diff`
10139N/A do
10139N/A found=`grep "^Patch.*$f" *.spec Solaris/*.spec Solaris/extra-specs/*.spec`
10139N/A if [ -z "$found" ]
10139N/A then
10139N/A echo $d/$f
10139N/A fi
10139N/A done
10139N/A done ;;
10139N/A
10139N/A # Search '^Source' in all spec files, '^SUNW_Copyright' in Solaris spec
10139N/A # files and then '^%.class' (rclass and iclass) in Solaris spec files.
10139N/A -ext-sources|-e*)
10139N/A for f in `cd ext-sources; ls`
10139N/A do
10139N/A if [ -f ext-sources/$f ]
10139N/A then
10139N/A found=`grep "^Source.*$f" *.spec Solaris/*.spec Solaris/extra-specs/*.spec`
10139N/A if [ -z "$found" ]
10139N/A then
10139N/A found=`grep "^SUNW_Copyright.*$f" Solaris/*.spec`
10139N/A if [ -z "$found" ]
10139N/A then
10139N/A found=`grep "^%.class.*$f" Solaris/*.spec`
10139N/A if [ -z "$found" ]
10139N/A then
10139N/A echo $f
10139N/A fi
10139N/A fi
10139N/A fi
10139N/A fi
10139N/A done ;;
10139N/A
10139N/A # Search for '^%use.*' in Solaris spec files.
10139N/A -linux-only|-l*)
10139N/A for f in *.spec
10139N/A do
10139N/A found=`grep "^%use.*$f" Solaris/*.spec`
10139N/A if [ -z "$found" ]
10139N/A then
10139N/A echo $f
10139N/A fi
10139N/A done ;;
10139N/Aesac
10139N/A
10139N/A