docs: fix issues with src/scripts/fts.py 66/23166/2
authorPaul Vinciguerra <pvinci@vinciconsulting.com>
Fri, 1 Nov 2019 06:34:32 +0000 (02:34 -0400)
committerOle Trøan <otroan@employees.org>
Tue, 5 Nov 2019 20:47:18 +0000 (20:47 +0000)
  - packaging issue
  - yaml deprecation
  - yaml formatting

Type: fix

Change-Id: Ia8808cbc83271a3067164f2db2418f071b35607a
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Makefile
src/plugins/mdata/FEATURE.yaml
src/scripts/fts.py

index cca8534..1a11da8 100644 (file)
--- 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=<path>      - startup configuration file"
        @echo "                            (e.g. /etc/vpp/startup.conf)"
-       @echo " STARTUP_DIR=<path>       - startup drectory (e.g. /etc/vpp)"
+       @echo " STARTUP_DIR=<path>       - startup directory (e.g. /etc/vpp)"
        @echo "                            It also sets STARTUP_CONF if"
        @echo "                            startup.conf file is present"
        @echo " GDB=<path>               - 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
 
 #
index c71281d..404739e 100644 (file)
@@ -2,12 +2,12 @@ name: Buffer Metadata Change Tracker (mdata)
 maintainer: Dave Barach <dave@barachs.net>
 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]
index 6d224dd..eb44be9 100755 (executable)
@@ -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()