#!/usr/bin/make -f

# cmd/ holds upstream's generators and tools; integration/ runs trivy in
# containers; internal/examples needs aws-cloudformation/rain.
export DH_GOLANG_EXCLUDES := ^(github.com/aquasecurity/trivy-checks/)?(cmd|integration|internal/examples)(/|$$)
# Rego checks, libraries, commands and compliance specs are embedded.
export DH_GOLANG_INSTALL_EXTRA := checks lib commands $(wildcard pkg/compliance/*.yaml)
# Debian installs github.com/go-ini/ini as a symlink to gopkg.in/ini.v1.
export DH_GOLANG_MODULE_MAPPINGS := github.com/go-ini/ini:gopkg.in/ini.v1

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

# TestInputsConformToSchema reads ../schemas/, which is not in the source.
override_dh_auto_test:
	dh_auto_test -- -skip 'TestInputsConformToSchema'

execute_after_dh_install:
	find debian/golang-github-aquasecurity-trivy-checks-dev/usr/share/gocode -name '*.go' -exec chmod a-x {} +
