switch to using debcargo

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-02-28 09:30:47 +01:00
parent d06ac89c35
commit e029c60dff
7 changed files with 74 additions and 46 deletions

View File

@ -2,34 +2,50 @@ include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/architecture.mk include /usr/share/dpkg/architecture.mk
PACKAGE=pmg-log-tracker PACKAGE=pmg-log-tracker
BUILDDIR ?= ${PACKAGE}-${DEB_VERSION_UPSTREAM}
GITVERSION:=$(shell git rev-parse HEAD) GITVERSION:=$(shell git rev-parse HEAD)
DEB=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_${DEB_BUILD_ARCH}.deb DEB=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_${DEB_BUILD_ARCH}.deb
DSC=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}.dsc 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} all: cargo-build $(SUBDIRS)
${BUILDDIR}: src
rm -rf ${BUILDDIR} ${BUILDDIR}.tmp .PHONY: cargo-build
mkdir ${BUILDDIR}.tmp cargo-build:
cp -a src ${BUILDDIR}.tmp/src cargo build $(CARGO_BUILD_ARGS)
cp Cargo.toml ${BUILDDIR}.tmp/
cp -a debian ${BUILDDIR}.tmp/debian .PHONY: build
echo "git clone git://git.proxmox.com/git/pmg-log-tracker.git\\ngit checkout ${GITVERSION}" > ${BUILDDIR}.tmp/debian/SOURCE build:
mv ${BUILDDIR}.tmp ${BUILDDIR} 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 .PHONY: deb
deb ${DEB}: ${BUILDDIR} deb: $(DEB)
cd ${BUILDDIR}; dpkg-buildpackage -rfakeroot -b -us -uc $(DEB): build
lintian ${DEB} cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc
lintian $(DEB)
.PHONY: dsc .PHONY: dsc
dsc ${DSC}: ${BUILDDIR} dsc: $(DSC)
cd ${BUILDDIR}; dpkg-buildpackage -rfakeroot -S -us -uc -d $(DSC): build
lintian ${DSC} cd build; dpkg-buildpackage -S -us -uc -d -nc
lintian $(DSC)
.PHONY: dinstall .PHONY: dinstall
dinstall: ${DEB} dinstall: ${DEB}

View File

@ -1 +0,0 @@
{"package":"","files":{}}

2
debian/compat vendored
View File

@ -1 +1 @@
10 12

25
debian/control vendored
View File

@ -1,25 +0,0 @@
Source: pmg-log-tracker
Section: admin
Priority: optional
Maintainer: Proxmox Support Team <support@proxmox.com>
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.

16
debian/debcargo.toml vendored Normal file
View File

@ -0,0 +1,16 @@
overlay = "."
crate_src_path = ".."
[source]
maintainer = "Proxmox Support Team <support@proxmox.com>"
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"

25
debian/rules vendored
View File

@ -1,8 +1,29 @@
#!/usr/bin/make -f #!/usr/bin/make -f
# See debhelper(7) (uncomment to enable) # See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system. # 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

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)