From ea1a65135e01311e31e94b8d0ed0721c9856775d Mon Sep 17 00:00:00 2001 From: Paul Vinciguerra Date: Fri, 1 Nov 2019 02:34:32 -0400 Subject: [PATCH] docs: fix issues with src/scripts/fts.py - packaging issue - yaml deprecation - yaml formatting Type: fix Change-Id: Ia8808cbc83271a3067164f2db2418f071b35607a Signed-off-by: Paul Vinciguerra --- Makefile | 23 +++++++++++++++++------ src/plugins/mdata/FEATURE.yaml | 4 ++-- src/scripts/fts.py | 35 ++++++++++++++++++++--------------- 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index cca853417b6..1a11da8ceda 100644 --- a/Makefile +++ b/Makefile @@ -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-virtualenv python-pip libffi6 check DEB_DEPENDS += libboost-all-dev libffi-dev python3-ply libmbedtls-dev -DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema +DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml ifeq ($(OS_VERSION_ID),14.04) DEB_DEPENDS += libssl-dev else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-8) @@ -185,8 +185,8 @@ help: @echo " build - build debug binaries" @echo " build-release - build release binaries" @echo " build-coverity - build coverity artifacts" - @echo " rebuild - wipe and build debug binares" - @echo " rebuild-release - wipe and build release binares" + @echo " rebuild - wipe and build debug binaries" + @echo " rebuild-release - wipe and build release binaries" @echo " run - run debug binary" @echo " run-release - run release binary" @echo " debug - run debug binary with debugger" @@ -235,7 +235,7 @@ help: @echo " V=[0|1] - set build verbosity level" @echo " STARTUP_CONF= - startup configuration file" @echo " (e.g. /etc/vpp/startup.conf)" - @echo " STARTUP_DIR= - startup drectory (e.g. /etc/vpp)" + @echo " STARTUP_DIR= - startup directory (e.g. /etc/vpp)" @echo " It also sets STARTUP_CONF if" @echo " startup.conf file is present" @echo " GDB= - gdb binary to use for debugging" @@ -562,10 +562,21 @@ checkstyle: fixstyle: @build-root/scripts/checkstyle.sh --fix -featurelist: +# necessary because Bug 1696324 - Update to python3.6 breaks PyYAML dependencies +# Status: CLOSED CANTFIX +# https://bugzilla.redhat.com/show_bug.cgi?id=1696324 +centos-pyyaml: +ifeq ($(OS_ID)-$(OS_VERSION_ID),centos-7) + @python3 -m pip install pyyaml +endif +ifeq ($(OS_ID)-$(OS_VERSION_ID),centos-8) + @sudo -E yum install $(CONFIRM) python3-pyyaml +endif + +featurelist: centos-pyyaml @build-root/scripts/fts.py --all --markdown -checkfeaturelist: +checkfeaturelist: centos-pyyaml @build-root/scripts/fts.py --validate --git-status # diff --git a/src/plugins/mdata/FEATURE.yaml b/src/plugins/mdata/FEATURE.yaml index c71281d777b..404739ee54a 100644 --- a/src/plugins/mdata/FEATURE.yaml +++ b/src/plugins/mdata/FEATURE.yaml @@ -2,12 +2,12 @@ name: Buffer Metadata Change Tracker (mdata) maintainer: Dave Barach features: - Buffer Metadata Change Tracker -description: "Buffer Metadata Change Tracker +description: Buffer Metadata Change Tracker Uses the before / after graph node main loop performance callback hooks to snapshoot buffer metadata, then compare and summarize results per-node. Answers the question "what buffer metadata does a particular graph node change?" by direct observation. - Zero performance impact until enabled." + Zero performance impact until enabled. state: production properties: [API, CLI, MULTITHREAD] diff --git a/src/scripts/fts.py b/src/scripts/fts.py index 6d224ddffe4..eb44be9a59a 100755 --- a/src/scripts/fts.py +++ b/src/scripts/fts.py @@ -16,15 +16,16 @@ schema = { "type": "object", "properties": { "name": {"type": "string"}, - "description": { "type": "string" }, - "maintainer": { "type": "string" }, + "description": {"type": "string"}, + "maintainer": {"type": "string"}, "state": {"type": "string", "enum": ["production", "experimental"]}, - "features": { "$ref": "#/definitions/features" }, - "missing": { "$ref": "#/definitions/features" }, - "properties": { "type": "array", - "items": { "type": "string", - "enum": ["API", "CLI", "STATS", "MULTITHREAD"] }, + "features": {"$ref": "#/definitions/features"}, + "missing": {"$ref": "#/definitions/features"}, + "properties": {"type": "array", + "items": {"type": "string", + "enum": ["API", "CLI", "STATS", + "MULTITHREAD"]}, }, }, "additionalProperties": False, @@ -32,21 +33,20 @@ schema = { "featureobject": { "type": "object", "patternProperties": { - "^.*$": { "$ref": "#/definitions/features" }, + "^.*$": {"$ref": "#/definitions/features"}, }, }, "features": { "type": "array", - "items": {"anyOf": [{ "$ref": "#/definitions/featureobject" }, - { "type": "string" }, - ]}, + "items": {"anyOf": [{"$ref": "#/definitions/featureobject"}, + {"type": "string"}, + ]}, "minItems": 1, }, }, } - def filelist_from_git_status(): filelist = [] git_status = 'git status --porcelain */FEATURE.yaml' @@ -59,6 +59,7 @@ def filelist_from_git_status(): filelist.append(l.split()[1]) return filelist + def filelist_from_git_ls(): filelist = [] git_ls = 'git ls-files :(top)*/FEATURE.yaml' @@ -71,17 +72,19 @@ def filelist_from_git_ls(): filelist.append(l) return filelist + def output_features(indent, fl): for f in fl: if type(f) is dict: - for k,v in f.items(): + for k, v in f.items(): print('{}- {}'.format(' ' * indent, k)) output_features(indent + 2, v) else: print('{}- {}'.format(' ' * indent, f)) + def output_markdown(features): - for k,v in features.items(): + for k, v in features.items(): print('# {}'.format(v['name'])) print('Maintainer: {} '.format(v['maintainer'])) print('State: {}\n'.format(v['state'])) @@ -92,6 +95,7 @@ def output_markdown(features): output_features(0, v['missing']) print() + def main(): parser = argparse.ArgumentParser(description='VPP Feature List.') parser.add_argument('--validate', dest='validate', action='store_true', @@ -120,12 +124,13 @@ def main(): # Load configuration file with open(featurefile) as f: - cfg = yaml.load(f) + cfg = yaml.load(f, Loader=yaml.SafeLoader) validate(instance=cfg, schema=schema) features[featurefile] = cfg if args.markdown: output_markdown(features) + if __name__ == '__main__': main() -- 2.16.6