Skip to content

Commit

Permalink
Support newer zookeeper packaging
Browse files Browse the repository at this point in the history
Zookeeper in the official 3.5.6 releases moved to separating out the
binary and source into two different archives.  On top of that all
packages are prepended with `apache-` now.

This changes the make file to look for the minor version and use a
different package name.

Also added a `clean` Makefile target to remove this stuff
  • Loading branch information
nemith committed Dec 22, 2019
1 parent 7f9aac4 commit 839008c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ profile.cov
zookeeper
zookeeper-*/
zookeeper-*.tar.gz
apache-zookeeper-*/
apache-zookeeper-*.tar.gz
31 changes: 25 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# make file to hold the logic of build and test setup
ZK_VERSION ?= 3.4.14

ZK = zookeeper-$(ZK_VERSION)
ZK_URL = "https://archive.apache.org/dist/zookeeper/$(ZK)/$(ZK).tar.gz"
ZK_VERSION ?= 3.5.6

# Apache changed the name of the archive in version 3.5.x and seperated out
# src and binary packages
ZK_MINOR_VER=$(word 2, $(subst ., ,$(ZK_VERSION)))
ifeq ($(shell test $(ZK_MINOR_VER) -le 4; echo $$?),0)
ZK = zookeeper-$(ZK_VERSION)
else
ZK = apache-zookeeper-$(ZK_VERSION)-bin
endif
ZK_URL = "https://archive.apache.org/dist/zookeeper/zookeeper-$(ZK_VERSION)/$(ZK).tar.gz"

PACKAGES := $(shell go list ./... | grep -v examples)

Expand All @@ -11,6 +18,9 @@ PACKAGES := $(shell go list ./... | grep -v examples)
$(ZK):
wget $(ZK_URL)
tar -zxf $(ZK).tar.gz
rm $(ZK).tar.gz

zookeeper: $(ZK)
# we link to a standard directory path so then the tests dont need to find based on version
# in the test code. this allows backward compatable testing.
ln -s $(ZK) zookeeper
Expand All @@ -21,7 +31,7 @@ install-covertools:
go get golang.org/x/tools/cmd/cover

.PHONY: setup
setup: $(ZK) install-covertools
setup: zookeeper install-covertools

.PHONY: lint
lint:
Expand All @@ -33,7 +43,16 @@ build:
go build ./...

.PHONY: test
test: build
test: build zookeeper
go test -timeout 500s -v -race -covermode atomic -coverprofile=profile.cov $(PACKAGES)
# ignore if we fail to publish coverage
-goveralls -coverprofile=profile.cov -service=travis-ci

.PHONY: clean
clean:
rm -f apache-zookeeper-*.tar.gz
rm -f zookeeper-*.tar.gz
rm -rf apache-zookeeper-*/
rm -rf zookeeper-*/
rm -f zookeeper
rm -f profile.cov

0 comments on commit 839008c

Please sign in to comment.