summaryrefslogtreecommitdiff
path: root/merge-helpers/check_bsp
blob: 5ce6ce610ee14eec8a33a6b11e6b2746b3c24f87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#
#  Script to test for various things we want in a BSP when it is
#  submitted.
#
#  Test for:
#    - presense of BSP_BOOTCARD_OPTIONS
#    - XXX
#

if [ $# -ne 1 ] ; then
  echo Usage: $0 BSPDIR
  exit 1
fi

bspdir=${1}

if [ ! -d ${bspdir} ] ; then
  echo ${bspdir} is not a directory
  exit 1
fi

cd ${bspdir}
if [ $? -ne 0 ] ; then
  echo Unable to cd to ${bspdir}
  exit 1
fi


test_its_there()
{
  if [ $# -ne 2 ] ; then
    echo Usage: $0 FILE pattern 
  fi
  grep ${2} ${1} >/dev/null
  if [ $? -ne 0 ] ; then
    echo NOT in ${bspdir}/${1}
  fi

}

test_its_NOT_there()
{
  if [ $# -lt 2 ] ; then
    echo Usage: $0 FILE pattern 
  fi
  FILE=$1
  shift
  grep "${*}" ${FILE} >/dev/null
  if [ $? -eq 0 ] ; then
    echo SHOULD NOT BE IN ${bspdir}/${FILE}
  fi

}

if [ -r configure.ac ] ; then
  echo "=== Checking for options in BSP configure.ac"
  test_its_there configure.ac RTEMS_BSP_BOOTCARD_OPTIONS
  test_its_there configure.ac RTEMS_BSP_CLEANUP_OPTIONS
fi

# really need to make the copyright strings consistent in BSPs
echo "=== Checking for copyright notices"
find . -name "*.[chS]" | while read f
do
  grep -i COPYRIGHT ${f} >/dev/null
  if [ $? -ne 0 ] ; then
    echo Copyright is NOT in ${bspdir}/${f}
  fi
done

# We want CVS Id strings everywhere possible
echo "=== Checking for CVS Id strings"
find . -name "*.[chS]" -o -name "*.ac" -o -name "Makefile.am" | while read f
do
  test_its_there ${f} "\$Id"
done

# We do not want printf in a BSP
echo "=== Checking for printf"
find . -name "*.[chS]" -o -name "*.ac" -o -name "Makefile.am" | while read f
do
  test_its_NOT_there ${f} printf
done

# We do not want puts in a BSP
echo "=== Checking for puts"
find . -name "*.[chS]" -o -name "*.ac" -o -name "Makefile.am" | while read f
do
  test_its_NOT_there ${f} puts
done

# We do not want the reformatted license notice
echo "=== Checking for reformatted RTEMS license notices"
find . -name "*.[chS]" -o -name "*.ac" -o -name "Makefile.am" | while read f
do
  test_its_NOT_there ${f} "this file may be found in the file"
done

exit 0