From e029c60dff35f9d4f15419e9c6e873bf837f1840 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 28 Feb 2020 09:30:47 +0100 Subject: [PATCH] switch to using debcargo Signed-off-by: Wolfgang Bumiller --- Makefile | 50 +++++++++++++++++++++++++------------- debian/cargo-checksum.json | 1 - debian/compat | 2 +- debian/control | 25 ------------------- debian/debcargo.toml | 16 ++++++++++++ debian/rules | 25 +++++++++++++++++-- debian/source/format | 1 + 7 files changed, 74 insertions(+), 46 deletions(-) delete mode 100644 debian/cargo-checksum.json delete mode 100644 debian/control create mode 100644 debian/debcargo.toml create mode 100644 debian/source/format diff --git a/Makefile b/Makefile index b50fe02..2aecd42 100644 --- a/Makefile +++ b/Makefile @@ -2,34 +2,50 @@ include /usr/share/dpkg/pkg-info.mk include /usr/share/dpkg/architecture.mk PACKAGE=pmg-log-tracker -BUILDDIR ?= ${PACKAGE}-${DEB_VERSION_UPSTREAM} GITVERSION:=$(shell git rev-parse HEAD) DEB=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_${DEB_BUILD_ARCH}.deb DSC=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}.dsc -all: ${DEB} +ifeq ($(BUILD_MODE), release) +CARGO_BUILD_ARGS += --release +COMPILEDIR := target/release +else +COMPILEDIR := target/debug +endif -.PHONY: ${BUILDDIR} -${BUILDDIR}: src - rm -rf ${BUILDDIR} ${BUILDDIR}.tmp - mkdir ${BUILDDIR}.tmp - cp -a src ${BUILDDIR}.tmp/src - cp Cargo.toml ${BUILDDIR}.tmp/ - cp -a debian ${BUILDDIR}.tmp/debian - echo "git clone git://git.proxmox.com/git/pmg-log-tracker.git\\ngit checkout ${GITVERSION}" > ${BUILDDIR}.tmp/debian/SOURCE - mv ${BUILDDIR}.tmp ${BUILDDIR} +all: cargo-build $(SUBDIRS) + +.PHONY: cargo-build +cargo-build: + cargo build $(CARGO_BUILD_ARGS) + +.PHONY: build +build: + rm -rf build + debcargo package \ + --config debian/debcargo.toml \ + --changelog-ready \ + --no-overlay-write-back \ + --directory build \ + $(PACKAGE) \ + $(shell dpkg-parsechangelog -l debian/changelog -SVersion | sed -e 's/-.*//') + rm build/Cargo.lock + find build/debian -name "*.hint" -delete + echo system >build/rust-toolchain .PHONY: deb -deb ${DEB}: ${BUILDDIR} - cd ${BUILDDIR}; dpkg-buildpackage -rfakeroot -b -us -uc - lintian ${DEB} +deb: $(DEB) +$(DEB): build + cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc + lintian $(DEB) .PHONY: dsc -dsc ${DSC}: ${BUILDDIR} - cd ${BUILDDIR}; dpkg-buildpackage -rfakeroot -S -us -uc -d - lintian ${DSC} +dsc: $(DSC) +$(DSC): build + cd build; dpkg-buildpackage -S -us -uc -d -nc + lintian $(DSC) .PHONY: dinstall dinstall: ${DEB} diff --git a/debian/cargo-checksum.json b/debian/cargo-checksum.json deleted file mode 100644 index ce2579b..0000000 --- a/debian/cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"package":"","files":{}} diff --git a/debian/compat b/debian/compat index f599e28..48082f7 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -10 +12 diff --git a/debian/control b/debian/control deleted file mode 100644 index e02c296..0000000 --- a/debian/control +++ /dev/null @@ -1,25 +0,0 @@ -Source: pmg-log-tracker -Section: admin -Priority: optional -Maintainer: Proxmox Support Team -Build-Depends: cargo:native, - debhelper (>= 11), - dh-cargo (>= 10), - librust-clap-dev, - librust-failure-dev, - librust-flate2-dev, - librust-libc-dev, - librust-time-dev, - libstd-rust-dev, - rustc:native -Standards-Version: 3.9.8 -Homepage: http://www.proxmox.com - -Package: pmg-log-tracker -Architecture: any -Depends: ${misc:Depends}, - ${shlibs:Depends} -Built-Using: ${cargo:Built-Using} -XB-X-Cargo-Built-Using: ${cargo:X-Cargo-Built-Using} -Description: Proxmox Mailgateway Log Tracker - Tools to scan mail logs. diff --git a/debian/debcargo.toml b/debian/debcargo.toml new file mode 100644 index 0000000..a0c1aae --- /dev/null +++ b/debian/debcargo.toml @@ -0,0 +1,16 @@ +overlay = "." +crate_src_path = ".." + +[source] +maintainer = "Proxmox Support Team " +section = "admin" +build_depends = [ "debhelper (>= 12~)" ] +build_depends_excludes = [ "debhelper (>=11)" ] +homepage = "http://www.proxmox.com" +# TODO: +vcs_git = "" +vcs_browser = "" + +[package] +summary = "Proxmox Mailgateway Log Tracker" +description = "Tools to scan mail logs" diff --git a/debian/rules b/debian/rules index e3ba5d4..ab4ed21 100755 --- a/debian/rules +++ b/debian/rules @@ -1,8 +1,29 @@ #!/usr/bin/make -f # See debhelper(7) (uncomment to enable) # output every command that modifies files on the build system. -#DH_VERBOSE = 1 +DH_VERBOSE = 1 +include /usr/share/dpkg/pkg-info.mk +include /usr/share/rustc/architecture.mk + +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-log-tracker$(DEB_VERSION_UPSTREAM) +export DEB_CARGO_PACKAGE=pmg-log-tracker %: - dh $@ --buildsystem cargo + dh $@ + +override_dh_auto_configure: + $(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system + dh_auto_configure + +override_dh_missing: + dh_missing --fail-missing + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt)