[VOL-5000] VOL-5001 - edits for debugging voltha-prototype problems.
Makefile
--------
o Disable DISTUTILS_DEBUG, only needed when tracing pip install failure.
o Added comments and minor cleanups.
o Added enter/leave banners for targets.
o Display PROTO_FILES macro to see where the bash -c syntax error problem originated.
o ls /go/src and java_temp/ to show permissions (local docker issue).
o Sterile target updated to remove java_temp and addeed
mkdir helper logic to continue building locally.
tox.ini
-------
o Community reported people are no longer using python protos so
begin cleanup by removing old interpreters.
Change-Id: Ia7ae20bb409c9ccfdc2e87fb07491a143eae56da
diff --git a/Makefile b/Makefile
index b7673e0..56f1317 100755
--- a/Makefile
+++ b/Makefile
@@ -30,8 +30,8 @@
## Enable setup.py debugging
##--------------------------
# https://docs.python.org/3/distutils/setupscript.html#debugging-the-setup-script
-export DISTUTILS_DEBUG := 1
-export DOCKER_DEBUG := 1
+# export DISTUTILS_DEBUG := 1 # verbose: pip
+export DOCKER_DEBUG := 1 # verbose: docker
# Makefile for voltha-protos
default: test
@@ -51,6 +51,7 @@
endef
# Function to extract the last path component from package line in .proto files
+# protos/voltha_protos/common.proto => common
define java_package_path
$(shell grep package $(1) | sed -n 's/.*\/\(.*\)";/\1/p')
endef
@@ -85,10 +86,14 @@
clean :: python-clean java-clean go-clean
sterile :: clean
+ $(RM) -r java_temp
# Python targets
python-protos: $(PROTO_PYTHON_PB2)
+show-pb2:
+ @echo $(PROTO_PYTHON_PB2) | tr ' ' '\n'
+
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
$(PROTO_PYTHON_DEST_DIR)/%_pb2.py: \
@@ -191,21 +196,28 @@
@echo "** Creating *.go.pb files"
@echo "** -----------------------------------------------------------------------"
- @echo
- @echo "PROTO_FILES=$(PROTO_FILES)" | tr ' ' '\n'
+ $(docker-sh) $(quote-double) /bin/ls -ld /go/src $(quote-double)
- @echo
+ ${PROTOC_SH} $(quote-double) \
+ find /go/src -print0 | xargs -0 /bin/ls -ld \
+ $(quote-double)
+
+ $(call banner-enter,target $@)
+
${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$(quote-double)
+ done\
+ $(quote-double)
+
+ $(call banner-leave,target $@)
## -----------------------------------------------------------------------
## Intent:
-## -----------------------------------------------------------------------
-voltha.pb:
+## ----------------------------------------------------------------------
+voltha.pb: show-proto-files
$(call banner-enter,target $@)
${PROTOC} \
@@ -232,16 +244,32 @@
## -----------------------------------------------------------------------
## Intent: Java targets
## -----------------------------------------------------------------------
+
+java-protos-dirs += java_temp/src/main/java
+java-protos-dirs += java_temp/src/main/java/org
+# local docker problem
+java-protos-dirs += java_temp/src/main/java/org/opencord/voltha/adapter
+java-protos-dirs += java_temp/src/main/java/org/opencord/voltha/adapter_service
+
+mkdir-args += -vp
+mkdir-args += --mode=0777
+
java-protos: voltha.pb
+
$(call banner-enter,target $@)
- @mkdir -p java_temp/src/main/java
+# $(RM) -fr java_temp
+ mkdir $(mkdir-args) $(java-protos-dirs)
+ $(docker-sh) $(quote-double) find $(java-protos-dirs) -print0 \
+ | xargs -0 -n1 /bin/ls -ld $(quote-double)
+
@${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$(quote-double)
+ done\
+ $(quote-double)
# Move files into place after all prototypes have generated.
# TODO: Remove the extra step, use makefile deps and
@@ -265,7 +293,17 @@
$(RM) -r java
$(RM) -r java_temp
-# placeholder for library targets
+## -----------------------------------------------------------------------
+## Intent: Placeholder for library targets
+## -----------------------------------------------------------------------
lint :
+## -----------------------------------------------------------------------
+## Intent: Display/debug targets
+## -----------------------------------------------------------------------
+.PHONY: show-proto-files
+show-proto-files:
+ echo -e "PROTO_FILES:\n$(PROTO_FILES)" | tr ' ' '\n'
+
# [EOF]
+
diff --git a/makefiles/docker/include.mk b/makefiles/docker/include.mk
index 3ed7d08..254e07c 100644
--- a/makefiles/docker/include.mk
+++ b/makefiles/docker/include.mk
@@ -29,7 +29,6 @@
## GhostBusters: Cross the streams
## Always pass -it to attach streams, jenkins + docker == test -t fail
-# is-stdin = $(shell test -t 0 && { echo "-it" } || {echo '--tty'})# # Attach streams if interactive
is-stdin = $(shell test -t 0 && { echo '--interactive' })# # Attach streams if interactive
is-stdin += --tty# # Attach stdout else jenkins::docker is silent
@@ -42,6 +41,8 @@
PROTOC_SH = $(docker-run) -v ${CURDIR}:/go/src/github.com/opencord/voltha-protos/v5 $(is-stdin) --workdir=/go/src/github.com/opencord/voltha-protos/v5 $(vee-citools)-protoc sh -c
GO = $(docker-run) -v ${CURDIR}:/app $(is-stdin) -v gocache:/.cache $(vee-golang) $(vee-citools)-golang go
+docker-sh = $(PROTOC_SH)
+
$(if $(DEBUG),$(warning LEAVE))
# [EOF]
diff --git a/tox.ini b/tox.ini
index df5e505..0b77d1f 100755
--- a/tox.ini
+++ b/tox.ini
@@ -13,7 +13,7 @@
; limitations under the License.
[tox]
-envlist = py27,py35,py36,py37,py38,3.9,3.10.6
+envlist = py36,py37,3.10.6
skip_missing_interpreters = true
[testenv]