VOL-4977 - Failure in voltha-protos verification job.

Makefile
makefiles/consts.mk
makefiles/include.mk
virtualenv.mk
requirements.txt
--------------------
  o Added library makefiles from repo:onf-make to handle virtualenv setup/removal.
  o go-clean - augment clean rule, current behavior leaves directory unbuildable.

makefiles/docker/include.mk
---------------------------
  o Replace inlined copies of docker cli arguments with macros: is-stdin, docker-run, etc.
  o Moved docker command wrappers: PROTOC, etc into docker/include.mk

makefiles/help/*.mk
-------------------
  o Update and align makefile target help text.

Change-Id: Ifcf72e8081efc6e0d828ee4b1b96c66a219a39b9
diff --git a/Makefile b/Makefile
index cb7a8cd..09c2531 100755
--- a/Makefile
+++ b/Makefile
@@ -24,10 +24,14 @@
 TOP         ?= .
 MAKEDIR     ?= $(TOP)/makefiles
 
-export SHELL := bash -e -o pipefail
-
 $(if $(VERBOSE),$(eval export VERBOSE=$(VERBOSE))) # visible to include(s)
 
+##--------------------------
+## Enable setup.py debugging
+##--------------------------
+# https://docs.python.org/3/distutils/setupscript.html#debugging-the-setup-script
+export DISTUTILS_DEBUG := 1
+
 # Makefile for voltha-protos
 default: test
 
@@ -40,13 +44,6 @@
 ##--------------------##
 include $(MAKEDIR)/include.mk
 
-# tool containers
-VOLTHA_TOOLS_VERSION ?= 2.4.0
-
-PROTOC    = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app $(shell test -t 0 && echo "-it") voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-protoc protoc
-PROTOC_SH = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/go/src/github.com/opencord/voltha-protos/v5 $(shell test -t 0 && echo "-it") --workdir=/go/src/github.com/opencord/voltha-protos/v5 voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-protoc sh -c
-GO        = docker run --rm --user $$(id -u):$$(id -g) -v ${CURDIR}:/app $(shell test -t 0 && echo "-it") -v gocache:/.cache -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}-golang go
-
 # Function to extract the last path component from go_package line in .proto files
 define go_package_path
 $(shell grep go_package $(1) | sed -n 's/.*\/\(.*\)";/\1/p')
@@ -67,6 +64,7 @@
 PROTO_GO_PB:= $(foreach f, $(PROTO_FILES), $(patsubst protos/voltha_protos/%.proto,$(PROTO_GO_DEST_DIR)/$(call go_package_path,$(f))/%.pb.go,$(f)))
 PROTO_JAVA_DEST_DIR := java
 PROTO_JAVA_PB := $(foreach f, $(PROTO_FILES), $(patsubst protos/voltha_protos/%.proto,$(PROTO_JAVA_DEST_DIR)/$(call java_package_path,$(f))/%.pb.java,$(f))) 
+
 # Force pb file to be regenrated every time.  Otherwise the make process assumes generated version is still valid
 .PHONY: voltha.pb
 
@@ -83,22 +81,21 @@
 
 test: python-test go-test java-test
 
-clean: python-clean java-clean go-clean
+clean :: python-clean java-clean go-clean
 
-sterile: clean
-	$(RM) -r venv_protos
+sterile :: clean
 
 # 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 \
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+$(PROTO_PYTHON_DEST_DIR)/%_pb2.py: \
+  protos/voltha_protos/%.proto \
+  Makefile \
+  $(venv-activate-script)
+	$(activate) \
+	&& python -m grpc_tools.protoc \
     -I protos \
     --python_out=python \
     --grpc_python_out=python \
@@ -128,28 +125,43 @@
     python/__pycache__ \
     python/test/__pycache__ \
     python/voltha_protos.egg-info \
-    venv_protos \
+    "$(venv-abs-path)" \
     $(PROTO_PYTHON_DEST_DIR)/*.desc \
     $(PROTO_PYTHON_PB2) \
     $(PROTO_PYTHON_PB2_GRPC)
 
-# Why are we removing files under revision control ?
+## -----------------------------------------------------------------------
+## Intent: Revert go to a clean state.
+##   o TODO - go/ directory should not be placed under revision control.
+##   o Build should retrieve versioned sources from a central repo.
+## -----------------------------------------------------------------------
 go-clean:
 	$(RM) -r go/*
+	$(HIDE)$(MAKE) repair
+
+## -----------------------------------------------------------------------
+## Intent: Recover from a fatal failed build state:
+##   o build removes go/ while regenerating prototypes.
+##   o chicken-n-egg: make becomes fatal when go/ is removed and proten fails.
+## -----------------------------------------------------------------------
+repair:
+	/usr/bin/env git checkout go
+
 
 # Go targets
 go-protos: voltha.pb
 	@echo "Creating *.go.pb files"
-	@${PROTOC_SH} " \
+	@echo "PROTO_FILES=$(PROTO_FILES)" | tr ' ' '\n'
+	${PROTOC_SH} $(quote-double)\
 	  set -e -o pipefail; \
 	  for x in ${PROTO_FILES}; do \
 	    echo \$$x; \
 	    protoc --go_out=plugins=grpc:/go/src -I protos \$$x; \
-	  done"
+	  done$(quote-double)
 
 voltha.pb:
 	@echo "Creating $@"
-	@${PROTOC} -I protos -I protos/google/api \
+	$(HIDE)${PROTOC} -I protos -I protos/google/api \
 	  --include_imports --include_source_info \
 	  --descriptor_set_out=$@ \
 	  ${PROTO_FILES}
@@ -162,12 +174,12 @@
 java-protos: voltha.pb
 	@echo "Creating java files"
 	@mkdir -p java_temp/src/main/java
-	@${PROTOC_SH} " \
+	@${PROTOC_SH} $(quote-double) \
 	  set -e -o pipefail; \
 	  for x in ${PROTO_FILES}; do \
 	    echo \$$x; \
 	    protoc --java_out=java_temp/src/main/java -I protos \$$x; \
-	  done"
+	  done$(quote-double)
         #TODO: generate directly to the final location
 	@mkdir -p java
 	cp -r java_temp/src/main/java/* java/