misc: fix feature.yaml

Add checkfeaturelist validation to checkstyle.
Fix two files with errors.

Type: docs
Change-Id: I81eda0e25b271f2006b4da22efdf7218d52a67d3
Signed-off-by: Ole Troan <ot@cisco.com>
This commit is contained in:
Ole Troan
2020-01-03 16:37:27 +01:00
committed by Paul Vinciguerra
parent 69c2a5895a
commit f3aebda7ea
4 changed files with 13 additions and 11 deletions

View File

@ -68,7 +68,7 @@ DEB_DEPENDS += lcov chrpath autoconf indent clang-format libnuma-dev
DEB_DEPENDS += python-all python3-all python3-setuptools python-dev DEB_DEPENDS += python-all python3-all python3-setuptools python-dev
DEB_DEPENDS += python-virtualenv python-pip libffi6 check DEB_DEPENDS += python-virtualenv python-pip libffi6 check
DEB_DEPENDS += libboost-all-dev libffi-dev python3-ply libmbedtls-dev DEB_DEPENDS += libboost-all-dev libffi-dev python3-ply libmbedtls-dev
DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml yamllint DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml
DEB_DEPENDS += python3-venv # ensurepip DEB_DEPENDS += python3-venv # ensurepip
DEB_DEPENDS += python3-dev # needed for python3 -m pip install psutil DEB_DEPENDS += python3-dev # needed for python3 -m pip install psutil
# python3.6 on 16.04 requires python36-dev # python3.6 on 16.04 requires python36-dev
@ -93,7 +93,6 @@ RPM_DEPENDS += selinux-policy selinux-policy-devel
RPM_DEPENDS += ninja-build RPM_DEPENDS += ninja-build
RPM_DEPENDS += libuuid-devel RPM_DEPENDS += libuuid-devel
RPM_DEPENDS += mbedtls-devel RPM_DEPENDS += mbedtls-devel
RPM_DEPENDS += yamllint
RPM_DEPENDS += python3-devel # needed for python3 -m pip install psutil RPM_DEPENDS += python3-devel # needed for python3 -m pip install psutil
ifeq ($(OS_ID),fedora) ifeq ($(OS_ID),fedora)
@ -629,9 +628,8 @@ cscope: cscope.files
@cscope -b -q -v @cscope -b -q -v
.PHONY: checkstyle .PHONY: checkstyle
checkstyle: checkstyle: checkfeaturelist
@build-root/scripts/checkstyle.sh @build-root/scripts/checkstyle.sh
yamllint $(WS_ROOT)/src
.PHONY: checkstyle-commit .PHONY: checkstyle-commit
checkstyle-commit: checkstyle-commit:
@ -665,7 +663,7 @@ featurelist: centos-pyyaml
.PHONY: checkfeaturelist .PHONY: checkfeaturelist
checkfeaturelist: centos-pyyaml checkfeaturelist: centos-pyyaml
@build-root/scripts/fts.py --validate --git-status @build-root/scripts/fts.py --validate --all
# #
# Build the documentation # Build the documentation

View File

@ -6,7 +6,7 @@ import ipaddress
import yaml import yaml
from pprint import pprint from pprint import pprint
import re import re
from jsonschema import validate from jsonschema import validate, exceptions
import argparse import argparse
from subprocess import run, PIPE from subprocess import run, PIPE
@ -96,10 +96,11 @@ def output_markdown(features):
print('# {}'.format(v['name'])) print('# {}'.format(v['name']))
if type(v['maintainer']) is list: if type(v['maintainer']) is list:
print('Maintainers: ' + print('Maintainers: ' +
', '.join('{}'.format(m) for m in v['maintainer'])) ', '.join('{}'.format(m) for m in
v['maintainer']) + ' ')
else: else:
print('Maintainer: {} '.format(v['maintainer'])) print('Maintainer: {} '.format(v['maintainer']))
print('State: {}\n'.format(v['state'])) print('State: {} \n'.format(v['state']))
print('{}\n'.format(v['description'])) print('{}\n'.format(v['description']))
output_features(0, v['features']) output_features(0, v['features'])
if 'missing' in v: if 'missing' in v:
@ -137,7 +138,12 @@ def main():
# Load configuration file # Load configuration file
with open(featurefile) as f: with open(featurefile) as f:
cfg = yaml.load(f, Loader=yaml.SafeLoader) cfg = yaml.load(f, Loader=yaml.SafeLoader)
validate(instance=cfg, schema=schema) try:
validate(instance=cfg, schema=schema)
except exceptions.ValidationError:
print('File does not validate: {}'.format(featurefile),
file=sys.stderr)
raise
features[featurefile] = cfg features[featurefile] = cfg
if args.markdown: if args.markdown:

View File

@ -4,6 +4,5 @@ maintainer: Klement Sekera <ksekera@cisco.com>
features: features:
- BFD protocol implementation - BFD protocol implementation
description: "Bidirectional Forwarding Detection implementation" description: "Bidirectional Forwarding Detection implementation"
missing:
state: production state: production
properties: [API, CLI, STATS, MULTITHREAD] properties: [API, CLI, STATS, MULTITHREAD]

View File

@ -4,6 +4,5 @@ maintainer: Klement Sekera <ksekera@cisco.com>
features: features:
- link layer discovery protocol implementation - link layer discovery protocol implementation
description: "Link Layer Discovery Protocol implementation" description: "Link Layer Discovery Protocol implementation"
missing:
state: production state: production
properties: [API, CLI, STATS, MULTITHREAD] properties: [API, CLI, STATS, MULTITHREAD]