[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]
+