avoid debcargo on build

Switch over to a more manual build oriented on proxmox-backup and
pve-lxc-syscalld.

nothing against debcargo directly, but currently it's really tailored
to Debians re-package upstream crate needs, and that shows.

Once we can generate control files from it without requiring all
build dependencies, and potentially some other stuff fixed, we could
re-introduce it.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-05-30 13:48:40 +02:00
parent 758d000412
commit 426271c059
4 changed files with 49 additions and 23 deletions

View File

@ -4,7 +4,6 @@ include defines.mk
PACKAGE=proxmox-offline-mirror
BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
BUILDDIR_TMP ?= $(BUILDDIR).tmp
SUBDIRS := docs
@ -22,6 +21,13 @@ else
COMPILEDIR := target/debug
endif
USR_BIN := \
proxmox-offline-mirror \
proxmox-offline-mirror-helper
COMPILED_BINS := \
$(addprefix $(COMPILEDIR)/,$(USR_BIN))
all: cargo-build $(SUBDIRS)
.PHONY: cargo-build
@ -29,26 +35,36 @@ cargo-build:
cargo build $(CARGO_BUILD_ARGS)
.PHONY: $(SUBDIRS)
$(SUBDIRS):
$(SUBDIRS): cargo-build
$(MAKE) -C $@
.PHONY: build
build: $(BUILDDIR)
$(BUILDDIR):
rm -rf $(BUILDDIR) $(BUILDDIR_TMP); mkdir $(BUILDDIR_TMP)
rm -f debian/control
$(COMPILED_BINS): cargo-build
install: $(COMPILED_BINS)
$(MAKE) -C docs install DESTDIR=../debian/proxmox-offline-mirror-docs
install -dm755 $(DESTDIR)$(BINDIR)
$(foreach i,$(USR_BIN), \
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;)
update-dcontrol: $(BUILDDIR)
debcargo package \
--config debian/debcargo.toml \
--changelog-ready \
--no-overlay-write-back \
--directory $(BUILDDIR_TMP) \
--directory $(BUILDDIR) \
$(PACKAGE) \
$(shell dpkg-parsechangelog -l debian/changelog -SVersion | sed -e 's/-.*//')
cat $(BUILDDIR_TMP)/debian/control debian/control.extra > debian/control
cat $(BUILDDIR)/debian/control debian/control.extra > debian/control
rm -f debian/control
cp -a debian/control $(BUILDDIR_TMP)/debian/control
rm -f $(BUILDDIR_TMP)/Cargo.lock
find $(BUILDDIR_TMP)/debian -name "*.hint" -delete
mv $(BUILDDIR_TMP) $(BUILDDIR)
wrap-and-sort -t -k-f debian/control
.PHONY: build
build: $(BUILDDIR)
$(BUILDDIR):
rm -rf $@ $@.tmp; mkdir $@.tmp
cp -a src docs debian Cargo.toml Makefile defines.mk $@.tmp/
mv $@.tmp $@
.PHONY: deb
deb: $(DEB)

View File

@ -0,0 +1 @@
usr/bin/proxmox-offline-mirror-helper

1
debian/proxmox-offline-mirror.install vendored Normal file
View File

@ -0,0 +1 @@
usr/bin/proxmox-offline-mirror

30
debian/rules vendored
View File

@ -1,24 +1,32 @@
#!/usr/bin/make -f
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=proxmox-offline-mirror_$(DEB_VERSION_UPSTREAM)
export DEB_CARGO_PACKAGE=proxmox-offline-mirror
export DEB_VERSION DEB_VERSION_UPSTREAM
export BUILD_MODE=release-deb
%:
dh $@ --buildsystem cargo --with=bash-completion
dh $@ --with=bash-completion
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
override_dh_auto_test:
# skip for now to avoid additional debug builds - no tests anyway
# dh_auto_test -- test --all
override_dh_auto_install:
DESTDIR=debian/proxmox-offline-mirror dh_auto_install
DESTDIR=../debian/proxmox-offline-mirror-docs make -C docs install
rm debian/proxmox-offline-mirror/usr/bin/docgen
mkdir -p debian/proxmox-offline-mirror-helper/usr/bin
mv debian/proxmox-offline-mirror/usr/bin/proxmox-offline-mirror-helper \
debian/proxmox-offline-mirror-helper/usr/bin
override_dh_missing:
dh_missing --fail-missing