2 # SPDX-License-Identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018 The Linux Foundation and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
18 LOADER = yaml.CSafeLoader if yaml.__with_libyaml__ else yaml.SafeLoader
23 Parse arguments and verify YAML
25 logging.basicConfig(level=logging.INFO)
27 parser = argparse.ArgumentParser()
28 parser.add_argument('--yaml', '-y', type=str, required=True)
29 parser.add_argument('--schema', '-s', type=str, required=True)
31 args = parser.parse_args()
33 with open(args.yaml) as _:
34 yaml_file = yaml.load(_, Loader=LOADER)
36 with open(args.schema) as _:
37 schema_file = yaml.load(_, Loader=LOADER)
40 validation = jsonschema.Draft4Validator(
42 format_checker=jsonschema.FormatChecker()
47 for error in validation.iter_errors(yaml_file):
51 raise RuntimeError("%d issues invalidate the release schema" % errors)
54 if __name__ == "__main__":