Zack Williams | 3ed9f71 | 2017-05-03 12:29:17 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | # validate_manifest.sh |
| 3 | # |
| 4 | # Validates the repo manifest, per the DTD format given here: |
| 5 | # https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.txt |
| 6 | |
| 7 | echo "Verifying default.xml using manifest.dtd" |
| 8 | |
| 9 | # check that xmllint is available |
| 10 | if ! [ -x "$(command -v xmllint)" ] |
| 11 | then |
| 12 | echo "Please install 'xmllint' to use this script" |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
| 16 | # run the verification |
| 17 | xmllint --noout --dtdvalid manifest.dtd default.xml |
| 18 | status=$? |
| 19 | |
| 20 | if [ $status -ne 0 ] |
| 21 | then |
| 22 | echo "FAILURE: default.xml isn't valid - exit status: $status" |
| 23 | exit $status |
| 24 | else |
| 25 | echo "SUCCESS: default.xml validated correctly" |
| 26 | exit 0 |
| 27 | fi |