#!/usr/bin/make -f

# cmd/ is the trivy-db command; only the library is packaged.
export DH_GOLANG_EXCLUDES := cmd

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

override_dh_auto_test:
	# The +ds tarball drops test data that is not DFSG-free or has no licence
	# (see debian/copyright), so the tests that read it do not run:
	# TestInit and TestMultipleInit read the binary pkg/db/testdata/*.db;
	# alma, redhat-oval and suse-cvrf read their excluded testdata/.
	# The five sad-path cases check the wording of encoding/json errors,
	# which changed in Go 1.27; the input is still rejected.
	DH_GOLANG_EXCLUDES="cmd pkg/vulnsrc/alma pkg/vulnsrc/redhat-oval pkg/vulnsrc/suse-cvrf" \
		dh_auto_test -- -skip 'TestInit|TestMultipleInit|TestVulnSrc_Update/(sad[1-4]:_(AffectedRelease|PackageState)_is_an_invalid_(array|object)|sad_path_Criterion_is_not_array)'
