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

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

i=0

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

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

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

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

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


echo ""
69
echo "`sort -u $TEMPFILE | wc -l` modules listed in Modules.am files"
70 71

rm -f $TEMPFILE