#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk

export DH_GOLANG_EXCLUDES := images site
export DH_GOLANG_INSTALL_EXTRA := site/content/docs/user/kind-example-config.yaml

%:
	dh $@ --builddirectory=_build --buildsystem=golang

override_dh_auto_install:
	dh_auto_install -- --no-source

override_dh_auto_test:
	# Skip tests that require opening localhost ports.
	dh_auto_test -- -skip='TestPortOrGetFreePort/No_port|TestGetFreePort/listen_on_localhost'

execute_before_dh_installman:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	help2man debian/kind/usr/bin/kind \
		--no-info --no-discard-stderr \
		--version-string="$(DEB_VERSION_UPSTREAM)" \
		-n "Kubernetes IN Docker - local clusters for testing Kubernetes" > debian/kind.1
endif
