Merge branch 'master' into mempoolsync

This commit is contained in:
Martin Boehm 2018-05-16 13:19:00 +02:00
commit abd53adb84
12 changed files with 31 additions and 23 deletions

View File

@ -2,23 +2,24 @@ BIN_IMAGE = blockbook-build
DEB_IMAGE = blockbook-build-deb
PACKAGER = $(shell id -u):$(shell id -g)
NO_CACHE = false
UPDATE_VENDOR = 1
.PHONY: build build-debug test deb
build: .bin-image
docker run -t --rm -e PACKAGER=$(PACKAGER) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(BIN_IMAGE) make build
docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(BIN_IMAGE) make build
build-debug: .bin-image
docker run -t --rm -e PACKAGER=$(PACKAGER) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(BIN_IMAGE) make build-debug
docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(BIN_IMAGE) make build-debug
test: .bin-image
docker run -t --rm -e PACKAGER=$(PACKAGER) -v $(CURDIR):/src $(BIN_IMAGE) make test
docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src $(BIN_IMAGE) make test
test-all: .bin-image
docker run -t --rm -e PACKAGER=$(PACKAGER) -v $(CURDIR):/src $(BIN_IMAGE) make test-all
docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src $(BIN_IMAGE) make test-all
deb: .deb-image
docker run -t --rm -e PACKAGER=$(PACKAGER) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(DEB_IMAGE)
docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(DEB_IMAGE)
build-images:
rm -f .bin-image .deb-image
@ -28,7 +29,7 @@ build-images:
docker build --no-cache=$(NO_CACHE) -t $(BIN_IMAGE) build/bin
@ docker images -q $(BIN_IMAGE) > $@
.deb-image:
.deb-image: .bin-image
docker build --no-cache=$(NO_CACHE) -t $(DEB_IMAGE) build/deb
@ docker images -q $(DEB_IMAGE) > $@

View File

@ -1,3 +1,5 @@
UPDATE_VENDOR ?= 1
build: prepare-sources
cd $(GOPATH)/src/blockbook && go build -o $(CURDIR)/blockbook -ldflags="-s -w"
cp $(CURDIR)/blockbook /out/blockbook
@ -9,15 +11,20 @@ build-debug: prepare-sources
chown $(PACKAGER) /out/blockbook
test: prepare-sources
#cd $(GOPATH)/src/blockbook && go test -short ./... # FIXME
cd $(GOPATH)/src/blockbook && go test -short ./bchain/coins/btc ./bchain/coins/bch ./bchain/coins/eth ./bchain/coins/zec
cd $(GOPATH)/src/blockbook && go test -short ./...
test-all: prepare-sources
# cd $(GOPATH)/src/blockbook && go test ./... # FIXME
cd $(GOPATH)/src/blockbook && go test ./bchain/coins/btc ./bchain/coins/bch ./bchain/coins/eth ./bchain/coins/zec
cd $(GOPATH)/src/blockbook && go test ./...
prepare-sources:
@ [ -n "`ls /src 2> /dev/null`" ] || (echo "/src doesn't exist or is empty" 1>&2 && exit 1)
cp -r /src $(GOPATH)/src/blockbook
rm -rf $(GOPATH)/src/blockbook/vendor
cd $(GOPATH)/src/blockbook && dep ensure -vendor-only
[ -d $(GOPATH)/src/blockbook ] || cp -r /src $(GOPATH)/src/blockbook
$(MAKE) prepare-vendor
prepare-vendor:
@ if [ "$(UPDATE_VENDOR)" -eq 1 ]; then \
echo "Updating vendor"; \
rm -rf $(GOPATH)/src/blockbook/vendor && cd $(GOPATH)/src/blockbook && dep ensure -vendor-only ; \
else \
echo "Update of vendor not demanded, keeping version from src" ; \
fi

View File

@ -6,7 +6,7 @@ case "$1" in
configure)
if ! id -u blockbook-bch &> /dev/null
then
useradd --system -M -U blockbook-bch
useradd --system -M -U blockbook-bch -s /bin/false
fi
for dir in /opt/coins/data/bch-testnet/blockbook /opt/coins/blockbook/bch-testnet/logs

View File

@ -6,7 +6,7 @@ case "$1" in
configure)
if ! id -u blockbook-bch &> /dev/null
then
useradd --system -M -U blockbook-bch
useradd --system -M -U blockbook-bch -s /bin/false
fi
for dir in /opt/coins/data/bch/blockbook /opt/coins/blockbook/bch/logs

View File

@ -6,7 +6,7 @@ case "$1" in
configure)
if ! id -u blockbook-btc &> /dev/null
then
useradd --system -M -U blockbook-btc
useradd --system -M -U blockbook-btc -s /bin/false
fi
for dir in /opt/coins/data/btc-testnet/blockbook /opt/coins/blockbook/btc-testnet/logs

View File

@ -6,7 +6,7 @@ case "$1" in
configure)
if ! id -u blockbook-btc &> /dev/null
then
useradd --system -M -U blockbook-btc
useradd --system -M -U blockbook-btc -s /bin/false
fi
for dir in /opt/coins/data/btc/blockbook /opt/coins/blockbook/btc/logs

View File

@ -6,7 +6,7 @@ case "$1" in
configure)
if ! id -u blockbook-zec &> /dev/null
then
useradd --system -M -U blockbook-zec
useradd --system -M -U blockbook-zec -s /bin/false
fi
for dir in /opt/coins/data/zec/blockbook /opt/coins/blockbook/zec/logs

View File

@ -6,7 +6,7 @@ case "$1" in
configure)
if ! id -u bcash &> /dev/null
then
useradd --system -M -U bcash
useradd --system -M -U bcash -s /bin/false
fi
if [ "$(stat -c '%U' /opt/coins/data/bch/bitcoin)" != "bcash" ]

View File

@ -6,7 +6,7 @@ case "$1" in
configure)
if ! id -u bcash &> /dev/null
then
useradd --system -M -U bcash
useradd --system -M -U bcash -s /bin/false
fi
if [ "$(stat -c '%U' /opt/coins/data/bch-testnet/bitcoin)" != "bcash" ]

View File

@ -6,7 +6,7 @@ case "$1" in
configure)
if ! id -u bitcoin &> /dev/null
then
useradd --system -M -U bitcoin
useradd --system -M -U bitcoin -s /bin/false
fi
if [ "$(stat -c '%U' /opt/coins/data/btc/bitcoin)" != "bitcoin" ]

View File

@ -6,7 +6,7 @@ case "$1" in
configure)
if ! id -u bitcoin &> /dev/null
then
useradd --system -M -U bitcoin
useradd --system -M -U bitcoin -s /bin/false
fi
if [ "$(stat -c '%U' /opt/coins/data/btc-testnet/bitcoin)" != "bitcoin" ]

View File

@ -6,7 +6,7 @@ case "$1" in
configure)
if ! id -u zcash &> /dev/null
then
useradd --system -M -U zcash
useradd --system -M -U zcash -s /bin/false
fi
if [ "$(stat -c '%U' /opt/coins/data/zec/zcash)" != "zcash" ]