#!/usr/bin/make -f

export DH_GOLANG_EXCLUDES := integration plugins/sample plugins/main/windows

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

override_dh_auto_test:
	# portmap still needs legacy iptables.
	set -e; if test x"$(AUTOPKGTEST_TMP)" != "x"; then \
		ln -sf /usr/sbin/iptables-legacy $(CURDIR)/_build/bin/iptables; \
		export PATH=$(CURDIR)/_build/bin:$(PATH); \
		dh_auto_test --no-parallel -- -timeout 30m; \
		ip netns list|grep cnitest|cut -d' ' -f1|xargs -n1 ip netns delete || true; \
	fi

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