blob: 77d32112f2815f492f241938acd684475a17275a [file] [log] [blame]
Zack Williams1497a402018-02-16 15:22:42 -07001#!/usr/bin/env bash
2# validate_manifest.sh
3#
4# Copyright 2017-present Open Networking Foundation
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18# Validates the repo manifest, per the DTD format given here:
19# https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.txt
20
21echo "Verifying default.xml using manifest.dtd"
22
23# check that xmllint is available
24if ! [ -x "$(command -v xmllint)" ]
25then
26 echo "Please install 'xmllint' to use this script"
27 exit 1
28fi
29
30# run the verification
31xmllint --noout --dtdvalid manifest.dtd default.xml
32status=$?
33
34if [ $status -ne 0 ]
35then
36 echo "FAILURE: default.xml isn't valid - exit status: $status"
37 exit $status
38else
39 echo "SUCCESS: default.xml validated correctly"
40 exit 0
41fi