list.sh 1.24 KB
Newer Older
1 2 3
#! /bin/sh
# Piggy list consistency checker

Sam Hocevar's avatar
Sam Hocevar committed
4 5 6
LANG=C
export LANG

Clément Stenac's avatar
Clément Stenac committed
7
TEMPFILE=/tmp/vlclist.tmp.$$
Rafaël Carré's avatar
Rafaël Carré committed
8
LISTFILE=MODULES_LIST
9 10 11 12 13 14 15 16 17 18 19


rm -f $TEMPFILE
touch $TEMPFILE

echo "------------------------------------"
echo "Checking that all modules are listed"
echo "------------------------------------"

i=0

20
for modfile in `find . -name "Makefile.am"`
21
do
22
 for module in `awk '/^lib.*_plugin_la_SOURCES/{sub(/lib/,""); sub(/_plugin_la_SOURCES/,"",$1); print $1}' "$modfile"`
23 24
 do
  echo $module >> $TEMPFILE
25
  if ! grep -q " \* $module:" $LISTFILE
26 27 28 29 30 31 32
  then
   echo "$module exists in $modfile, but not listed"
   i=1
  fi
 done
done

Sam Hocevar's avatar
Sam Hocevar committed
33
if [ $i = 0 ]
34 35 36 37 38 39 40 41 42 43 44
then
  echo "OK"
fi

i=0

echo
echo "--------------------------------------"
echo "Checking that all listed modules exist"
echo "--------------------------------------"

45
for module in `awk -F'[ :]' '/ \* /{print $3}' $LISTFILE`
46
do
47
 if ! grep -wq $module $TEMPFILE
48 49 50 51 52 53
 then
  i=1
  echo "$module is listed but does not exist"
 fi
done

Sam Hocevar's avatar
Sam Hocevar committed
54
if [ $i = 0 ]
55 56 57 58 59 60 61 62 63
then
  echo "OK"
fi

echo
echo "-------------------------------"
echo "Checking for alphabetical order"
echo "-------------------------------"

64
grep " \* " $LISTFILE | LC_COLLATE=C LC_CTYPE=C sort -c && echo "OK"
65 66 67


echo ""
68
echo "`sort -u $TEMPFILE | wc -l` modules listed in Makefiles"
69 70

rm -f $TEMPFILE