VOL-4836: VOLTHA release prep.
Makefile
--------
o Update copyright notice.
o include a few library makefiles for displaying help, etc.
o Added target sterile to make clean + remove venv.
o Replace inlined rm -fr, rm -f with make builtin $(RM) && $(RM) -r
tox.ini
-------
o Add more interpreter versions to envlist so python 3.10.x can be used.
Change-Id: Ideb7e30ff703dff18b707226a4821455f5b1f261
diff --git a/makefiles/consts.mk b/makefiles/consts.mk
index c96cb88..043ec65 100644
--- a/makefiles/consts.mk
+++ b/makefiles/consts.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 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");
# you may not use this file except in compliance with the License.
@@ -13,18 +13,16 @@
# 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
# -----------------------------------------------------------------------
-null :=#
-space := $(null) $(null)
-dot ?= .
+null :=#
+space :=$(null) $(null)
+dot :=.
+HIDE ?=@
-HIDE ?= @
-SHELL := bash -e -o pipefail
-
-env-clean = /usr/bin/env --ignore-environment
+# use bash for pusdh/popd and quick failures.
+# virtual env(s) activate has undefined vars so no -u
+# ^---+ verify this is still true
+export SHELL := bash -e -o pipefail
# [EOF]
diff --git a/makefiles/help/include.mk b/makefiles/help/include.mk
index f8200a7..a3a1320 100644
--- a/makefiles/help/include.mk
+++ b/makefiles/help/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2017-2022 Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,9 +15,32 @@
# limitations under the License.
# -----------------------------------------------------------------------
-include $(MAKEDIR)/help/go.mk
-include $(MAKEDIR)/help/python.mk
-include $(MAKEDIR)/help/java.mk
-include $(MAKEDIR)/help/clean.mk
+# Parent makefile should include this early so help
+# message will be prefixed by a usage statement.
+help ::
+ @echo "Usage: $(MAKE) [options] [target] ..."
+ @echo
+ @echo '[Virtual Env]'
+ @echo ' venv Create a python virtual environment'
+ @echo ' venv_protos Create a python virtual environment'
+ @echo " $(VENV_NAME)"
+ @echo
+ @echo '[ACTION] - golang, java and python'
+ @echo ' protos'
+ @echo ' build'
+ @echo ' test'
+ @echo
+ @echo '[CLEAN]'
+ @echo ' clean Remove generated targets'
+ @echo ' sterile clean + remove virtual env interpreter install'
+ @echo
+ @echo '[HELP]'
+ @echo ' help Display program help'
+# @echo ' help-verbose Display additional targets and help'
+ @echo
+ @echo '[PROTOS: generate]'
+ @echo ' go-protos'
+ @echo ' java-protos'
+ @echo ' python-protos'
# [EOF]
diff --git a/makefiles/help/variables.mk b/makefiles/help/variables.mk
new file mode 100644
index 0000000..a50b233
--- /dev/null
+++ b/makefiles/help/variables.mk
@@ -0,0 +1,36 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2022 Open Networking Foundation
+#
+# 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.
+# -----------------------------------------------------------------------
+
+# Include variables.mk after library makefiles have been included
+
+ifdef VERBOSE
+ help :: help-variables
+else
+ help ::
+ @echo
+ @echo '[VARIABLES] - Conditional makefile behavior'
+ @echo ' see also: help-variables'
+endif
+
+help-variables:
+ @echo
+ @echo '[VARIABLES] - Conditional makefile behavior'
+ @echo ' NO_PATCHES= Do not apply patches to the python virtualenv'
+ @echo ' NO_OTHER_REPO_DOCS= No foreign repos, only apply target to local sources.'
+ @echo ' VERBOSE= Display extended help'
+
+# [EOF]
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
index b8a1b88..979a6fb 100644
--- a/makefiles/lint/include.mk
+++ b/makefiles/lint/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2017-2023 Open Networking Foundation
+# Copyright 2017-2022 Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,18 +18,11 @@
help::
@echo
@echo "[LINT]"
- @echo " lint Static code analysis/syntax checking"
- @echo " LOCAL_LINT=1 Enable local linting w/o docker & jenkins overhead"
-ifdef LOCAL_LINT
- # include $(MAKEDIR)/lint/json.mk # venv dependency
- include $(MAKEDIR)/lint/golang/sca.mk
- include $(MAKEDIR)/lint/license/include.mk # exclusions needed
- # include $(MAKEDIR)/lint/python.mk
- # include $(MAKEDIR)/lint/robot.mk # venv dependency
- # include $(MAKEDIR)/lint/yaml.mk # venv needed -- alt: yamllint
-endif
-
-include $(MAKEDIR)/lint/shell.mk # cleanup needed
+include $(MAKEDIR)/lint/json.mk
+include $(MAKEDIR)/lint/python.mk
+include $(MAKEDIR)/lint/robot.mk
+include $(MAKEDIR)/lint/shell.mk
+include $(MAKEDIR)/lint/yaml.mk
# [EOF]
diff --git a/makefiles/lint/json.mk b/makefiles/lint/json.mk
index cc9ecfa..0a11c71 100644
--- a/makefiles/lint/json.mk
+++ b/makefiles/lint/json.mk
@@ -15,7 +15,7 @@
# limitations under the License.
# -----------------------------------------------------------------------
-JSON_FILES ?= $(error JSON_FILES= is required)
+JSON_FILES ?= $(error JSON_FILES= is rqeuired)
.PHONY: lint-json
diff --git a/makefiles/lint/license/include.mk b/makefiles/lint/license/include.mk
index aaf6e47..538a415 100644
--- a/makefiles/lint/license/include.mk
+++ b/makefiles/lint/license/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2022 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.
diff --git a/makefiles/lint/license/license-check.sh b/makefiles/lint/license/license-check.sh
index 10d3376..bbf560e 100755
--- a/makefiles/lint/license/license-check.sh
+++ b/makefiles/lint/license/license-check.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------
-# Copyright 2022 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.
diff --git a/makefiles/lint/license/license-helper.sh b/makefiles/lint/license/license-helper.sh
index 499f854..0f690e4 100755
--- a/makefiles/lint/license/license-helper.sh
+++ b/makefiles/lint/license/license-helper.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# -----------------------------------------------------------------------
-# Copyright 2022 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.
diff --git a/makefiles/lint/python.mk b/makefiles/lint/python.mk
index 86503a7..5aecd58 100644
--- a/makefiles/lint/python.mk
+++ b/makefiles/lint/python.mk
@@ -21,11 +21,12 @@
lint : lint-python
+# check deps for format and python3 cleanliness
lint-python: vst_venv
- -source ./$</bin/activate \
- && set -u \
- && pylint $(PYTHON_FILES) \
- && flake8 --max-line-length=99 --count $(PYTHON_FILES)
+ source ./$</bin/activate \
+ ; set -u \
+ ; pylint --py3k $(PYTHON_FILES) \
+ ; flake8 --max-line-length=99 --count $(PYTHON_FILES)
help::
@echo " lint-python Syntax check using pylint and flake8"
diff --git a/makefiles/lint/robot.mk b/makefiles/lint/robot.mk
index 9808602..ec5579e 100644
--- a/makefiles/lint/robot.mk
+++ b/makefiles/lint/robot.mk
@@ -32,8 +32,8 @@
lint-robot: vst_venv
source ./$</bin/activate \
- && set -u \
- && rflint $(LINT_ARGS) $(ROBOT_FILES)
+ ; set -u \
+ ; rflint $(LINT_ARGS) $(ROBOT_FILES)
help::
@echo " lint-robot Syntax check robot sources using rflint"
diff --git a/makefiles/lint/shell.mk b/makefiles/lint/shell.mk
index 9f8cd58..da92921 100644
--- a/makefiles/lint/shell.mk
+++ b/makefiles/lint/shell.mk
@@ -23,7 +23,7 @@
lint-shell:
shellcheck --version
- find . \( -name 'staging' -o -name 'vst_venv' -o -name 'vendor' \) -prune \
+ find . \( -name 'staging' -o -name 'vst_venv' \) -prune \
-o -name '*.sh' ! -name 'activate.sh' -print0 \
| xargs -0 -n1 shellcheck