Remove unneeded items from Makefile
Remove env sourcing as a requirement.
Also fix base image naming bug.
Change-Id: I7e62b47853562015e7731ea199eb24d80976f065
diff --git a/python/Makefile b/python/Makefile
index 7ea572e..3ac6936 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -14,12 +14,6 @@
# limitations under the License.
#
-ifneq ($(VOLTHA_BUILD),docker)
-ifeq ($(VOLTHA_BASE)_set,_set)
-$(error To get started, please source the env.sh file)
-endif
-endif
-
ifeq ($(TAG),)
TAG := latest
endif
@@ -28,12 +22,6 @@
TARGET_TAG := latest
endif
-# If no DOCKER_HOST_IP is specified grab a v4 IP address associated with
-# the default gateway
-ifeq ($(DOCKER_HOST_IP),)
-DOCKER_HOST_IP := $(shell ifconfig $$(netstat -rn | grep -E '^(default|0.0.0.0)' | head -1 | awk '{print $$NF}') | grep inet | awk '{print $$2}' | sed -e 's/addr://g')
-endif
-
ifneq ($(http_proxy)$(https_proxy),)
# Include proxies from the environment
DOCKER_PROXY_ARGS = \
@@ -55,83 +43,36 @@
--rm --force-rm \
$(DOCKER_BUILD_EXTRA_ARGS)
+DOCKER_IMAGE_LIST = \
+ voltha-openolt-adapter-base \
+ voltha-openolt-adapter
+
VENVDIR := venv-$(shell uname -s | tr '[:upper:]' '[:lower:]')
-DOCKER_IMAGE_LIST = \
- openolt-protos \
- openolt-adapter \
-
-# The following list was scavanged from the compose / stack files as well as
-# from the Dockerfiles. If nothing else it highlights that VOLTHA is not
-# using consistent versions for some of the containers.
-
-FETCH_COMPOSE_IMAGE_LIST = \
- wurstmeister/kafka:latest \
- wurstmeister/zookeeper:latest
-
-# find k8s -type f | xargs grep image: | awk '{print $NF}' | sed -e 's/\"//g' | sed '/:.*$/!s/$/:latest/g' | sort -u | sed -e 's/^/ /g' -e 's/$/ \\/g'
-# Manually remove some image from this list as they don't reflect the new
-# naming conventions for the VOLTHA build
-FETCH_K8S_IMAGE_LIST = \
- wurstmeister/kafka:1.0.0 \
- zookeeper:3.4.11
-
-FETCH_IMAGE_LIST = $(shell echo $(FETCH_BUILD_IMAGE_LIST) $(FETCH_COMPOSE_IMAGE_LIST) $(FETCH_K8S_IMAGE_LIST) | tr ' ' '\n' | sort -u)
-
-.PHONY: $(DIRS) $(DIRS_CLEAN) $(DIRS_FLAKE8) flake8 base openolt ofagent kafka common start stop tag push pull
+.PHONY: $(DIRS) $(DIRS_CLEAN) base openolt_adapter
# This should to be the first and default target in this Makefile
help:
@echo "Usage: make [<target>]"
@echo "where available targets are:"
@echo
- @echo "build : Build the Adapters protos and docker images.\n\
- If this is the first time you are building, choose \"make build\" option."
- @echo "clean : Remove files created by the build and tests"
- @echo "distclean : Remove venv directory"
- @echo "fetch : Pre-fetch artifacts for subsequent local builds"
- @echo "help : Print this help"
- @echo "protoc : Build a container with protoc installed"
- @echo "protos : Compile all grpc/protobuf files"
- @echo "rebuild-venv : Rebuild local Python virtualenv from scratch"
- @echo "venv : Build local Python virtualenv if did not exist yet"
- @echo "containers : Build all the docker containers"
- @echo "base : Build the base docker container used by all other dockers"
- @echo "tag : Tag a set of images"
- @echo "push : Push the docker images to an external repository"
- @echo "pull : Pull the docker images from a repository"
+ @echo "build : Build the adapter."
+ @echo "clean : Remove files created by the build and tests"
+ @echo "distclean : Remove venv directory"
+ @echo "help : Print this help"
+ @echo "rebuild-venv : Rebuild local Python virtualenv from scratch"
+ @echo "venv : Build local Python virtualenv if did not exist yet"
+ @echo "containers : Build all the docker containers"
+ @echo "base : Build a base docker image with a modern version of pip and requirements.txt installed"
+ @echo "openolt_adapter : Build the openolt adapter docker container"
+ @echo "tag : Tag a set of images"
+ @echo "push : Push the docker images to an external repository"
+ @echo "pull : Pull the docker images from a repository"
@echo
-## New directories can be added here
-#DIRS:=
-
-## If one directory depends on another directory that
-## dependency can be expressed here
-##
-## For example, if the Tibit directory depended on the eoam
-## directory being built first, then that can be expressed here.
-## driver/tibit: eoam
-
-# Parallel Build
-$(DIRS):
- @echo " MK $@"
- $(Q)$(MAKE) -C $@
-
-# Parallel Clean
-DIRS_CLEAN = $(addsuffix .clean,$(DIRS))
-$(DIRS_CLEAN):
- @echo " CLEAN $(basename $@)"
- $(Q)$(MAKE) -C $(basename $@) clean
-
-# Parallel Flake8
-DIRS_FLAKE8 = $(addsuffix .flake8,$(DIRS))
-$(DIRS_FLAKE8):
- @echo " FLAKE8 $(basename $@)"
- -$(Q)$(MAKE) -C $(basename $@) flake8
-
build: containers
-containers: base adapter_openolt
+containers: base openolt_adapter
base:
ifdef LOCAL_PYVOLTHA
@@ -139,11 +80,10 @@
cp ../../pyvoltha/dist/*.tar.gz pyvoltha/dist/
docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openolt-adapter-base:${TAG} -f docker/Dockerfile.base_local .
else
- docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openonu-adapter-base:${TAG} -f docker/Dockerfile.base .
+ docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openolt-adapter-base:${TAG} -f docker/Dockerfile.base .
endif
-
-adapter_openolt:
+openolt_adapter: base
docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openolt-adapter:${TAG} -f docker/Dockerfile.openolt_adapter .
tag: $(patsubst %,%.tag,$(DOCKER_IMAGE_LIST))
@@ -161,16 +101,6 @@
%.pull:
docker pull ${REGISTRY}${REPOSITORY}voltha-$(subst .pull,,$@):${TAG}
-openolt_protos:
-ifneq ($(VOLTHA_BUILD),docker)
- make -C protos
-else
- docker build $(DOCKER_BUILD_ARGS) -t ${REGISTRY}${REPOSITORY}voltha-openolt-protos:${TAG} -f docker/Dockerfile.openolt_protos .
-endif
-
-install-protoc:
- make -C voltha/protos install-protoc
-
clean:
rm -rf pyvoltha
find . -name '*.pyc' | xargs rm -f
@@ -178,22 +108,12 @@
distclean: clean
rm -rf ${VENVDIR}
-fetch:
- @bash -c ' \
- for i in $(FETCH_IMAGE_LIST); do \
- docker pull $$i; \
- done'
-
purge-venv:
rm -fr ${VENVDIR}
rebuild-venv: purge-venv venv
-ifneq ($(VOLTHA_BUILD),docker)
venv: ${VENVDIR}/.built
-else
-venv:
-endif
${VENVDIR}/.built:
@ virtualenv ${VENVDIR}
@@ -211,10 +131,7 @@
mkdir -p pyvoltha/dist
cp ../../pyvoltha/dist/*.tar.gz pyvoltha/dist/
@ . ${VENVDIR}/bin/activate && \
- pip install pyvoltha/dist/*.tar.gz
+ pip install pyvoltha/dist/*.tar.gz
endif
-
-flake8: $(DIRS_FLAKE8)
-
# end file
diff --git a/python/env.sh b/python/env.sh
index 433b975..ac26835 100644
--- a/python/env.sh
+++ b/python/env.sh
@@ -25,5 +25,5 @@
fi
. $VENVDIR/bin/activate
- #add top-level voltha dir to pythonpath
+#add top-level voltha dir to pythonpath
export PYTHONPATH=$VOLTHA_BASE/$VENVDIR/lib/python2.7/site-packages:$PYTHONPATH:$VOLTHA_BASE:$VOLTHA_BASE/cli:$VOLTHA_BASE/protos/third_party