#!/usr/bin/make -f

export DH_GOLANG_EXCLUDES := github.com/proglottis/gpgme/examples
export DH_GOLANG_EXCLUDES_ALL := 1

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

SUN_PATH_LIMIT=108

# workaround bug in gpg-agent: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=847206
override_dh_auto_test:
	SOCKET_PATH="$(CURDIR)/testdata/gpghome/S.gpg-agent" ; \
	if [ $${#SOCKET_PATH} -gt $(SUN_PATH_LIMIT) ]; then \
	    echo "W: current path too long ($${#SOCKET_PATH} > 108), skipping tests: $$SOCKET_PATH" ; \
	else \
		echo "I: current path not too long, running tests ($${#SOCKET_PATH}): $$SOCKET_PATH"; dh_auto_test ;\
	fi
