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)
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
54### Binary 54### Binary
55 55
56bin_PROGRAMS += bin/eet/eet 56bin_PROGRAMS += bin/eet/eet
57bin_SCRIPTS += bin/eet/vieet 57bin_SCRIPTS += bin/eet/vieet \
58 bin/eet/diffeet
58 59
59bin_eet_eet_SOURCES = bin/eet/eet_main.c 60bin_eet_eet_SOURCES = bin/eet/eet_main.c
60 61
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 @@
1#!/bin/sh
2
3DIFF=${DIFF-diff}
4
5cleanup() {
6 if [ ! -z "$TDIR" ]; then
7 rm -r "$TDIR"
8 fi
9}
10
11die() {
12 echo "$@"
13 echo "Aborting"
14 cleanup
15 exit 1
16}
17
18usage() {
19 die "Usage: diffeet <eet file> <eet file2> <section>"
20}
21
22decode_eet() {
23 eet -d "$1" "$SECTION" "$2"
24
25 if [ $? -ne 0 ]; then
26 die "Failed decoding eet file '$1'."
27 fi
28}
29
30EETFILE1="$1"
31EETFILE2="$2"
32SECTION="$3"
33
34if [ $# -ne 3 ]; then
35 usage
36fi
37
38TDIR=$(mktemp -d)
39
40if [ $? -ne 0 ]; then
41 die "Failed creating tempdir."
42fi
43
44TMP="$(basename $EETFILE1)"
45TARGET1="$TDIR/$TMP"
46TMP="$(basename $EETFILE2)"
47TARGET2="$TDIR/$TMP"
48
49# Decode the file
50decode_eet "$EETFILE1" "$TARGET1"
51decode_eet "$EETFILE2" "$TARGET2"
52
53$DIFF "$TARGET1" "$TARGET2"
54
55cleanup