s_recover 1.62 KB
Newer Older
unknown's avatar
unknown committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/bin/sh -
#	$Id: s_recover,v 1.3 2000/03/30 05:24:36 krinsky Exp $
#
# Build the automatically generated logging/recovery files.

DIR="db btree hash log qam txn"

t=/tmp/__db_$$
loglist=../test/logtrack.list
rm -f $t
rm -f $loglist

trap 'rm -f $t; exit 1' 1 2 3 13 15

unknown's avatar
unknown committed
15 16 17 18 19 20 21
# Use the standard -k option if it works;
# otherwise fall back on the traditional notation.
if sort -k 1,1 /dev/null
then sort_2_etc='-k 2'
else sort_2_etc='+1'
fi

unknown's avatar
unknown committed
22 23 24 25 26 27 28
# Check to make sure we haven't duplicated a log record entry, and build
# the list of log record types that the test suite uses.
for i in $DIR; do
	p=none
	for f in ../$i/*.src; do
		# Grab the PREFIX;  there should only be one per file, and
		# so it's okay to just take the first.
unknown's avatar
unknown committed
29
		grep '^PREFIX' $f | sed q
unknown's avatar
unknown committed
30 31 32 33 34
		egrep '^DEPRECATED[	 ]|^BEGIN[	 ]' $f | \
		    awk '{print $1 "\t" $2 "\t" $3}'

	done
done > $loglist
unknown's avatar
unknown committed
35 36
grep -v '^PREFIX' $loglist | awk '{print $2 "\t" $3}' | \
    sort $sort_2_etc -n | \
unknown's avatar
unknown committed
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
    uniq -d -f 1 > $t
[ -s $t ] && {
	echo "DUPLICATE LOG VALUES:"
	cat $t
	rm -f $t
	exit 1
}
rm -f $t

for i in db btree hash log qam txn; do
	for f in ../$i/*.src; do
		subsystem=`basename $f .src`
		header_file=../include/${subsystem}_auto.h
		source_file=../$i/${subsystem}_auto.c
		template_file=template/rec_${subsystem}
		template_source=.

		echo "Building $source_file, $header_file, $template_file"
		rm -f $header_file $source_file $template_file
		awk -f gen_rec.awk \
		    -v subsystem=$subsystem \
		    -v source_file=$source_file \
		    -v header_file=$header_file \
		    -v template_file=$template_file \
		    -v template_dir=. < $f
		chmod 444 $header_file $source_file $template_file
	done
done