forked from enlightenment/efl
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:
parent
29abdd9ca4
commit
b395d7dbd4
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue