#!/usr/bin/make -f # resolve DEB_VERSION DEB_VERSION_UPSTREAM DEB_VERSION_UPSTREAM_REVISION include /usr/share/dpkg/pkg-info.mk # resolve crate version # * get topmost version except prerelease suffix # from Cargo.toml file in dir passed as argument # * source package version if matching upstream part modulo prerelease # * otherwise append source package version crate_version = \ $(shell perl -n \ -E '/version\W+\K\d+\.\d+\.\d+/ ' \ -E 'and say "$(DEB_VERSION_UPSTREAM)" =~ /^\Q$$&\E(?:~[a-z]+\d*)?$$/ \ ? "$(DEB_VERSION)" \ : "$$&+$(DEB_VERSION_UPSTREAM_REVISION)" and exit' \ $1/Cargo.toml) # known failing tests TEST_FAILS = \ jf2::test::try_from_document_to_object %: dh $@ # declare version for virtually provided embedded crates packages = librust-microformats-dev packages_virtual = librust-microformats-types-dev override_dh_gencontrol: $(eval librust-microformats-dev_version = $(call crate_version,library)) $(eval librust-microformats-types-dev_version = $(call crate_version,types)) set -e; $(foreach p,$(packages),\ dh_gencontrol -p$p -- \ -v'$($p_version)' \ $(foreach q,$(filter-out $p,$(packages) $(packages_virtual)),\ -V'rust:Version:$q=$($q_version)');) dh_gencontrol --remaining-packages override_dh_auto_test: dh_auto_test --buildsystem rust -- \ --no-fail-fast -- $(addprefix --skip ,$(TEST_FAILS))