#!/usr/bin/make -f # resolve DEB_VERSION_UPSTREAM DEB_VERSION 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) %: dh $@ --sourcedirectory=rip-starttls # resolve binary package version from embedded crate version override_dh_gencontrol: $(eval version = $(call crate_version,rip-starttls))\ dh_gencontrol -- -v'$(version)'