#!/usr/bin/make -f

export DH_GOLANG_EXCLUDES := integration plugins/sample plugins/main/windows pkg/testutils/echo

DD=debian/tmp

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

override_dh_auto_test:
	if test $$(id -u) = 0; then dh_auto_test; fi

execute_after_dh_auto_install:
	## Exclude main packages from /usr/share/gocode.
	## These can not be imported by other packages.
	find $(DD)/usr/share/gocode/src/github.com/containernetworking/plugins/ \
		-type f -exec grep -Eq '^package (main|main_test)$$' '{}' \; -delete -print
	find $(DD)/usr/share/gocode/src/github.com/containernetworking/plugins/ \
		-type d -empty -delete -print

override_dh_installsystemd:
	dh_installsystemd --name=cni-dhcp --no-enable --no-start
