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/Makefile b/Makefile
index 89df9ae..70b26ae 100755
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2019-2022 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.
@@ -15,8 +15,6 @@
# limitations under the License.
# -----------------------------------------------------------------------
-$(if $(DEBUG),$(warning ENTER))
-
.DEFAULT_GOAL := test
TOP ?= .
@@ -24,13 +22,15 @@
$(if $(VERBOSE),$(eval export VERBOSE=$(VERBOSE))) # visible to include(s)
+# Makefile for voltha-protos
+default: test
+
##--------------------##
##---] INCLUDES [---##
##--------------------##
-include $(MAKEDIR)/include.mk
-
-# Makefile for voltha-protos
-default: test
+include $(MAKEDIR)/consts.mk
+include $(MAKEDIR)/help/include.mk
+include $(MAKEDIR)/help/variables.mk
# tool containers
VOLTHA_TOOLS_VERSION ?= 2.4.0
@@ -75,27 +75,19 @@
test: python-test go-test java-test
-## -----------------------------------------------------------------------
-## Process[-all] language targets
-## -----------------------------------------------------------------------
-go-all : go-clean go-protos go-test
-java-all : java-clean java-protos java-test
-python-all : python-clean python-protos python-build python-test
+clean: python-clean java-clean go-clean
-## -----------------------------------------------------------------------
+sterile: clean
+ $(RM) -r venv_protos
+
# Python targets
-## -----------------------------------------------------------------------
python-protos: $(PROTO_PYTHON_PB2)
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
venv_protos:
virtualenv -p python3 $@;\
source ./$@/bin/activate ; set -u ;\
pip install grpcio==1.39.0 protobuf==3.17.3 grpcio-tools==1.39.0 googleapis-common-protos==1.52.0
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
$(PROTO_PYTHON_DEST_DIR)/%_pb2.py: protos/voltha_protos/%.proto Makefile venv_protos
source ./venv_protos/bin/activate ; set -u ;\
python -m grpc_tools.protoc \
@@ -115,8 +107,10 @@
tox
python-clean:
- find python/ -name '*.pyc' \
- | xargs --no-run-if-empty $(RM)
+# find python -name '__pycache__' -type d -print0 \
+# | xargs -0 --no-run-if-empty $(RM) -r
+ find python -name '*.pyc' -type f -print0 \
+ | xargs -0 --no-run-if-empty $(RM)
$(RM) -r \
.coverage \
.tox \
@@ -131,6 +125,7 @@
$(PROTO_PYTHON_PB2) \
$(PROTO_PYTHON_PB2_GRPC)
+# Why are we removing files under revision control ?
go-clean:
$(RM) -r go/*
@@ -178,15 +173,4 @@
$(RM) -r java
$(RM) -r java_temp
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-clean: python-clean java-clean go-clean
-
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-sterile : clean
- $(RM) -r venv_protos
-
-$(if $(DEBUG),$(warning LEAVE))
-
# [EOF]
diff --git a/VERSION b/VERSION
index 025c1ae..57f3eee 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5.3.7
+5.3.7-dev1
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
diff --git a/tox.ini b/tox.ini
index 92ae862..4bfe954 100755
--- a/tox.ini
+++ b/tox.ini
@@ -1,4 +1,4 @@
-; Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors
+; Copyright 2019-present 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.
@@ -13,7 +13,7 @@
; limitations under the License.
[tox]
-envlist = py27,py35,py36,py37,py38,3.10.6
+envlist = py27,py35,py36,py37,py38,3.9,3.10.6
skip_missing_interpreters = true
[testenv]