2023-03-02 00:23:23 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2023-03-02 08:41:33 +00:00
|
|
|
failuremsg="Error"
|
|
|
|
failurecode=1
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]
|
|
|
|
do
|
|
|
|
case "$1" in
|
|
|
|
--warning|-w)
|
|
|
|
failuremsg="Warning"
|
|
|
|
failurecode=0;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2023-03-02 00:23:23 +00:00
|
|
|
echo "Checking for theories that are not part of an Isabelle session:"
|
|
|
|
echo "==============================================================="
|
|
|
|
|
|
|
|
PWD=`pwd`
|
|
|
|
TMPDIR=`mktemp -d`
|
|
|
|
isabelle build -D . -l -n | grep $PWD | sed -e "s| *${PWD}/||" | sort -u | grep thy$ > ${TMPDIR}/sessions-thy-files.txt
|
|
|
|
find * -type f | sort -u | grep thy$ > ${TMPDIR}/actual-thy-files.txt
|
|
|
|
thylist=`comm -13 ${TMPDIR}/sessions-thy-files.txt ${TMPDIR}/actual-thy-files.txt`
|
|
|
|
if [ -z "$thylist" ] ; then
|
|
|
|
echo " * Success: No dangling theories found."
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo -e "$thylist"
|
2023-03-02 08:41:33 +00:00
|
|
|
echo "$failuremsg: Dangling theories found (see list above)!"
|
|
|
|
exit $failurecode
|
2023-03-02 00:23:23 +00:00
|
|
|
fi
|