summaryrefslogtreecommitdiff
path: root/tools/validate-diameter-xml.sh
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss.ws@gmail.com>2016-11-01 21:29:11 -0400
committerAnders Broman <a.broman58@gmail.com>2016-11-02 04:42:47 +0000
commit8a376d4cd35e1e00b4c1bbd30ad85c6eda0561f3 (patch)
treeadb60974e103042bd34c670d1b6d5f56e92f99f4 /tools/validate-diameter-xml.sh
parente1454337df5cee341f7973fbd8c2d9cc8cba9586 (diff)
downloadwireshark-8a376d4cd35e1e00b4c1bbd30ad85c6eda0561f3.tar.gz
Validate the Diameter XML files in the pre-commit script.
Validation requires xmllint but will pass (with a complaint) if the committer does not have xmllint installed. Change-Id: I336a1c8ad8e1f98805a284d8c4736810b1a9c54e Reviewed-on: https://code.wireshark.org/review/18609 Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'tools/validate-diameter-xml.sh')
-rwxr-xr-xtools/validate-diameter-xml.sh18
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/validate-diameter-xml.sh b/tools/validate-diameter-xml.sh
index 09aa4af6aa..98c496ff28 100755
--- a/tools/validate-diameter-xml.sh
+++ b/tools/validate-diameter-xml.sh
@@ -24,24 +24,28 @@
if ! type -p sed > /dev/null
then
- echo "Sorry, 'sed' is needed to run this program."
- exit 1
+ echo "'sed' is needed to run $0." 1>&2
+ # Exit cleanly because we don't want pre-commit to fail just because
+ # someone doesn't have the tools...
+ exit 0
fi
if ! type -p xmllint > /dev/null
then
- echo "Sorry, 'xmllint' is needed to run this program."
- exit 1
+ echo "'xmllint' is needed to run $0." 1>&2
+ # Exit cleanly because we don't want pre-commit to fail just because
+ # someone doesn't have the tools...
+ exit 0
fi
# Ideally this would work regardless of our cwd
if [ ! -r diameter/dictionary.xml ]
then
- echo "Couldn't find diameter/dictionary.xml"
+ echo "Couldn't find diameter/dictionary.xml" 1>&2
exit 1
fi
if [ ! -r diameter/dictionary.dtd ]
then
- echo "Couldn't find diameter/dictionary.dtd"
+ echo "Couldn't find diameter/dictionary.dtd" 1>&2
exit 1
fi
@@ -59,7 +63,7 @@ do
done
xmllint --noout --noent --postvalid /tmp/diameter/dictionary.xml &&
- echo "Diameter dictionary is (mostly) valid XML!"
+ echo "Diameter dictionary is (mostly) valid XML."
rm -rf /tmp/diameter