From cd8984a9549df739a95238639b2f45bfe908f85a Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 5 Jul 2023 13:44:48 +0200 Subject: [PATCH] buildsys: both: check crate vs debian version Signed-off-by: Wolfgang Bumiller --- pmg-rs/debian/rules | 18 ++++++++++++++++++ pve-rs/debian/rules | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/pmg-rs/debian/rules b/pmg-rs/debian/rules index 0f5be05b..29937153 100755 --- a/pmg-rs/debian/rules +++ b/pmg-rs/debian/rules @@ -1,7 +1,25 @@ #!/usr/bin/make -f +include /usr/share/dpkg/pkg-info.mk +include /usr/share/rustc/architecture.mk + #export DH_VERBOSE=1 export BUILD_MODE=release +CARGO=/usr/share/cargo/bin/cargo + +export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS +export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE +export CARGO_HOME = $(CURDIR)/debian/cargo_home + +export DEB_CARGO_CRATE=pmg-rs_$(DEB_VERSION_UPSTREAM) +export DEB_CARGO_PACKAGE=pmg-rs + %: dh $@ + +override_dh_auto_configure: + @perl -ne 'if (/^version\s*=\s*"(\d+(?:\.\d+)+)"/) { my $$v_cargo = $$1; my $$v_deb = "$(DEB_VERSION_UPSTREAM)"; \ + die "ERROR: d/changelog <-> Cargo.toml version mismatch: $$v_cargo != $$v_deb\n" if $$v_cargo ne $$v_deb; exit(0); }' Cargo.toml + $(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system + dh_auto_configure diff --git a/pve-rs/debian/rules b/pve-rs/debian/rules index 0f5be05b..bddb889a 100755 --- a/pve-rs/debian/rules +++ b/pve-rs/debian/rules @@ -1,7 +1,25 @@ #!/usr/bin/make -f +include /usr/share/dpkg/pkg-info.mk +include /usr/share/rustc/architecture.mk + #export DH_VERBOSE=1 export BUILD_MODE=release +CARGO=/usr/share/cargo/bin/cargo + +export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS +export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE +export CARGO_HOME = $(CURDIR)/debian/cargo_home + +export DEB_CARGO_CRATE=pve-rs_$(DEB_VERSION_UPSTREAM) +export DEB_CARGO_PACKAGE=pve-rs + %: dh $@ + +override_dh_auto_configure: + @perl -ne 'if (/^version\s*=\s*"(\d+(?:\.\d+)+)"/) { my $$v_cargo = $$1; my $$v_deb = "$(DEB_VERSION_UPSTREAM)"; \ + die "ERROR: d/changelog <-> Cargo.toml version mismatch: $$v_cargo != $$v_deb\n" if $$v_cargo ne $$v_deb; exit(0); }' Cargo.toml + $(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system + dh_auto_configure