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/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]