[VOL-5009] - Update release notes
config.mk
makefiles/*
-----------
o Refresh library makefiles from https://github.com/opencord/onf-make.
o More lint targets added with exclusions in config.mk
makefiles/virtualenv.mk
patches/lib/python3.10/site-packages/robot/utils/normalizing.py/patch
patches/lib/python3.10/site-packages/robot/utils/robottypes3.py/patch
patches/python_310_migration.sh
---------------------------------------------------------------------
o Continue normalizing virtualenv install directory.
o Update patches to modify .venv VS vst_venv [, vdoc_venv, vfoo_venv, vbar_venv, ...)
o virtualenv.mk now defines named targets for patching-up-to 3.10 installs.
release_notes/voltha_2.12.rst
-----------------------------
o Update version string info.
o Onos component table condensed and populated with versioned urls.
o voltha components table is a WIP.
howto/release/repositories/
---------------------------
o Begin capturing repo-specific activities for release.
o Silly having to figure this out each release cycle.
o Automation and release helper scripts can be found here:
- https://github.com/joey-onf/voltha-release
sphinx_conf/exclude_patterns.py
-------------------------------
o Roach squashing exercise, external repos pulled in as git-submodules.
o New repository files appear as problems when running 'make reload'
o Exclude files to squelch messages.
Change-Id: I7adf7b84498511f5cde1e43ad304f9e33283241e
diff --git a/makefiles/lint/Makefile b/makefiles/lint/Makefile
new file mode 100644
index 0000000..2754d0f
--- /dev/null
+++ b/makefiles/lint/Makefile
@@ -0,0 +1,93 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+#
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+.DEFAULT_GOAL := test
+
+HIDE ?= @
+SHELL := bash -e -o pipefail
+
+dot ?= .
+TOP ?= $(dot)
+MAKEDIR ?= $(TOP)/makefiles
+
+env-clean = /usr/bin/env --ignore-environment
+
+jq = $(env-clean) jq
+jq-args += --exit-status
+
+YAMLLINT = $(shell which yamllint)
+yamllint := $(env-clean) $(YAMLLINT)
+yamllint-args := -c .yamllint
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+all:
+
+lint += lint-json
+lint += lint-yaml
+
+lint : $(lint)
+test : lint
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+lint-yaml yaml-lint:
+ifeq ($(null),$(shell which yamllint))
+ $(error "Please install yamllint to run linting")
+endif
+ $(HIDE)$(env-clean) find . -name '*.yaml' -type f -print0 \
+ | xargs -0 -t -n1 $(yamllint) $(yamllint-args)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+lint-json:
+ $(HIDE)$(env-clean) find . -name '*.json' -type f -print0 \
+ | xargs -0 -t -n1 $(jq) $(jq-args) $(dot) >/dev/null
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+pre-check:
+ @echo "[REQUIRED] Checking for linting tools"
+ $(HIDE)which jq
+ $(HIDE)which yamllint
+ @echo
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+clean:
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+todo:
+ @echo
+ @echo "USAGE: $(MAKE)"
+ @echo "[TODO]"
+ @echo " o Update to support standard makefile target behavior:"
+ @echo " all taget is test not default behavior for automation."
+ @echo " o Change lint target dep from test to check -or smoke"
+ @echo " target test sould be more involved with content validation"
+ @echo " o Refactor lint target(s) with voltha-system-tests/makefiles"
+ @echo " o Linting should be dependency driven,"
+ @echo " only check when sources are modified."
+ @echo
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help:
+ @echo
+ @echo "USAGE: $(MAKE)"
+ @echo " lint perform syntax checks on source"
+ @echo " test perform syntax checks on source"
+ @echo " pre-check Verify tools and deps are available for testing"
+ @echo
+ @echo "[LINT]"
+ @echo " lint-json Syntax check .json sources"
+ @echo " lint-yaml Syntax check .yaml sources"
+ @echo
+# [EOF]
diff --git a/makefiles/lint/doc8/include.mk b/makefiles/lint/doc8/include.mk
index d0263af..6490b89 100644
--- a/makefiles/lint/doc8/include.mk
+++ b/makefiles/lint/doc8/include.mk
@@ -36,7 +36,7 @@
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
-include $(MAKEDIR)/lint/doc8/excl.mk
+include $(ONF_MAKEDIR)/lint/doc8/excl.mk
ifdef lint-doc8-excl
lint-doc8-excl-args += $(addprefix --ignore-path$(space),$(lint-doc8-excl))
diff --git a/makefiles/lint/groovy/README.md b/makefiles/lint/groovy/README.md
new file mode 100644
index 0000000..aa9b41a
--- /dev/null
+++ b/makefiles/lint/groovy/README.md
@@ -0,0 +1,13 @@
+# lint: groovy source
+
+# Invoke the linting tool
+% make lint-groovy
+
+# Alt checking: groovy interpreter
+
+Odd syntax errors can be detected by the groovy interpreter.
+
+% groovy path/to/{source}.groovy
+
+jjb/ pipeline scripts will eventually due to syntax problems but groovy can
+still detect problems like mismatched quotes, invalid op tokens, etc.
diff --git a/makefiles/lint/groovy/include.mk b/makefiles/lint/groovy/include.mk
new file mode 100644
index 0000000..61719a8
--- /dev/null
+++ b/makefiles/lint/groovy/include.mk
@@ -0,0 +1,80 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefiles.lint.groovy.version = 1.1.1 (+local edits)
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+groovy-check := npm-groovy-lint
+
+groovy-check-args := $(null)
+# groovy-check-args += --loglevel info
+# groovy-check-args += --ignorepattern
+# groovy-check-args += --verbose
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+
+## -----------------------------------------------------------------------
+## Intent: Enabled by repository_sandbox_root/config.mk
+## -----------------------------------------------------------------------
+ifndef NO-LINT-GROOVY
+ lint : lint-groovy
+endif
+
+## -----------------------------------------------------------------------
+## Target type: lint all or individual files:
+## o make lint-groovy GROOVY_SRC="a/b/c.groovy d/e/f.groovy"
+## -----------------------------------------------------------------------
+lint-groovy : lint-groovy-$(if $(GROOVY_SRC),src,all)
+
+## -----------------------------------------------------------------------
+## Intent: Perform a lint check on command line script sources
+## -----------------------------------------------------------------------
+lint-groovy-all :
+ $(groovy-check) --version
+ @echo
+ $(HIDE)$(env-clean) find . -iname '*.groovy' -print0 \
+ | $(xargs-n1) $(groovy-check) $(groovy-check-args)
+
+## -----------------------------------------------------------------------
+## Intent: On-demand lint checking
+## -----------------------------------------------------------------------
+lint-groovy-src :
+ ifndef GROOVY_SRC
+ @echo "ERROR: Usage: $(MAKE) $@ GROOVY_SRC="
+ @exit 1
+ endif
+ $(groovy-check) --version
+ @echo
+ $(HIDE) $(groovy-check) $(groovy-check-args) $(GROOVY_SRC)
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-groovy Syntax check groovy sources'
+ ifdef VERBOSE
+ @echo ' lint-groovy-all Lint all sources'
+ @echo ' lint-groovy-src Lint only files listed in GROOVY_SRC='
+ endif
+
+# [EOF]
diff --git a/makefiles/lint/groovy/urls b/makefiles/lint/groovy/urls
new file mode 100644
index 0000000..aa5c5eb
--- /dev/null
+++ b/makefiles/lint/groovy/urls
@@ -0,0 +1,8 @@
+# -*- makefile -*-
+
+# Config file and exclusions
+https://www.npmjs.com/package/npm-groovy-lint#Configuration
+
+https://github.com/nvuillam/npm-groovy-lint
+
+# [EOF]
diff --git a/makefiles/lint/help.mk b/makefiles/lint/help.mk
new file mode 100644
index 0000000..24a5aa1
--- /dev/null
+++ b/makefiles/lint/help.mk
@@ -0,0 +1,31 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2021-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+help ::
+
+# -----------------------------------------------------------------------
+# -----------------------------------------------------------------------
+help-summary ::
+ @echo ' help-lint Display lint target help'
+
+help-simple :: help-lint
+help-lint :
+ @echo
+ @echo "[LINT]"
+ @echo ' help-lint Display lint target help'
+
+# [EOF]
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
index 25d12e9..6586040 100644
--- a/makefiles/lint/include.mk
+++ b/makefiles/lint/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2017-2023 Open Networking Foundation
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -13,36 +13,32 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.1
# -----------------------------------------------------------------------
$(if $(DEBUG),$(warning ENTER))
-# -----------------------------------------------------------------------
-# Intent: Display help banner early before library lint help targets.
-# -----------------------------------------------------------------------
-help::
+help ::
@echo
@echo "[LINT]"
-## Disable python linting in bulk ?
-ifdef NO-LINT-PYTHON
- NO-LINT-FLAKE8 := true
- NO-LINT-PYLINT := true
-endif
+include $(ONF_MAKEDIR)/lint/doc8/include.mk
+include $(ONF_MAKEDIR)/lint/groovy/include.mk
+include $(ONF_MAKEDIR)/lint/jjb.mk
+include $(ONF_MAKEDIR)/lint/json.mk
+include $(ONF_MAKEDIR)/lint/license/include.mk
+include $(ONF_MAKEDIR)/lint/makefile.mk
+include $(ONF_MAKEDIR)/lint/python/include.mk
+include $(ONF_MAKEDIR)/lint/shell.mk
+# include $(ONF_MAKEDIR)/lint/tox/include.mk
+include $(ONF_MAKEDIR)/lint/yaml.mk
-# Define early else {flake8,pylint}.mk will complain:
-# PYTHON_FILES ?= $(error)
-have-python-files := $(if $(strip $(PYTHON_FILES)),true)
-
-##--------------------##
-##---] INCLUDES [---##
-##--------------------##
-include $(MAKEDIR)/lint/doc8/include.mk
-include $(MAKEDIR)/lint/json.mk
-include $(MAKEDIR)/lint/python/include.mk
-include $(MAKEDIR)/lint/robot.mk
-include $(MAKEDIR)/lint/shell.mk
-include $(MAKEDIR)/lint/yaml.mk
+include $(ONF_MAKEDIR)/lint/help.mk
$(if $(DEBUG),$(warning LEAVE))
diff --git a/makefiles/lint/jjb.mk b/makefiles/lint/jjb.mk
new file mode 100644
index 0000000..ccfa073
--- /dev/null
+++ b/makefiles/lint/jjb.mk
@@ -0,0 +1,60 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-venv
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-JJB
+ lint : lint-jjb
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Construct command line for linting jenkins-job-builder config
+## -----------------------------------------------------------------------
+
+ifdef DEBUG
+ lint-jjb-args += --log_level DEBUG# # verbosity: high
+else
+ lint-jjb-args += --log_level INFO# # verbosity: default
+endif
+lint-jjb-args += --ignore-cache
+lint-jjb-args += test# # command action
+lint-jjb-args += -o archives/job-configs# # Generated jobs written here
+lint-jjb-args += --recursive
+lint-jjb-args += --config-xml# # JJB v3.0 write to OUTPUT/jobname/config.xml
+lint-jjb-args += jjb/# # JJB config sources (input)
+
+lint-jjb-deps := $(null)
+lint-jjb-deps += $(venv-activate-script)
+lint-jjb-deps += checkout-ci-management-sub-modules
+lint-jjb: $(lint-jjb-deps)
+ $(activate) && { jenkins-jobs $(lint-jjb-args); }
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo ' lint-jjb Validate jjb job generation'
+ifdef VERBOSE
+ @echo ' DEBUG=1 lint-jjb --log_level=DEBUG'
+endif
+
+# [EOF]
diff --git a/makefiles/lint/license/include.mk b/makefiles/lint/license/include.mk
new file mode 100644
index 0000000..2b42049
--- /dev/null
+++ b/makefiles/lint/license/include.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-REUSE
+ lint : lint-license
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Perform a lint check on makefile sources
+## -----------------------------------------------------------------------
+lint-license:
+ reuse --root . lint
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-reuse License syntax checking'
+
+# [EOF]
diff --git a/makefiles/lint/license/reuse.mk b/makefiles/lint/license/reuse.mk
new file mode 100644
index 0000000..5572bef
--- /dev/null
+++ b/makefiles/lint/license/reuse.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-REUSE
+ lint : lint-license
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Perform a lint check on makefile sources
+## -----------------------------------------------------------------------
+lint-license:
+ reuse --root . lint
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-reuse License syntax checking"
+
+# [EOF]
diff --git a/makefiles/lint/makefile.mk b/makefiles/lint/makefile.mk
new file mode 100644
index 0000000..27206e0
--- /dev/null
+++ b/makefiles/lint/makefile.mk
@@ -0,0 +1,65 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+xargs-n1-local := $(subst -t,$(null),$(xargs-n1))# inhibit cmd display
+
+# Gather sources to check
+# TODO: implement deps, only check modified files
+make-check-find := find . -name 'vendor' -prune
+make-check-find += -o \( -iname makefile -o -name '*.mk' \)
+make-check-find += -type f -print0
+
+make-check := $(MAKE)
+
+make-check-args += --dry-run
+make-check-args += --keep-going
+make-check-args += --warn-undefined-variables
+make-check-args += --no-print-directory
+
+# Quiet internal undef vars
+make-check-args += DEBUG=
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+ifndef NO-LINT-MAKEFILE
+ lint : lint-make
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Perform a lint check on makefile sources
+## -----------------------------------------------------------------------
+lint-make-ignore += JSON_FILES=
+lint-make-ignore += YAML_FILES=
+lint-make:
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** Makefile syntax checking"
+ @echo "** -----------------------------------------------------------------------"
+ $(HIDE)$(env-clean) $(make-check-find) \
+ | $(xargs-n1-local) $(make-check) $(make-check-args) $(lint-make-ignore)
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-make Syntax check [Mm]akefile and *.mk'
+
+# [EOF]
diff --git a/makefiles/lint/python/find_utils.mk b/makefiles/lint/python/find_utils.mk
new file mode 100644
index 0000000..7ab4c4f
--- /dev/null
+++ b/makefiles/lint/python/find_utils.mk
@@ -0,0 +1,32 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Intent:
+# o Construct a find command able to gather python files with filtering.
+# o Used by library makefiles flake8.mk and pylint.mk for iteration.
+# -----------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Construct a string for invoking find \( excl-pattern \) -prune
+# -----------------------------------------------------------------------
+gen-python-find-excl = \
+ $(strip \
+ -name '__ignored__' \
+ $(foreach dir,$($(1)),-o -name $(dir)) \
+ )
+
+## -----------------------------------------------------------------------
+## Intent: Construct a find command to gather a list of python files
+## with exclusions.
+## -----------------------------------------------------------------------
+## Usage:
+# $(activate) & $(call gen-python-find-cmd) | $(args-n1) pylint
+## -----------------------------------------------------------------------
+gen-python-find-cmd = \
+ $(strip \
+ find . \
+ \( $(call gen-python-find-excl,onf-excl-dirs) \) -prune \
+ -o -name '*.py' \
+ -print0 \
+ )
+
+# [EOF]
diff --git a/makefiles/lint/python/flake8.mk b/makefiles/lint/python/flake8.mk
index bb474a9..cf1bc2b 100644
--- a/makefiles/lint/python/flake8.mk
+++ b/makefiles/lint/python/flake8.mk
@@ -32,18 +32,26 @@
## -----------------------------------------------------------------------
ifndef NO-LINT-FLAKE8
lint-flake8-mode := $(if $(have-python-files),modified,all)
- lint : lint-flake8-$(lint-flake8-mode)
+ lint : lint-flake8
+ lint-flake8 : lint-flake8-$(lint-flake8-mode)
endif# NO-LINT-FLAKE8
## -----------------------------------------------------------------------
## Intent: exhaustive flake8 syntax checking
## -----------------------------------------------------------------------
+# Construct: find . \( -name '__ignored__' -o -name dir -o name dir \)
+# flake8-find-filter := $(null)
+# flake8-find-filter += -name '__ignored__'# # for alignment
+# flake8-find-filter += $(foreach dir,$(onf-excl-dirs),-o -name $(dir)))
+
lint-flake8-all: $(venv-activate-script)
$(HIDE)$(MAKE) --no-print-directory lint-flake8-install
- $(activate)\
- && find . \( -name '$(venv-name)' \) -prune -o -name '*.py' -print0 \
- | $(xargs-n1) flake8 --max-line-length=99 --count
+ $(activate) && $(call gen-python-find-cmd) \
+ | $(xargs-n1) flake8 --max-line-length=99 --count
+
+# && find . \( $(flake8-find-filter) \) -prune -o -name '*.py' -print0 \
+# | $(xargs-n1) flake8 --max-line-length=99 --count
## -----------------------------------------------------------------------
## Intent: check deps for format and python3 cleanliness
@@ -78,6 +86,7 @@
@echo ' $(MAKE) lint-pylint PYTHON_FILES=...'
@echo ' lint-flake8-modified flake8 checking: only modified'
@echo ' lint-flake8-all flake8 checking: exhaustive'
+ @echo ' lint-flake8-install Install the flake8 command'
endif
$(if $(DEBUG),$(warning LEAVE))
diff --git a/makefiles/lint/python/include.mk b/makefiles/lint/python/include.mk
index 69811a5..ce7d7af 100644
--- a/makefiles/lint/python/include.mk
+++ b/makefiles/lint/python/include.mk
@@ -15,13 +15,17 @@
# limitations under the License.
# -----------------------------------------------------------------------
+$(if $(DEBUG),$(warning ENTER))
+
##-------------------##
##---] GLOBALS [---##
##-------------------##
$(if $(UNSTABLE),$(eval lint-python-all := true))
-include $(MAKEDIR)/lint/python/flake8.mk
-include $(MAKEDIR)/lint/python/pylint.mk
-# include $(MAKEDIR)/lint/python/tox.mk
+include $(ONF_MAKEDIR)/lint/python/find_utils.mk
+include $(ONF_MAKEDIR)/lint/python/flake8.mk
+include $(ONF_MAKEDIR)/lint/python/pylint.mk
+
+$(if $(DEBUG),$(warning LEAVE))
# [EOF]
diff --git a/makefiles/lint/python/pylint.mk b/makefiles/lint/python/pylint.mk
index 9dc1c7c..87ffb43 100644
--- a/makefiles/lint/python/pylint.mk
+++ b/makefiles/lint/python/pylint.mk
@@ -34,21 +34,26 @@
## -----------------------------------------------------------------------
ifndef NO-LINT-PYLINT
lint-pylint-mode := $(if $(have-python-files),modified,all)
- lint : lint-pylint-$(lint-pylint-mode)
+ lint : lint-pylint
+ lint-pylint : lint-pylint-$(lint-pylint-mode)
endif# NO-LINT-PYLINT
## -----------------------------------------------------------------------
## Intent: exhaustive pylint syntax checking
## -----------------------------------------------------------------------
-pylint-find-args := $(null)
-pylint-find-args += -name '$(venv-name)'
-pylint-find-args += -o -name 'patches'
+
+# Construct: find . \( -name '__ignored__' -o -name dir -o name dir \)
+# pylint-find-filter := $(null)
+# pylint-find-filter += -name '__ignored__'# # for alignment
+# pylint-find-filter += $(foreach dir,$(onf-excl-dirs),-o -name $(dir)))
+
+# pylint-find-filter := $(call gen-python-find-excl,onf-excl-dirs)
+# $(error pylint-find-filter := $(pylint-find-filter))
lint-pylint-all: $(venv-activate-script)
$(MAKE) --no-print-directory lint-pylint-install
- $(activate)\
- && find . \( $(pylint-find-args) \) -prune -o -name '*.py' -print0 \
- | $(xargs-n1) pylint
+ $(activate) && $(call gen-python-find-cmd) | $(xargs-n1) pylint
+# | $(xargs-n1-clean) yamllint --strict
## -----------------------------------------------------------------------
## Intent: check deps for format and python3 cleanliness
@@ -82,6 +87,7 @@
@echo ' $(MAKE) lint-pylint PYTHON_FILES=...'
@echo ' lint-pylint-modified pylint checking: only modified'
@echo ' lint-pylint-all pylint checking: exhaustive'
+ @echo ' lint-pylint-install Install the pylint command'
endif
$(if $(DEBUG),$(warning LEAVE))
diff --git a/makefiles/lint/robot.mk b/makefiles/lint/robot.mk
index fa8175c..6c67ad3 100644
--- a/makefiles/lint/robot.mk
+++ b/makefiles/lint/robot.mk
@@ -15,15 +15,7 @@
# limitations under the License.
# -----------------------------------------------------------------------
-$(if $(DEBUG),$(warning ENTER))
-
-##-------------------##
-##---] GLOBALS [---##
-##-------------------##
-.PHONY: lint-robot lint-robot-all lint-robot-modified
-
-have-robot-files := $(if $(ROBOT_FILES),true)
-ROBOT_FILES ?= $(error ROBOT_FILES= required)
+ROBOT_FILES ?= $(error ROBOT_FILES= is required)
LINT_ARGS ?= --verbose --configure LineTooLong:130 -e LineTooLong \
--configure TooManyTestSteps:65 -e TooManyTestSteps \
@@ -33,62 +25,19 @@
--configure FileTooLong:2000 -e FileTooLong \
-e TrailingWhitespace
-## -----------------------------------------------------------------------
-## Intent: Use the robot command to perform syntax checking.
-## % make lint
-## % make lint-robot-all
-## % make lint-robot-modified
-## -----------------------------------------------------------------------
+
+.PHONY: lint-robot
+
ifndef NO-LINT-ROBOT
- lint-robot-mode := $(if $(have-robot-files),modified,all)
- lint : lint-robot-$(lint-robot-mode)
-endif# NO-LINT-ROBOT
+ lint : lint-robot
+endif
-## -----------------------------------------------------------------------
-## Intent: exhaustive robot syntax checking
-## -----------------------------------------------------------------------
-lint-robot-all:
- $(HIDE)$(MAKE) --no-print-directory rflint-install
+lint-robot: vst_venv
+ source ./$</bin/activate \
+ ; set -u \
+ ; rflint $(LINT_ARGS) $(ROBOT_FILES)
- $(activate)\
- && find . \( -iname '*.robot' \) -print0 \
- | $(xargs-n1) rflint $(LINT_ARGS)
-
-## -----------------------------------------------------------------------
-## Intent: check deps for format and python3 cleanliness
-## Note:
-## robot --py3k option no longer supported
-## -----------------------------------------------------------------------
-lint-robot-modified: $(venv-activate-script)
- $(HIDE)$(MAKE) --no-print-directory rflint-install
-
- $(activate) && rflint $(LINT_ARGS) $(ROBOT_FILES)
-
-## -----------------------------------------------------------------------
-## Intent: Install the rflint command for syntax checking.
-## Note: requirements.txt pip install not used here ATM due to implicit
-## per-repository dependency config to enable checking.
-## -----------------------------------------------------------------------
-rflint-install: $(venv-activate-script)
- @echo
- @echo "** -----------------------------------------------------------------------"
- @echo "** robot syntax checking"
- @echo "** -----------------------------------------------------------------------"
- $(activate)\
- && pip install --upgrade robotframework-lint
- $(activate) && rflint --version
- @echo
-
-## -----------------------------------------------------------------------
-## Intent: Display command usage
-## -----------------------------------------------------------------------
help::
- @echo ' lint-robot Syntax check python using the robot command'
- ifdef VERBOSE
- @echo ' lint-robot-all robot checking: exhaustive'
- @echo ' lint-robot-modified robot checking: only modified'
- endif
-
-$(if $(DEBUG),$(warning LEAVE))
+ @echo " lint-robot Syntax check robot sources using rflint"
# [EOF]
diff --git a/makefiles/lint/shell.mk b/makefiles/lint/shell.mk
index 3c04539..3c33bb2 100644
--- a/makefiles/lint/shell.mk
+++ b/makefiles/lint/shell.mk
@@ -1,8 +1,8 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
-# Licensed under the Apache License, Version 2.0 (the "License")
+# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@@ -14,74 +14,52 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------
-
-$(if $(DEBUG),$(warning ENTER))
+# https://gerrit.opencord.org/plugins/gitiles/onf-make
+# ONF.makefile.version = 1.0
+# -----------------------------------------------------------------------
##-------------------##
##---] GLOBALS [---##
##-------------------##
-.PHONY: lint-shell lint-shell-all lint-shell-modified
-have-shell-sources := $(if $(strip $(SHELL_SOURCES)),true)
-SHELL_SOURCES ?= $(error SHELL_SOURCES= required)
+# Gather sources to check
+# TODO: implement deps, only check modified files
+shell-check-find := find .
+# vendor scripts but they really should be lintable
+shell-check-find += -name 'vendor' -prune
+shell-check-find += -o \( -name '*.sh' \)
+shell-check-find += -type f -print0
-## -----------------------------------------------------------------------
-## Intent: Use the shell command to perform syntax checking.
-## % make lint
-## % make lint-shell-all
-## -----------------------------------------------------------------------
+shell-check := $(env-clean) shellcheck
+# shell-check := shellcheck
+
+shell-check-args += --check-sourced
+shell-check-args += --external-sources
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
ifndef NO-LINT-SHELL
- lint-shell-mode := $(if $(have-shell-sources),modified,all)
- lint : lint-shell-$(lint-shell-mode)
-endif# NO-LINT-SHELL
+ lint : lint-shell
+endif
## -----------------------------------------------------------------------
-## Intent: exhaustive shell syntax checking
+## Intent: Perform a lint check on command line script sources
## -----------------------------------------------------------------------
-shellcheck-find-args := $(null)
-shellcheck-find-args += -name '$(venv-name)'
-shellcheck-find-args += -o -name 'staging'
-lint-shell-all:
- $(MAKE) --no-print-directory lint-shellcheck-install
-
- find . \( $(shellcheck-find-args) \) -prune -name '*.sh' -print0 \
- | $(xargs-n1-clean) shellcheck
-
-## -----------------------------------------------------------------------
-## Intent: check deps for format and python3 cleanliness
-## Note:
-## shell --py3k option no longer supported
-## -----------------------------------------------------------------------
-lint-shell-modified:
- $(MAKE) --no-print-directory lint-shell-install
-
- shellcheck $(SHELL_SOURCES)
-
-## -----------------------------------------------------------------------
-## Intent:
-## -----------------------------------------------------------------------
-.PHONY: lint-shellcheck-install
-lint-shellcheck-install:
+lint-shell:
+ $(shell-check) -V
@echo
- @echo "** -----------------------------------------------------------------------"
- @echo '** command shell syntax checking'
- @echo "** -----------------------------------------------------------------------"
-
- # {apt-get,rpm,yum} install shellcheck
- shellcheck --version
- @echo
+ $(HIDE)$(env-clean) $(shell-check-find) \
+ | $(xargs-n1) $(shell-check) $(shell-check-args)
## -----------------------------------------------------------------------
-## Intent: Display command usage
+## Intent: Display command help
## -----------------------------------------------------------------------
-help::
- @echo ' lint-shell Syntax check sources using shellcheck'
- ifdef VERBOSE
- @echo ' $(MAKE) lint-shell SHELL_SOURCES=...'
- @echo ' lint-shell-modified shell checking: only modified'
- @echo ' lint-shell-all shell checking: exhaustive'
- endif
+help-summary ::
+ @echo ' lint-shell Syntax check shell sources'
-$(if $(DEBUG),$(warning LEAVE))
+# [SEE ALSO]
+# -----------------------------------------------------------------------
+# o https://www.shellcheck.net/wiki/Directive
# [EOF]
diff --git a/makefiles/lint/tox/include.mk b/makefiles/lint/tox/include.mk
new file mode 100644
index 0000000..7d7cf3e
--- /dev/null
+++ b/makefiles/lint/tox/include.mk
@@ -0,0 +1,27 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+include $(ONF_MAKEDIR)/lint/tox/tox.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/tox/tox.mk b/makefiles/lint/tox/tox.mk
new file mode 100644
index 0000000..35cec00
--- /dev/null
+++ b/makefiles/lint/tox/tox.mk
@@ -0,0 +1,91 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-tox lint-tox-all lint-tox-modified
+
+PYTHON_FILES ?= $(error PYTHON_FILES= required)
+
+## -----------------------------------------------------------------------
+## Intent: Sanity check incoming JJB config changes.
+## Todo: Depend on makefiles/lint/jjb.mk :: lint-jjb
+## -----------------------------------------------------------------------
+ifndef NO-LINT-TOX
+ lint-tox-mode := $(if $(have-python-files),modified,all)
+ lint : lint-tox
+ lint-tox : lint-tox-$(lint-tox-mode)
+endif# NO-LINT-TOX
+
+## -----------------------------------------------------------------------
+## Intent: Invoke tox on all sources
+## -----------------------------------------------------------------------
+lint-tox-all: $(venv-activate-script)
+ $(MAKE) --no-print-directory lint-tox-install
+
+ $(activate) && tox -e py310
+
+## -----------------------------------------------------------------------
+## Intent: Invoke tox on modified sources (target is mainly for consistency)
+## -----------------------------------------------------------------------
+lint-tox-modified: $(venv-activate-script)
+ $(MAKE) --no-print-directory lint-tox-install
+
+ $(activate) && tox -e py310 $(PYTHON_FILES)
+
+## -----------------------------------------------------------------------
+## Intent: https://tox.wiki/en/4.6.4/installation.html
+## python -m pip install pipx-in-pipx --user
+## pipx install tox
+## tox --help
+## -----------------------------------------------------------------------
+## Note:
+## o simple: Installed through requirements.txt
+## o This target can make usage on-demand.
+## -----------------------------------------------------------------------
+.PHONY: lint-tox-install
+lint-tox-install: $(venv-activate-script)
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** python tox syntax checking"
+ @echo "** -----------------------------------------------------------------------"
+ $(activate) && pip install --upgrade tox
+ $(activate) && tox --version
+ @echo
+
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-tox Invoke the tox test command'
+ ifdef VERBOSE
+ @echo ' $(MAKE) lint-tox PYTHON_FILES=...'
+ @echo ' lint-tox-modified tox checking: only modified'
+ @echo ' lint-tox-all tox checking: exhaustive'
+ @echo ' lint-tox-install Install the tox command'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/urls b/makefiles/lint/urls
new file mode 100644
index 0000000..5694a1b
--- /dev/null
+++ b/makefiles/lint/urls
@@ -0,0 +1,5 @@
+# -*- makefile -*-
+
+https://www.shellcheck.net/wiki/Directive
+
+# [EOF]
\ No newline at end of file
diff --git a/makefiles/lint/yaml.mk b/makefiles/lint/yaml.mk
index 566ac18..ab5b9d6 100644
--- a/makefiles/lint/yaml.mk
+++ b/makefiles/lint/yaml.mk
@@ -33,9 +33,11 @@
## % make lint UNSTABLE=1
## % make lint-yaml-all
## -----------------------------------------------------------------------
+lint-yaml-mode := $(if $(have-yaml-files),modified,all)
+lint-yaml : lint-yaml-$(lint-yaml-mode)
+
ifndef NO-LINT-YAML
- lint-yaml-mode := $(if $(have-yaml-files),modified,all)
- lint : lint-yaml-$(lint-yaml-mode)
+ lint : lint-yaml# # Enable as a default lint target
endif# NO-LINT-YAML
## -----------------------------------------------------------------------
@@ -74,7 +76,7 @@
@echo ' lint-yaml Syntax check python using the yaml command'
ifdef VERBOSE
@echo ' lint-yaml-all yaml checking: exhaustive'
- @echo ' lint-yaml-modified yaml checking: only modified'
+ @echo ' lint-yaml-modified yaml checking: only locally modified'
endif
$(if $(DEBUG),$(warning LEAVE))