VOL-4977 Failure in voltha-protos verification job.
Makefile
makefiles/consts.mk
makefiles/virtualenv.mk
-----------------------
o Update to use library makefile virtualenv.mk to create .venv
and remove by clean/sterile target.
o Construct commands using '&&' -vs- ';' to better detect errors.
o pip install packages relocated into the requirements.txt file.
o Separate extra deps from target rule since they are never
processed by the target rule.
o Added banners for readabilty.
makefiles/lint/golang/sca.mk
makefiles/lint/golang/include.mk
--------------------------------
o lint target for golang sources.
Tested with python v3.10 (localhost) and v2.7 (docker container).
Debug to see if hangs are dependent on the patch reported in vol-4977.
Change-Id: I0783f6fb347bf2cd15350f9e17fc19695343b7ac
diff --git a/Makefile b/Makefile
index 688a925..b8dae50 100755
--- a/Makefile
+++ b/Makefile
@@ -76,6 +76,15 @@
# Force pb file to be regenrated every time. Otherwise the make process assumes generated version is still valid
.PHONY: voltha.pb
+##----------------##
+##---] DEPS [---##
+##----------------##
+infra-deps := $(null)
+infra-deps += Makefile
+infra-deps += $(venv-activate-script)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
print:
@echo "Proto files: $(PROTO_FILES)"
@echo "Python PB2 files: $(PROTO_PYTHON_PB2)"
@@ -94,8 +103,10 @@
sterile :: clean
$(RM) -r java_temp
-# Python targets
-python-protos: $(PROTO_PYTHON_PB2)
+## -----------------------------------------------------------------------
+## Python targets
+## -----------------------------------------------------------------------
+python-protos: $(infra-deps) $(PROTO_PYTHON_PB2)
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
@@ -255,7 +266,7 @@
java-protos-dirs += java_temp/src/main/java/org/opencord/voltha/adapter_service
mkdir-args += -vp
-# mkdir-args += --mode=0777
+# mkdir-args += --mode=0777# # Only a problem for local docker builds
java-protos: voltha.pb
diff --git a/VERSION b/VERSION
index 426c1c1..8ce222e 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5.4.4
+5.4.5
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..60d264a
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,32 @@
+# -*- 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.
+# -----------------------------------------------------------------------
+
+##--------------------------------##
+##---] Disable lint targets [---##
+##--------------------------------##
+NO-LINT-DOC8 := true
+# NO-LINT-GOLANG := true
+NO-LINT-GROOVY := true
+NO-LINT-JJB := true
+NO-LINT-JSON := true
+# NO-LINT-MAKE := false
+NO-LINT-PYTHON := true
+NO-LINT-ROBOT := true
+# NO-LINT-SHELL := true
+NO-LINT-YAML := true
+
+# [EOF]
diff --git a/makefiles/include.mk b/makefiles/include.mk
index 2ce93de..43c894f 100644
--- a/makefiles/include.mk
+++ b/makefiles/include.mk
@@ -39,10 +39,10 @@
include $(MAKEDIR)/virtualenv.mk
include $(MAKEDIR)/help/variables.mk
+include $(MAKEDIR)/lint/include.mk
include $(MAKEDIR)/todo.mk
include $(MAKEDIR)/docker/include.mk
-include $(MAKEDIR)/lint/include.mk
$(if $(DEBUG),$(warning LEAVE))
diff --git a/makefiles/lint/golang/include.mk b/makefiles/lint/golang/include.mk
new file mode 100644
index 0000000..5289a39
--- /dev/null
+++ b/makefiles/lint/golang/include.mk
@@ -0,0 +1,33 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 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.
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
+help::
+ @echo ' lint-golang Syntax check golang sources'
+ @echo ' FIX=1 In-place file update'
+
+include $(MAKEDIR)/lint/golang/sca.mk
+
+# [EOF]
diff --git a/makefiles/lint/golang/sca.mk b/makefiles/lint/golang/sca.mk
index eeecc42..20af593 100644
--- a/makefiles/lint/golang/sca.mk
+++ b/makefiles/lint/golang/sca.mk
@@ -17,12 +17,32 @@
$(if $(DEBUG),$(warning ENTER))
-GOLANG_FILES ?= $(error PYTHON_FILES= is required)
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-golang lint-golang-sca-all lint-golang-sca-modified
-.PHONY: lint-golang-sca
+GOLANG_FILES ?= $(error GOLANG_FILES= is required)
-lint : lint-golang-sca
+$(info loading)
+## -----------------------------------------------------------------------
+## Intent: Use the golang command to perform syntax checking.
+## o If UNSTABLE=1 syntax check all sources
+## o else only check sources modified by the developer.
+## Usage:
+## % make lint UNSTABLE=1
+## % make lint-golang-all
+## -----------------------------------------------------------------------
+ifndef NO-LINT-GOLANG
+ lint-golang-mode := $(if $(have-golang-files),modified,all)
+ lint : lint-golang-sca-$(lint-golang-mode)
+ lint-golang-all : lint-golang-sca-all
+ lint-golang-modified : lint-golang-sca-modified
+endif# NO-LINT-GOLANG
+
+## -----------------------------------------------------------------------
+## Intent: exhaustive golint syntax checking
## -----------------------------------------------------------------------
## Intent: Run goformat on files on sandbox files.
## 1) find . -name '*.go' -print0
@@ -47,13 +67,47 @@
lint-golang-sca-args += -w
endif
-lint-golang-sca:
- find . -name '*.go' -print0 \
- | xargs $(lint-golang-sca-xargs) gofmt -d -s
+gofmt-args += -d# Do not output reformatted lines
+# gofmt-args += -e# Display all errors (including spurious)
+gofmt-args += -s# Try to simplify code
-help::
- @echo " lint-golang-sca Syntax check golang sources"
- @echo " MODIFIER: FIX=1 Correct problems (gofmt -d -s -w)"
+## -----------------------------------------------------------------------
+## Intent: exhaustive golang syntax checking
+## -----------------------------------------------------------------------
+lint-golang-sca-all: $(venv-activate-script)
+# $(MAKE) --no-print-directory lint-sca-install
+
+ find . -name '*.go' -print0 \
+ | xargs $(lint-golang-sca-xargs) gofmt $(gofmt-args)
+
+## -----------------------------------------------------------------------
+## Intent: check deps for format and cleanliness
+## -----------------------------------------------------------------------
+lint-golang-sca-modified: lint-golang-all
+# $(MAKE) --no-print-directory lint-golang-sca-install
+
+ gofmt $(gofmt-args) $(GOLANG_FILES)
+
+## -----------------------------------------------------------------------
+## Intent: Tool installation as needed
+## -----------------------------------------------------------------------
+.PHONY: lint-golang-sca-install
+lint-golang-sca-install:
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** golang syntax checking"
+ @echo "** -----------------------------------------------------------------------"
+ @echo
+
+## -----------------------------------------------------------------------
+## Intent: Display target help
+## -----------------------------------------------------------------------
+.PHONY: help-golang-sca
+help-verbose += help-golang-sca
+help-golang-sca :
+ @echo " % $(MAKE) lint-golang GOLANG_FILES=..."
+ @echo ' lint-golang-sca-modified golang checking: only modified'
+ @echo ' lint-golang-sca-all golang checking: exhaustive'
$(if $(DEBUG),$(warning LEAVE))
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
index 32beda2..3048679 100644
--- a/makefiles/lint/include.mk
+++ b/makefiles/lint/include.mk
@@ -21,6 +21,7 @@
ONF_MAKE := $(MAKEDIR)
+include $(ONF_MAKE)/lint/golang/include.mk
include $(ONF_MAKE)/lint/json.mk
include $(ONF_MAKE)/lint/makefile.mk
include $(ONF_MAKE)/lint/python.mk