summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2014-11-25 11:29:10 +0000
committerTom Hacohen <tom@stosb.com>2014-11-25 11:30:30 +0000
commitb395d7dbd47abadc0ac28e9ff5d5dc1827f66ac6 (patch)
tree6617384077e98bb444f32f12b24ca27059ca65fe
parent29abdd9ca4a620fdb1e24ca10898a8bae9170901 (diff)
downloadefl-b395d7dbd47abadc0ac28e9ff5d5dc1827f66ac6.tar.gz
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.
-rw-r--r--src/Makefile_Eet.am3
-rwxr-xr-xsrc/bin/eet/diffeet55
2 files changed, 57 insertions, 1 deletions
diff --git a/src/Makefile_Eet.am b/src/Makefile_Eet.am
index b4bbffefcf..e3f5147ecb 100644
--- a/src/Makefile_Eet.am
+++ b/src/Makefile_Eet.am
@@ -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
diff --git a/src/bin/eet/diffeet b/src/bin/eet/diffeet
new file mode 100755
index 0000000000..eed785b3eb
--- /dev/null
+++ b/src/bin/eet/diffeet
@@ -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