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