1#!/bin/sh - 2# $Id: s_recover,v 12.2 2008/01/11 18:49:48 sue Exp $ 3# 4# Build the automatically generated logging/recovery files. 5 6header=/tmp/__db_a 7loglist=/tmp/__db_b 8print=/tmp/__db_c 9source=/tmp/__db_d 10template=/tmp/__db_e 11tmp=/tmp/__db_f 12 13trap 'rm -f /tmp/__db_[abcdef]; exit 1' 1 2 3 13 15 14trap 'rm -f /tmp/__db_[abcdef]; exit 0' 0 15 16DIR="db dbreg btree fileops hash qam txn" 17 18# Check to make sure we haven't duplicated a log record entry, and build 19# the list of log record types that the test suite uses. 20for i in $DIR; do 21 for f in ../$i/*.src; do 22 # Grab the PREFIX; there should only be one per file, and 23 # so it's okay to just take the first. 24 grep '^PREFIX' $f | sed q 25 egrep '^BEGIN[ ]|^IGNORED[ ]|^DEPRECATED[ ]' $f | 26 awk '{print $1 "\t" $2 "\t" $3 "\t" $4}' 27 done 28done > $loglist 29grep -v '^PREFIX' $loglist | 30 awk '{print $2 "\t" $3 "\t" $4}' | sort -n -k 3 | uniq -d -f 1 > $tmp 31[ -s $tmp ] && { 32 echo "DUPLICATE LOG VALUES:" 33 cat $tmp 34 rm -f $tmp 35 exit 1 36} 37f=../test/logtrack.list 38cmp $loglist $f > /dev/null 2>&1 || 39 (echo "Building $f" && rm -f $f && cp $loglist $f && chmod 444 $f) 40 41# Build DB's recovery routines. 42for i in $DIR; do 43 for f in ../$i/*.src; do 44 subsystem=`basename $f .src` 45 awk -f gen_rec.awk \ 46 -v header_file=$header \ 47 -v print_file=$print\ 48 -v source_file=$source \ 49 -v template_file=$template < $f 50 51 f=../dbinc_auto/${subsystem}_auto.h 52 cmp $header $f > /dev/null 2>&1 || 53 (echo "Building $f" && 54 rm -f $f && cp $header $f && chmod 444 $f) 55 f=../$i/${subsystem}_auto.c 56 cmp $source $f > /dev/null 2>&1 || 57 (echo "Building $f" && 58 rm -f $f && cp $source $f && chmod 444 $f) 59 f=../$i/${subsystem}_autop.c 60 cmp $print $f > /dev/null 2>&1 || 61 (echo "Building $f" && 62 rm -f $f && cp $print $f && chmod 444 $f) 63 f=template/rec_${subsystem} 64 cmp $template $f > /dev/null 2>&1 || 65 (echo "Building $f" && 66 rm -f $f && cp $template $f && chmod 444 $f) 67 done 68done 69 70# Build the example application's recovery routines. 71(cd ../examples_c/ex_apprec && sh auto_rebuild) 72