golang-client/Makefile
Dean Troyer 753e96dd4a Fix unit tests
* OpenStack CI (Zuul?) puts repos under test in a repo named for the
  running job rather than the actual repo name, Go doesn't like ths.
  Get the actual package name from glide.yaml to build the golang
  workspace rather than the current directory.
* Only install glide on OS/X if it is not already found
* Hack out a bunch of the volume v3 stuff that I should not have merged
  before the unit job was working...the revert fails now too, so this
  is just a fine mess that I am going to clean up now.

Change-Id: I66b359fc1bfd91e686ef0b3f068e582b009e1ea5
2017-01-18 10:52:41 -06:00

94 lines
1.8 KiB
Makefile

# golang-client Makefile
# Follows the interface defined in the Golang CTI proposed
# in https://review.openstack.org/410355
#REPO_VERSION?=$(shell git describe --tags)
GIT_HOST = git.openstack.org
PWD := $(shell pwd)
BASE_DIR := $(shell basename $(PWD))
# Keep an existing GOPATH, make a private one if it is undefined
GOPATH_DEFAULT := $(PWD)/.go
export GOPATH ?= $(GOPATH_DEFAULT)
PKG := $(shell awk '/^package: / { print $$2 }' glide.yaml)
DEST := $(GOPATH)/src/$(GIT_HOST)/openstack/$(BASE_DIR).git
DEST := $(GOPATH)/src/$(PKG)
# CTI targets
depend: work
cd $(DEST) && glide install
test: depend
cd $(DEST) && go test -tags=unit ./...
functional:
@echo "$@ not yet implemented"
fmt: work
cd $(DEST) && go fmt ./...
lint:
@echo "$@ not yet implemented"
cover:
@echo "$@ not yet implemented"
docs:
@echo "$@ not yet implemented"
relnotes:
@echo "Reno not yet implemented for this repo"
translation:
@echo "$@ not yet implemented"
# Do the work here
# Set up the development environment
env:
@echo "PWD: $(PWD)"
@echo "BASE_DIR: $(BASE_DIR)"
@echo "GOPATH: $(GOPATH)"
@echo "DEST: $(DEST)"
@echo "PKG: $(PKG)"
# Get our dev/test dependencies in place
bootstrap:
tools/test-setup.sh
work: $(GOPATH) $(DEST)
$(GOPATH):
mkdir -p $(GOPATH)
$(DEST): $(GOPATH)
mkdir -p $(shell dirname $(DEST))
ln -s $(PWD) $(DEST)
.bindep:
virtualenv .bindep
.bindep/bin/pip install bindep
bindep: .bindep
@.bindep/bin/bindep -b -f bindep.txt || true
install-distro-packages:
tools/install-distro-packages.sh
clean:
rm -rf .bindep
realclean: clean
rm -rf vendor
if [ "$(GOPATH)" = "$(GOPATH_DEFAULT)" ]; then \
rm -rf $(GOPATH); \
fi
shell: work
cd $(DEST) && $(SHELL) -i
.PHONY: bindep clean cover depend docs fmt functional lint realclean \
relnotes test translation