scripts/check_unused.sh
changeset 9401 72746c79ffd2
parent 5523 d35108bc3b66
equal deleted inserted replaced
9400:f3c0f4f1c2ee 9401:72746c79ffd2
    28 ScriptDir=`dirname $0`    # Get potentially relative script directory.
    28 ScriptDir=`dirname $0`    # Get potentially relative script directory.
    29 ScriptDir=`( cd $ScriptDir; pwd )`  # Get absolute directory.
    29 ScriptDir=`( cd $ScriptDir; pwd )`  # Get absolute directory.
    30 
    30 
    31 # Go to the spec-files directory and ensure other dirs present.
    31 # Go to the spec-files directory and ensure other dirs present.
    32 cd $ScriptDir/..
    32 cd $ScriptDir/..
    33 if [ ! -d patches -o ! -d Solaris -o ! -d Solaris/patches -o ! -d Solaris/extra-specs -o ! -d ext-sources ]
    33 if [ ! -d patches -o ! -d base-specs -o ! -d closed -o ! -d ext-sources ]
    34 then
    34 then
    35   echo "ERROR: Expected directory structure not present. Contact [email protected]."
    35   echo "ERROR: Expected directory structure not present. Contact [email protected]."
    36   exit 1
    36   exit 1
    37 fi
    37 fi
    38 
    38 
    39 
    39 
    40 case "$1" in
    40 case "$1" in
    41   # Search for '^Patch.*' in Linux, Solaris and extra-specs spec files.
    41   # Search for '^Patch.*' in Solaris, base and closed spec files.
    42   -patches|-p*)
    42   -patches|-p*)
    43       for d in patches Solaris/patches
    43       for d in patches
    44       do
    44       do
    45         for f in `cd $d; ls *.diff`
    45         for f in `cd $d; ls *.diff`
    46         do
    46         do
    47           found=`grep "^Patch.*$f" *.spec Solaris/*.spec Solaris/extra-specs/*.spec`
    47           found=`grep "^Patch.*$f" *.spec base-specs/*.spec closed/*.spec`
    48           if [ -z "$found" ]
    48           if [ -z "$found" ]
    49           then
    49           then
    50             echo $d/$f
    50             echo $d/$f
    51           fi
    51           fi
    52         done
    52         done
    57   -ext-sources|-e*)
    57   -ext-sources|-e*)
    58       for f in `cd ext-sources; ls`
    58       for f in `cd ext-sources; ls`
    59       do
    59       do
    60         if [ -f ext-sources/$f ]
    60         if [ -f ext-sources/$f ]
    61         then
    61         then
    62           found=`grep "^Source.*$f" *.spec Solaris/*.spec Solaris/extra-specs/*.spec`
    62           found=`grep "^Source.*$f" *.spec base-specs/*.spec closed/*.spec`
    63           if [ -z "$found" ]
    63           if [ -z "$found" ]
    64           then
    64           then
    65             found=`grep "^SUNW_Copyright.*$f" Solaris/*.spec`
    65             found=`grep "^SUNW_Copyright.*$f" *.spec closed/*.spec`
    66             if [ -z "$found" ]
    66             if [ -z "$found" ]
    67             then
    67             then
    68               found=`grep "^%.class.*$f" Solaris/*.spec`
    68               found=`grep "^%.class.*$f" *.spec closed/*.spec`
    69               if [ -z "$found" ]
    69               if [ -z "$found" ]
    70               then
    70               then
    71                 echo $f
    71                 echo $f
    72               fi
    72               fi
    73             fi
    73             fi
    77 
    77 
    78   # Search for '^%use.*' in Solaris spec files.
    78   # Search for '^%use.*' in Solaris spec files.
    79   -linux-only|-l*)
    79   -linux-only|-l*)
    80       for f in *.spec
    80       for f in *.spec
    81       do
    81       do
    82         found=`grep "^%use.*$f" Solaris/*.spec`
    82         found=`grep "^%use.*$f" *.spec closed/*.spec`
    83         if [ -z "$found" ]
    83         if [ -z "$found" ]
    84         then
    84         then
    85           echo $f
    85           echo $f
    86         fi
    86         fi
    87       done ;;
    87       done ;;