#!/usr/bin/make -f include /usr/share/dpkg/pkg-info.mk ## needs "mockery": export DH_GOLANG_GO_GENERATE := 1 export GOPROXY=off export GO111MODULE=off export DH_GOLANG_INSTALL_EXTRA := \ command/connect/ca/set/test-fixtures \ build-support/functions \ build-support/scripts/functions.sh \ build-support/scripts/proto-gen.sh \ test export DH_GOLANG_EXCLUDES := test/integration export HOME=$(CURDIR)/debian/tmp ifneq (,$(filter $(DEB_BUILD_ARCH), mipsel mips64el)) MINUS:=- endif %: dh $@ --buildsystem=golang --with=golang,bash-completion --builddirectory=_build override_dh_clean: dh_clean ## Remove Files-Excluded (when built from checkout or non-DFSG tarball): $(RM) -rv `perl -0nE 'say $$1 if m{^Files\-Excluded\:\s*(.*?)(?:\n\n|Files:|Comment:)}sm;' debian/copyright` # -find . -type f -name '*.pb.go' -delete -printf 'removed %p\n' ## delete generated .pb.go files -find vendor -type d -empty -delete -print $(RM) -r test/integration LIBSELF:=github.com/hashicorp/consul override_dh_auto_build: # ## https://salsa.debian.org/onlyjob/notes/wikis/golang # ## "go generate" in "vendor": # DH_GOLANG_EXCLUDES="vendor/github.com/hashicorp/go-discover vendor/github.com/hashicorp/vault vendor/github.com/jefferai/jsonx" \ # DH_GOPKG="$(LIBSELF)/vendor" \ # DH_GOLANG_GO_GENERATE=1 \ # dh_auto_build -v # export GOPATH=$(CURDIR)/_build \ GIT_COMMIT=$(DEB_VERSION_UPSTREAM) \ GIT_COMMIT_YEAR=$(shell date -u -d @$(SOURCE_DATE_EPOCH) +%Y) \ && $(MAKE) -C _build/src/$(LIBSELF) --makefile=$(CURDIR)/GNUmakefile proto dh_auto_build -v ## Quoting upstream as per ".github/CONTRIBUTING.md": ## > The test suite may fail if over-parallelized, so if you are seeing ## > stochastic failures try `GOTEST_FLAGS="-p 2 -parallel 2". ## Note that "--max-parallel=2" translates to "-p 2" which is not the same as "-parallel 2". override_dh_auto_test: $(MINUS)PATH="$(CURDIR)/_build/bin:$${PATH}" \ DH_GOLANG_EXCLUDES="${DH_GOLANG_EXCLUDES} api agent/cache agent/checks agent/connect agent/consul agent/proxycfg agent/routine-leak-checker command/debug command/tls command/flags command/monitor" \ dh_auto_test -v --max-parallel=4 -- -short -failfast -timeout 8m override_dh_install: ## Do not install "github.com/hashicorp/consul/vendor" to -dev package. dh_install -X/src/github.com/hashicorp/consul/vendor -Xcertgen override_dh_installsystemd: dh_installsystemd --no-enable --no-start override_dh_installinit: dh_installinit --no-enable --no-start