#!/usr/bin/make -f

export DH_GOLANG_GO_GENERATE := 1

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

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 vendor -type d -empty -delete -print

override_dh_auto_build:
	dh_auto_build -- -ldflags '-X github.com/docker/distribution/version.Version=$(DEB_VERSION_UPSTREAM)'

override_dh_auto_test:
	# health/checks hit the internet, and thus fail
	#DH_GOLANG_EXCLUDES='distribution/registry/handlers health/checks' dh_auto_test -- -test.short

%:
	dh $@ --buildsystem=golang --with=golang
