build_kernel_data.sh: error out if the right packages aren't installed
[smatch.git] / smatch_scripts / build_kernel_data.sh
blob3591df0e1638dc3bda2325156b298df72ae95403
1 #!/bin/bash
3 PROJECT=kernel
5 function usage {
6 echo
7 echo "Usage: $0"
8 echo "Updates the smatch_data/ directory and builds the smatch database"
9 echo
10 exit 1
13 if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
14 usage;
17 SCRIPT_DIR=$(dirname $0)
18 if [ -e $SCRIPT_DIR/../smatch ] ; then
19 CMD=$SCRIPT_DIR/../smatch
20 DATA_DIR=$SCRIPT_DIR/../smatch_data
21 else
22 echo "This script should be run from the smatch_scripts/ directory."
23 exit 1
26 # If someone is building the database for the first time then make sure all the
27 # required packages are installed
28 if [ ! -e smatch_db.sqlite ] ; then
29 [ -e warns.txt ] || touch warns.txt
30 if ! $DATA_DIR/db/create_db.sh -p=kernel warns.txt ; then
31 echo "Hm... Not working. Make sure you have all the sqlite3 packages"
32 echo "And the sqlite3 libraries for Perl and Python"
33 exit 1
37 $SCRIPT_DIR/test_kernel.sh --call-tree --info --param-mapper --spammy --data=$DATA_DIR
39 for i in $SCRIPT_DIR/gen_* ; do
40 $i warns.txt -p=kernel
41 done
43 mv ${PROJECT}.* $DATA_DIR
45 $DATA_DIR/db/create_db.sh -p=kernel warns.txt