Misc cleanups, add installer for lint-groovy
makefiles/npm/README.md
makefiles/npm/include.mk
makefiles/npm/nvm.mk
makefiles/npm/npm.mk
-------------------------
o Genreate targets and deps for installing tools nvm, npm and npm-groovy-lint.
o Tools are intended for interactive use.
o npm-groovy-lint is a dependency for the lint-groovy target
config.mk
.gitignore
----------
o Add exclusion lf/onf-make for repo:onf-make git submodule.
o Add exclusion for .tmp (makefiles/nvm/nvm.mk)
makefiles/lint/groovy/groovy.mk
makefiles/lint/groovy/include.mk
makefiles/lint/groovy/install.mk
--------------------------------
o Update targets to latest lint-{language}-{all,mod,src} syntax.
o Installer updated to depend on npm/nvm.mk target 'npm-groovy-install'.
makefiles/lint/make/makefile.mk
makefiles/lint/json.mk
makefiles/lint/python/flake8.mk
makefiles/lint/shell/shellcheck.mk
makefiles/lint/yaml.mk
------------------------
o Simplify find command exclusions.
o Use "-not -path [p]" in place of "( -name p ) -prune".
makefiles/main/tempdir/tempdir.mk
---------------------------------
o Fixed a typo $(HELP) -> $(HIDE)
makefiles/lint/doc8/doc8.ini
-------------------------------
o Add directory exclusions from onf-excl-dir=.
o Remove txt from the list of file extensions to check
repo:voltha-docs is the only repo with *.txt files that contain
restructuredText so add the extension in the local per-repository
config.
Signed-off-by: Joey Armstrong <jarmstrong@linuxfoundation.org>
Change-Id: Ia2e091d812af82063c79ed855bc7dd4f5ec8f706
diff --git a/.gitignore b/.gitignore
index ab10eb5..e6f21b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,22 +25,9 @@
__pycache__/
tmp/
+.tmp/
## Python patch creation
staging/
-## -----------------------------------------------------------------------
-## License checking:
-## o Absolutely no exceptions, exclusions are not supported.
-## o We cannot simply hack around the problem by inlininig a notice
-## to disable checking because comments will be branded into the
-## patched file.
-## o Maybe this is OK given the patched file is a derived work but
-## legal input required before that answer can be used.
-## -----------------------------------------------------------------------
-makefiles/virtualenv/patches/lib/python3.10/site-packages/robot/utils/normalizing.py/patch
-makefiles/virtualenv/patches/lib/python3.10/site-packages/robot/utils/robottypes3.py/patch
-makefiles/virtualenv/patches/lib/python3.10/site-packages/sphinx/util/typing.py/patch
-makefiles/virtualenv/patches/lib/python3.10/site-packages/sphinxcontrib/openapi/utils.py/patch
-
# [EOF]
diff --git a/Makefile b/Makefile
index 95c773c..ccc6a73 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,7 @@
##--------------------##
##---] INCLUDES [---##
##--------------------##
+include config.mk
include $(onf-mk-top)/makefiles/include.mk
## -----------------------------------------------------------------------
diff --git a/config.mk b/config.mk
index 91e6f66..d11f8a6 100644
--- a/config.mk
+++ b/config.mk
@@ -27,6 +27,7 @@
##---] Disable lint targets [---##
##--------------------------------##
# NO-LINT-DOC8 := true
+# USE_DOC8_INI := true
# NO-LINT-GOLANG := true
# NO-LINT-GROOVY := true# # Note[1]
# NO-LINT-JJB := true# # Note[2]
@@ -71,10 +72,14 @@
##---] Filesystem exclusions [---##
##---------------------------------##
onf-excl-dirs := $(null) # make clean: dirs=
+onf-excl-dirs += lf/onf-make # repo:onf-make git submodule
onf-excl-dirs += .venv# # $(venv-name)
-onf-excl-dirs += vendor# # golang / voltha*-go
onf-excl-dirs += patches# # voltha docs - python upgrade
+onf-excl-dirs += .tmp #
onf-excl-dirs += .tox # also a python dependency
+# onf-excl-dirs += vendor# # golang / voltha*-go -- local exclude
+
+# [NOTE] Add exclusions: lint/doc8/doc8.incl
ifeq ($(--repo-name--),voltha-docs)
lint-doc8-excl += '_build' # TODO: deprecate
diff --git a/makefiles/include.mk b/makefiles/include.mk
index ddcc857..e2a1220 100644
--- a/makefiles/include.mk
+++ b/makefiles/include.mk
@@ -65,6 +65,7 @@
# include $(onf-mk-dir)/patches/include.mk# # Patch when python 3.10+ in use
include $(onf-mk-dir)/commands/include.mk # Tools and local installers
+include $(onf-mk-dir)/npm/include.mk
include $(onf-mk-dir)/lint/include.mk
include $(onf-mk-dir)/gerrit/include.mk
diff --git a/makefiles/lint/doc8/doc8.ini b/makefiles/lint/doc8/doc8.ini
index 42e3e41..7b5355d 100644
--- a/makefiles/lint/doc8/doc8.ini
+++ b/makefiles/lint/doc8/doc8.ini
@@ -76,8 +76,9 @@
# verbose=1
-extension = rst, txt
-ignore-path = .venv, */.venv
+# extension = rst, txt
+extension = rst
+ignore-path = lf/onf-make/*, .venv, */.venv, .tmp */.tmp
# ignore-path-errors=/tmp/other_thing.rst;D001;D002
# voltha-helm-charts/voltha-infra/templates/NOTES.txt:12: D001 Line too long
diff --git a/makefiles/lint/groovy/command.mk b/makefiles/lint/groovy/command.mk
new file mode 100644
index 0000000..9a6557b
--- /dev/null
+++ b/makefiles/lint/groovy/command.mk
@@ -0,0 +1,39 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2024 Open Networking Foundation 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-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent:
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+lint-groovy-cmd := $(call node-get-tool-path,npm-groovy-lint)
+
+# lint-groovy-conf := $(call path-by-makefile,.groovylintrc.json)
+lint-groovy-conf := $(onf-mk-dir)/lint/groovy/.groovylintrc.json
+
+lint-groovy-args := $(null)
+lint-groovy-args += --config $(lint-groovy-conf)
+
+
+# lint-groovy-args += --loglevel info
+# lint-groovy-args += --ignorepattern
+# lint-groovy-args += --verbose
+
+# [EOF]
+
diff --git a/makefiles/lint/groovy/groovy.mk b/makefiles/lint/groovy/groovy.mk
new file mode 100644
index 0000000..0652bb4
--- /dev/null
+++ b/makefiles/lint/groovy/groovy.mk
@@ -0,0 +1,108 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-2024 Open Networking Foundation 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-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent:
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-groovy
+.PHONY: lint-groovy-all lint-groovy-mod lint-groovy-src
+
+have-groovy-files := $(if $(strip $(GROOVY_SOURCE)),true)
+GROOVY_SOURCE ?= $(error GROOVY_SOURCE= is required)
+
+groovy-check := $(activate-npm) && $(lint-groovy-cmd) $(lint-groovy-args)
+
+##-------------------##
+##---] TARGETS [---##
+##-------------------##
+
+## -----------------------------------------------------------------------
+## Intent: Enabled by repository_sandbox_root/config.mk
+## -----------------------------------------------------------------------
+ifndef NO-LINT-GROOVY
+ lint-groovy-mode := $(if $(have-groovy-files),mod,all)
+ lint-groovy : lint
+ lint-groovy : lint-groovy-$(lint-groovy-mode)
+endif# NO-LINT-GROOVY
+
+
+groovy-find-args += $(foreach dir,$(onf-excl-dirs),-not -path './$(dir)/*')
+
+## -----------------------------------------------------------------------
+## Intent: Perform a lint check on command line script sources
+## -----------------------------------------------------------------------
+lint-groovy-all: lint-groovy-version
+
+ $(call banner-enter,Target $@)
+
+ @echo
+# $(HIDE)$(env-clean) find . \
+#-not -path './.tmp/*' \
+#-not -path "./.$(venv-name)/*" \
+
+ $(HIDE)$(env-clean) find . $(groovy-find-args) -iname '*.groovy' -print0 \
+ | $(xargs-n1) bash -c "$(groovy-check)"
+
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: On-demand lint checking
+## -----------------------------------------------------------------------
+lint-groovy-src : lint-groovy-version
+
+ ifndef GROOVY_SRC
+ @echo "ERROR: Usage: $(MAKE) $@ GROOVY_SRC="
+ @exit 1
+ endif
+
+ $(call banner-enter,Target $@)
+ @echo
+ $(HIDE) $(groovy-check) $(GROOVY_SRC)
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Perform lint check on locally modified sources
+## -----------------------------------------------------------------------
+lint-groovy-bygit = $(git status -s | grep '\.groovy' | grep -v -e '^D' -e '^?' | cut -c4-)
+lint-groovy-mod: lint-groovy-version
+
+ $(call banner-enter,Target $@)
+ @echo
+ $(foreach fyl,$(lint-groovy-bygit),$(groovy-check) $(fyl))
+ $(call banner-leave,Target $@)
+
+## -----------------------------------------------------------------------
+## Intent: Display command help
+## -----------------------------------------------------------------------
+help-summary ::
+ @echo ' lint-groovy Conditionally lint groovy source'
+ ifdef VERBOSE
+ @echo ' lint-groovy-all Lint all available sources'
+ @echo ' lint-groovy-mod Lint locally modified (git status)'
+ @echo ' lint-groovy-src Lint individually (BY_SRC=list-of-files)'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/groovy/help.mk b/makefiles/lint/groovy/help.mk
new file mode 100644
index 0000000..3268d4b
--- /dev/null
+++ b/makefiles/lint/groovy/help.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2024 Open Networking Foundation 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: 2017-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Intent: Display topic help
+## -----------------------------------------------------------------------
+help-summary ::
+ @printf ' %-33.33s %s\n' 'lint-groovy' 'Syntax check sources'
+ @printf ' %-33.33s %s\n' 'lint-groovy-help' 'Extended target help'
+
+## -----------------------------------------------------------------------
+## Intent: Display extended topic help
+## -----------------------------------------------------------------------
+.PHONY: lint-groovy-help
+lint-groovy-help ::
+ @printf ' %-33.33s %s\n' 'lint-groovy-all' 'Lint all available sources'
+ @printf ' %-33.33s %s\n' 'lint-groovy-mod' 'Lint locally modified (git status)'
+ @printf ' %-33.33s %s\n' 'lint-groovy-src' 'Lint individually (GROOVY_SRC=...)'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/lint/groovy/include.mk b/makefiles/lint/groovy/include.mk
index 8caddd7..c1660f1 100644
--- a/makefiles/lint/groovy/include.mk
+++ b/makefiles/lint/groovy/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022-2024 Open Networking Foundation Contributors
+# Copyright 2017-2024 Open Networking Foundation Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,93 +14,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------
-# SPDX-FileCopyrightText: 2022-2024 Open Networking Foundation Contributors
+# SPDX-FileCopyrightText: 2017-2024 Open Networking Foundation Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
# Intent:
# -----------------------------------------------------------------------
-##-------------------##
-##---] GLOBALS [---##
-##-------------------##
+# ------------------------------------------------------------
+# Intent: Generate command installer targets with dependencies
+# ------------------------------------------------------------
+$(call gen-npm-install,npm-groovy-lint)
-groovy-check := npm-groovy-lint
+##--------------------##
+##---] INCLUDES [---##
+##--------------------##
+include $(onf-mk-top)/lint/groovy/command.mk
-groovy-check-conf := $(call path-by-makefile,.groovylintrc.json)
-
-groovy-check-args := $(null)
-groovy-check-args += --config "$(groovy-check-conf)"
-
-# 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
-
-## -----------------------------------------------------------------------
-## All or on-demand
-## make lint-groovy BY_SRC="a/b/c.groovy d/e/f.groovy"
-## -----------------------------------------------------------------------
-ifdef GROOVY_SRC
- lint-groovy : lint-groovy-src
-else
- lint-groovy : lint-groovy-all
-endif
-
-## -----------------------------------------------------------------------
-## Intent: Perform a lint check on command line script sources
-## -----------------------------------------------------------------------
-lint-groovy-all:
-
- $(call banner-enter,Target $@)
-
- $(groovy-check) --version
- @echo
- $(HIDE)$(env-clean) find . -iname '*.groovy' -print0 \
- | $(xargs-n1) $(groovy-check) $(groovy-check-args)
-
- $(call banner-leave,Target $@)
-
-## -----------------------------------------------------------------------
-## 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: Perform lint check on locally modified sources
-## -----------------------------------------------------------------------
-# lint-groovy-bygit = $(shell git diff --name-only HEAD | grep '\.groovy')
-lint-groovy-bygit = $(git status -s | grep '\.sh' | grep -v -e '^D' -e '^?' | cut -c4-)
-lint-groovy-mod:
- $(groovy-check) --version
- @echo
- $(foreach fyl,$(lint-groovy-bygit),$(groovy-check) $(groovy-check-args) $(fyl))
-
-## -----------------------------------------------------------------------
-## Intent: Display command help
-## -----------------------------------------------------------------------
-help-summary ::
- @echo ' lint-groovy Conditionally lint groovy source'
- ifdef VERBOSE
- @echo ' lint-groovy-all Lint all available sources'
- @echo ' lint-groovy-mod Lint locally modified (git status)'
- @echo ' lint-groovy-src Lint individually (BY_SRC=list-of-files)'
- endif
+include $(onf-mk-top)/lint/groovy/help.mk
+include $(onf-mk-top)/lint/groovy/install.mk
+include $(onf-mk-top)/lint/groovy/groovy.mk
# [EOF]
diff --git a/makefiles/lint/groovy/install.mk b/makefiles/lint/groovy/install.mk
index 0864a3d..828e4eb 100644
--- a/makefiles/lint/groovy/install.mk
+++ b/makefiles/lint/groovy/install.mk
@@ -17,38 +17,40 @@
# SPDX-FileCopyrightText: 2022-2024 Open Networking Foundation Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
-# Intent:
+# Intent: Install npm-groovy-lint for syntax checking
+# -----------------------------------------------------------------------
+# NOTES: Tool install dependency chain
+# version : tool-install
+# tool-install : npm-tool
+# npm-tool : npm-install
+#
+# % make npm-groovy-lint installs npm, node and npm-groovy-lint
# -----------------------------------------------------------------------
-##-------------------##
-##---] GLOBALS [---##
-##-------------------##
-lint-groovy-cmds += $(shell which npm-groovy-lint)
-lint-groovy-cmds += $(HOME)/.npm/bin/npm-groovy-lint
-lint-groovy-cmds += /usr/bin/npm-groovy-lint
-# lint-groovy-cmds += /dev/null# # force existence
-
-lint-groovy-cmd = $(firstword $(wildcard $(lint-groovy-cmds)))
-
-##-------------------##
-##---] TARGETS [---##
-##-------------------##
-ifndef NO-LINT-GROOVY
-
- lint : lint-groovy
-endif
+$(if $(DEBUG),$(warning ENTER))
## -----------------------------------------------------------------------
-## Intent: Install npm-groovy-lint
+## Intent: Display groovy command version string.
## -----------------------------------------------------------------------
-$(lint-groovy-cmd) : lint-groovy-install
-lint-groovy-install:
+.PHONY: lint-groovy-version
+lint-groovy-version : $(lint-groovy-cmd)
+ @echo
+ $(activate-npm) && "$<" --version
## -----------------------------------------------------------------------
-## Intent: Display command help
+## Intent: On-demand instalation of the groovy command
## -----------------------------------------------------------------------
-help-summary ::
- @echo ' lint-groovy-install Syntax check groovy sources'
+.PHONY: lint-groovy-install
+lint-groovy-install : $(lint-groovy-cmd)
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+lint-groovy-help ::
+ @echo
+ @printf ' %-33.33s %s\n' 'lint-groovy-version' 'Display lint tool version'
+ @printf ' %-33.33s %s\n' 'lint-groovy-install' 'Install lint tool'
+
+ @$(MAKE) --no-print-directory npm-help
# [EOF]
-
diff --git a/makefiles/lint/json.mk b/makefiles/lint/json.mk
index e0d705c..b50ebcb 100644
--- a/makefiles/lint/json.mk
+++ b/makefiles/lint/json.mk
@@ -47,12 +47,13 @@
## Intent: exhaustive json syntax checking
## -----------------------------------------------------------------------
json-find-args := $(null)
-json-find-args += -name '$(venv-name)'
+json-find-args += $(foreach dir,$(onf-excl-dirs),-not -path './$(dir)/*')
+
lint-json-all:
$(HIDE)$(MAKE) --no-print-directory lint-json-install
$(activate)\
- && find . \( $(json-find-args) \) -prune -o -name '*.json' -print0 \
+ && find . $(json-find-args) -name '*.json' -print0 \
| $(xargs-n1) python -m json.tool > /dev/null ;\
## -----------------------------------------------------------------------
diff --git a/makefiles/lint/make/makefile.mk b/makefiles/lint/make/makefile.mk
index 35cc450..9ad866e 100644
--- a/makefiles/lint/make/makefile.mk
+++ b/makefiles/lint/make/makefile.mk
@@ -27,8 +27,10 @@
# 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 := find .
+# -name 'vendor' -prune
+make-check-find += $(foreach dir,$(onf-excl-dirs),-not -path './$(dir)/*')
+make-check-find += -a \( -iname makefile -o -name '*.mk' \)
make-check-find += -type f -print0
make-check := $(MAKE)
diff --git a/makefiles/lint/python.mk b/makefiles/lint/python.mk
deleted file mode 100644
index 930f65c..0000000
--- a/makefiles/lint/python.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- makefile -*-
-# -----------------------------------------------------------------------
-# Copyright 2022-2024 Open Networking Foundation 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-2024 Open Networking Foundation Contributors
-# SPDX-License-Identifier: Apache-2.0
-# -----------------------------------------------------------------------
-# Intent:
-# -----------------------------------------------------------------------
-
-##-------------------##
-##---] GLOBALS [---##
-##-------------------##
-
-# Gather sources to check
-# TODO: implement deps, only check modified files
-python-check-find := find . -name '*venv*' -prune\
- -o \( -name '*.py' \)\
- -type f -print0
-
-# python-check := $(env-clean) pylint
-python-check := pylint
-
-# python-check-args += --dry-run
-
-##-------------------##
-##---] TARGETS [---##
-##-------------------##
-ifndef NO-LINT-PYTHON
- lint : lint-python
-endif
-
-## -----------------------------------------------------------------------
-## Intent: Perform a lint check on makefile sources
-## -----------------------------------------------------------------------
-lint-python:
- $(HIDE)$(env-clean) $(python-check-find) \
- | $(xargs-n1) $(python-check) $(python-check-args)
-
-## -----------------------------------------------------------------------
-## Intent: Display command help
-## -----------------------------------------------------------------------
-help-summary ::
- @echo ' lint-python Syntax check python sources (*.py)'
-
-# [EOF]
diff --git a/makefiles/lint/python/find_utils.mk b/makefiles/lint/python/find_utils.mk
index ce4ad8c..15159bd 100644
--- a/makefiles/lint/python/find_utils.mk
+++ b/makefiles/lint/python/find_utils.mk
@@ -23,15 +23,6 @@
# -----------------------------------------------------------------------
## -----------------------------------------------------------------------
-## 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.
## -----------------------------------------------------------------------
@@ -41,8 +32,8 @@
gen-python-find-cmd = \
$(strip \
find . \
- \( $(call gen-python-find-excl,onf-excl-dirs) \) -prune \
- -o -name '*.py' \
+ $(foreach dir,$(onf-excl-dirs),-not -path './$(dir)/*') \
+ -a -name '*.py' \
-print0 \
)
diff --git a/makefiles/lint/python/flake8.mk b/makefiles/lint/python/flake8.mk
index 447906e..c297d94 100644
--- a/makefiles/lint/python/flake8.mk
+++ b/makefiles/lint/python/flake8.mk
@@ -55,9 +55,6 @@
$(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
## Note:
diff --git a/makefiles/lint/python/pylint.mk b/makefiles/lint/python/pylint.mk
index e83c2c1..2ed70e8 100644
--- a/makefiles/lint/python/pylint.mk
+++ b/makefiles/lint/python/pylint.mk
@@ -46,19 +46,11 @@
## -----------------------------------------------------------------------
## Intent: exhaustive pylint syntax checking
## -----------------------------------------------------------------------
-
-# 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) && $(call gen-python-find-cmd) | $(xargs-n1) pylint
-# | $(xargs-n1-clean) yamllint --strict
## -----------------------------------------------------------------------
## Intent: check deps for format and python3 cleanliness
diff --git a/makefiles/lint/shell/shellcheck.mk b/makefiles/lint/shell/shellcheck.mk
index 1bbb850..7d94998 100644
--- a/makefiles/lint/shell/shellcheck.mk
+++ b/makefiles/lint/shell/shellcheck.mk
@@ -29,8 +29,9 @@
# Gather sources to check
shell-check-find := find .
-shell-check-find += -name 'vendor' -prune
-shell-check-find += -o \( -name '*.sh' -o -name '*.bash' \)
+shell-check-find += $(foreach dir,$(onf-excl-dirs),-not -path './$(dir)/*')
+shell-check-find += -not -path './vendor/*'
+shell-check-find += -a \( -name '*.sh' -o -name '*.bash' \)
shell-check-find += -type f -print0
# shell-check := $(env-clean) shellcheck
diff --git a/makefiles/lint/yaml.mk b/makefiles/lint/yaml.mk
index 73f1c29..d49dd9a 100644
--- a/makefiles/lint/yaml.mk
+++ b/makefiles/lint/yaml.mk
@@ -30,6 +30,10 @@
have-yaml-files := $(if $(strip $(YAML_FILES)),true)
YAML_FILES ?= $(error YAML_FILES= is required)
+# Gather sources to check
+yaml-find-args := find .
+yaml-find-args += $(foreach dir,$(onf-excl-dirs),-not -path './$(dir)/*')
+
## -----------------------------------------------------------------------
## Intent: Use the yaml command to perform syntax checking.
## o If UNSTABLE=1 syntax check all sources
@@ -51,7 +55,7 @@
lint-yaml-all:
$(HIDE)$(MAKE) --no-print-directory lint-yaml-install
- find . \( -iname '*.yaml' -o -iname '*.yml' \) -print0 \
+ find . $(yaml-find-args) \( -iname '*.yaml' -o -iname '*.yml' \) -print0 \
| $(xargs-n1-clean) yamllint --strict
## -----------------------------------------------------------------------
diff --git a/makefiles/lint/yaml/include.mk b/makefiles/lint/yaml/include.mk
index 28fe608..7518d51 100644
--- a/makefiles/lint/yaml/include.mk
+++ b/makefiles/lint/yaml/include.mk
@@ -28,7 +28,7 @@
##---] INCLUDES [---##
##--------------------##
include $(ONF_MAKEDIR)/lint/yaml/help.mk
-include $(ONF_MAKEDIR)/lint/yaml/find_utils.mk
+# include $(ONF_MAKEDIR)/lint/yaml/find_utils.mk
include $(ONF_MAKEDIR)/lint/yaml/install.mk
# [TODO] Consolidate and refactor to support a simpler answer
diff --git a/makefiles/lint/yaml/yamllint.mk b/makefiles/lint/yaml/yamllint.mk
index ed0df2c..f8c2f7f 100644
--- a/makefiles/lint/yaml/yamllint.mk
+++ b/makefiles/lint/yaml/yamllint.mk
@@ -33,6 +33,11 @@
YAMLLINT = $(activate) && yamllint
yamllint-args += --strict
+yaml-find-args := $(null)
+yaml-find-args += $(foreach dir,$(onf-excl-dirs),-not -path './$(dir)/*')
+yaml-find-args += -a \( -iname '*.yaml' -o -iname '*.yml' \)
+yaml-find-args += -print0
+
## -----------------------------------------------------------------------
## Intent: Use the yaml command to perform syntax checking.
## -----------------------------------------------------------------------
@@ -49,7 +54,8 @@
$(call banner-enter,Target $@)
$(HIDE)$(MAKE) --no-print-directory lint-yaml-install
- $(HIDE)$(activate) && $(call gen-yaml-find-cmd) \
+
+ $(HIDE)$(activate) && find . $(yaml-find-args) \
| $(env-clean) $(xargs-cmd) -I'{}' \
bash -c "$(YAMLLINT) $(yamllint-args) {}"
$(call banner-leave,Target $@)
diff --git a/makefiles/main/tempdir/tempdir.mk b/makefiles/main/tempdir/tempdir.mk
index f854139..4d9c2c7 100644
--- a/makefiles/main/tempdir/tempdir.mk
+++ b/makefiles/main/tempdir/tempdir.mk
@@ -80,7 +80,7 @@
sterile ::
# Create a reference file to remove lingering stale directories
- $(HELP)touch --date "$(sterile-timestamp)" "$(lf-mk-tmp-create)-stale"
+ $(HIDE)touch --date "$(sterile-timestamp)" "$(lf-mk-tmp-create)-stale"
$(HIDE)find '$(dir $(lf-mk-tmp))' -maxdepth 1 -name 'repo-LF-make*' -type d -print0 \
| $(xargs-cmd0) -I'{}' find {} -name '.exists' -not -newer "$(lf-mk-tmp-create)-stale" -print0 \
diff --git a/makefiles/npm/README.md b/makefiles/npm/README.md
new file mode 100644
index 0000000..b907029
--- /dev/null
+++ b/makefiles/npm/README.md
@@ -0,0 +1,53 @@
+NVM / Node Package Manager
+==========================
+
+Makefiles beneath node-js/ maintain nvm and node package installs.
+
+Directories:
+
+- $(sandbox)/.tmp
+ - $(sandbox)/.tmp/.nvm
+ - $(sandbox)/.tmp/node_modules
+
+| Command | Description |
+| ------- | ----------- |
+| make npm-groovy-lint | Install the groovy linting tool |
+| make sterile | Remove .tmp/{.nvm, node_modules} |
+
+nvm/install.sh
+--------------
+
+Install script is downloaded from an external source so makefile targets
+at present are only intended for interactive use. Install script could
+be checked in and trusted packages proxied but a review of copyrights,
+etc need to happen first.
+
+Node Packages in use:
+---------------------
+
+- npm-groovy-lint
+
+<!---
+
+# -----------------------------------------------------------------------
+# Copyright 2024 Open Networking Foundation 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent:
+# -----------------------------------------------------------------------
+
+--->
diff --git a/makefiles/npm/consts.mk b/makefiles/npm/consts.mk
new file mode 100644
index 0000000..edf048c
--- /dev/null
+++ b/makefiles/npm/consts.mk
@@ -0,0 +1,48 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2024 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+nvm-dir-prefix := $(PWD)/.tmp
+# move to onf-mk-tmp
+
+# [DIRS]
+npm-dir-root := $(nvm-dir-prefix)/.nvm
+node-modules-root := $(nvm-dir-prefix)/node_modules
+
+export NVM_DIR := $(npm-dir-root)
+nvm-sh := $(npm-dir-root)/nvm.sh
+
+# Do not quote path
+activate-npm := source $(nvm-sh)
+
+export NODE_PATH := $(node-modules-root)
+
+
+# npm-install-cmd := npm install --no-package-lock --prefix "$(nvm-dir-prefix)"
+npm-install-cmd := npm install --prefix $(nvm-dir-prefix)
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/npm/help.mk b/makefiles/npm/help.mk
new file mode 100644
index 0000000..aa56799
--- /dev/null
+++ b/makefiles/npm/help.mk
@@ -0,0 +1,30 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2024 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+npm-help :
+ @$(MAKE) --no-print-directory nvm-help node-help
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/npm/include.mk b/makefiles/npm/include.mk
new file mode 100644
index 0000000..347e837
--- /dev/null
+++ b/makefiles/npm/include.mk
@@ -0,0 +1,32 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2024 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+include $(onf-mk-dir)/npm/consts.mk
+
+include $(onf-mk-dir)/npm/nvm.mk
+include $(onf-mk-dir)/npm/npm.mk
+
+include $(onf-mk-dir)/npm/node.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/npm/node.mk b/makefiles/npm/node.mk
new file mode 100644
index 0000000..4a509eb
--- /dev/null
+++ b/makefiles/npm/node.mk
@@ -0,0 +1,37 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2024 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+nvm-node-help :
+ @$(activate-npm) && node --help
+
+nvm-node:
+ @$(activate-npm) && which node
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+node-help :
+ @printf ' %-33.33s %s\n' 'nvm-node-help' 'Display node help text'
+ @printf ' %-33.33s %s\n' 'nvm-node' 'Display node command path'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/npm/npm.mk b/makefiles/npm/npm.mk
new file mode 100644
index 0000000..6e18166
--- /dev/null
+++ b/makefiles/npm/npm.mk
@@ -0,0 +1,75 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2024 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Intent: Helper method, return path to an installed node package command
+## -----------------------------------------------------------------------
+node-get-tool-path = $(node-modules-root)/.bin/$(1)
+
+## -----------------------------------------------------------------------
+## Intent: Define a user function template that will dynamically
+## generate makfile targets and dependencies used to install
+## npm/node/node-js pacakges.
+## -----------------------------------------------------------------------
+## - Dependency driven so packages are only installed when needed.
+## - Define package name as a target so it can be used as a makefile dependency
+## [makefile] install : npm-groovy-lint
+## % make install -- install tool npm-groovy-lint
+## -----------------------------------------------------------------------
+define npm-install-tmpl
+
+# npm-groovy-lint : $(npm-groovy-lint)
+$(1) : $(node-modules-root)/.bin/$(1)
+
+# bin/npm-groovy-lint : NODE_DIR/nvm.sh
+$(node-modules-root)/.bin/$(1) : $(nvm-sh)
+$(tab)$(activate-npm) && $(npm-install-cmd) "$(1)"
+$(tab)$(activate-npm) && "$(node-modules-root)/.bin/$(1)" --version
+endef
+
+## -----------------------------------------------------------------------
+## Intent: Front end for making a parametierzed template call.
+## - create named local vars.
+## - [debug] display target rule generated.
+## - use $(eval) to create an installer target.
+## -----------------------------------------------------------------------
+## Usage: $(call gen-npm-install,npm-groovy-lint)
+## -----------------------------------------------------------------------
+gen-npm-install=\
+ $(foreach package,$(1),\
+ $(if $(DEBUG),$(info ** $(eval $(call npm-install-tmpl,$(package)))))\
+ $(eval $(call npm-install-tmpl,$(package)))\
+)
+
+## -----------------------------------------------------------------------
+## Intent: Map function used to install a list of node modules
+## -----------------------------------------------------------------------
+## Usage:
+## packages += npm-groovy-lint
+## packages += another-npm-package
+## $(call gen-npm-installs,packages)
+## -----------------------------------------------------------------------
+gen-npm-installs = $(forach pkg,$($(1)),$(call gen-npm-install,$(pkg)))
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/npm/nvm.mk b/makefiles/npm/nvm.mk
new file mode 100644
index 0000000..0b72fd7
--- /dev/null
+++ b/makefiles/npm/nvm.mk
@@ -0,0 +1,75 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2024 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+nvm-install-sh := https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh
+
+## -----------------------------------------------------------------------
+## Intent: Install the npm pacakge manager
+## -----------------------------------------------------------------------
+nvm-install : $(nvm-sh)
+$(nvm-sh) :
+ $(HIDE)mkdir -p "$(npm-dir-root)"
+ $(HIDE)mkdir -p "$(node-modules-root)"
+
+ @echo
+ @echo "Retrieve $(nvm-install-sh)"
+ $(if $(NVM_DIR),$(null),$(error NVM_DIR= is required))#
+ curl -o- "$(nvm-install-sh)" | bash
+
+ @echo
+ @echo "Install nvm --lts"
+ $(activate-npm) && nvm install --lts
+# $(activate-npm) && nvm ls-remote
+
+ @echo
+ @echo "Install debug module"
+ $(activate-npm) && $(npm-install-cmd) debug --save
+
+## -----------------------------------------------------------------------
+## Intent: Display command version: nvm, node
+## -----------------------------------------------------------------------
+nvm-ver : nvm-install
+ $(activate-npm) && nvm --version
+ $(activate-npm) && node --version
+
+## -----------------------------------------------------------------------
+## Intent: Remove generated tool and package directories
+## -----------------------------------------------------------------------
+sterile ::
+ $(RM) -r "$(npm-dir-root)"
+ $(RM) -r "$(node-modules-root)"
+ $(RM) "$(npm-dir-root)/package.json"
+ $(RM) "$(npm-dir-root)/package-lock.json"
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+nvm-help :
+ @printf ' %-33.33s %s\n' 'nvm-install' 'Install the nvm package manager'
+ @printf ' %-33.33s %s\n' 'nvm-ver' 'Display tool version: nvm, node'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]