Eet: add diffeet a tool for diffing eet files.

This is not perfect at the moment, as the decoded output might change
drastically in some cases, however this is still useful for the other cases.

Anyway, we should fix the eet decoding to have a consistent order, so this
will be more useful.

@feature.
This commit is contained in:
Tom Hacohen 2014-11-25 11:29:10 +00:00
parent 29abdd9ca4
commit b395d7dbd4
2 changed files with 57 additions and 1 deletions

View File

@ -54,7 +54,8 @@ endif
### Binary
bin_PROGRAMS += bin/eet/eet
bin_SCRIPTS += bin/eet/vieet
bin_SCRIPTS += bin/eet/vieet \
bin/eet/diffeet
bin_eet_eet_SOURCES = bin/eet/eet_main.c

55
src/bin/eet/diffeet Executable file
View File

@ -0,0 +1,55 @@
#!/bin/sh
DIFF=${DIFF-diff}
cleanup() {
if [ ! -z "$TDIR" ]; then
rm -r "$TDIR"
fi
}
die() {
echo "$@"
echo "Aborting"
cleanup
exit 1
}
usage() {
die "Usage: diffeet <eet file> <eet file2> <section>"
}
decode_eet() {
eet -d "$1" "$SECTION" "$2"
if [ $? -ne 0 ]; then
die "Failed decoding eet file '$1'."
fi
}
EETFILE1="$1"
EETFILE2="$2"
SECTION="$3"
if [ $# -ne 3 ]; then
usage
fi
TDIR=$(mktemp -d)
if [ $? -ne 0 ]; then
die "Failed creating tempdir."
fi
TMP="$(basename $EETFILE1)"
TARGET1="$TDIR/$TMP"
TMP="$(basename $EETFILE2)"
TARGET2="$TDIR/$TMP"
# Decode the file
decode_eet "$EETFILE1" "$TARGET1"
decode_eet "$EETFILE2" "$TARGET2"
$DIFF "$TARGET1" "$TARGET2"
cleanup