buildsys: pmg-rs: dsc and sbuild updates

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2023-05-17 15:43:28 +02:00
parent 1b499b7611
commit 3255c3b59c
4 changed files with 37 additions and 15 deletions

5
pmg-rs/.cargo/config Normal file
View File

@ -0,0 +1,5 @@
[source]
[source.debian-packages]
directory = "/usr/share/cargo/registry"
[source.crates-io]
replace-with = "debian-packages"

View File

@ -1,4 +1,4 @@
include /usr/share/dpkg/default.mk include /usr/share/dpkg/pkg-info.mk
PACKAGE=libpmg-rs-perl PACKAGE=libpmg-rs-perl
@ -8,9 +8,11 @@ export GITVERSION:=$(shell git rev-parse HEAD)
PERL_INSTALLVENDORARCH != perl -MConfig -e 'print $$Config{installvendorarch};' PERL_INSTALLVENDORARCH != perl -MConfig -e 'print $$Config{installvendorarch};'
PERL_INSTALLVENDORLIB != perl -MConfig -e 'print $$Config{installvendorlib};' PERL_INSTALLVENDORLIB != perl -MConfig -e 'print $$Config{installvendorlib};'
MAIN_DEB=${PACKAGE}_${DEB_VERSION}_${ARCH}.deb MAIN_DEB=$(PACKAGE)_$(DEB_VERSION)_$(ARCH).deb
DBGSYM_DEB=${PACKAGE}-dbgsym_${DEB_VERSION}_${ARCH}.deb DBGSYM_DEB=$(PACKAGE)-dbgsym_$(DEB_VERSION)_$(ARCH).deb
DEBS=$(MAIN_DEB) $(DBGSYM_DEB) DEBS=$(MAIN_DEB) $(DBGSYM_DEB)
DSC=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc
BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
DESTDIR= DESTDIR=
@ -36,19 +38,17 @@ else
TARGET_DIR=debug TARGET_DIR=debug
endif endif
all: all: PMG
ifneq ($(BUILD_MODE), skip)
cargo build $(CARGO_BUILD_ARGS) cargo build $(CARGO_BUILD_ARGS)
endif
PMG: Proxmox/Lib/PMG.pm PMG: Proxmox/Lib/PMG.pm
Proxmox/Lib/PMG.pm: Proxmox/Lib/PMG.pm:
$(PERLMOD_GENPACKAGE) $(PERLMOD_PACKAGES) $(PERLMOD_GENPACKAGE) $(PERLMOD_PACKAGES)
.PHONY: install .PHONY: install
install: ../target/release/libpmg_rs.so Proxmox/Lib/PMG.pm PMG install: target/release/libpmg_rs.so Proxmox/Lib/PMG.pm PMG
install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORARCH)/auto install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORARCH)/auto
install -m644 ../target/release/libpmg_rs.so $(DESTDIR)$(PERL_INSTALLVENDORARCH)/auto/libpmg_rs.so install -m644 target/release/libpmg_rs.so $(DESTDIR)$(PERL_INSTALLVENDORARCH)/auto/libpmg_rs.so
install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORLIB) install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORLIB)
install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORLIB)/Proxmox/Lib install -d -m755 $(DESTDIR)$(PERL_INSTALLVENDORLIB)/Proxmox/Lib
install -m644 Proxmox/Lib/PMG.pm $(DESTDIR)$(PERL_INSTALLVENDORLIB)/Proxmox/Lib/PMG.pm install -m644 Proxmox/Lib/PMG.pm $(DESTDIR)$(PERL_INSTALLVENDORLIB)/Proxmox/Lib/PMG.pm
@ -59,14 +59,33 @@ distclean: clean
clean: clean:
cargo clean cargo clean
rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes Cargo.lock rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes Cargo.lock
rm -rf $(PACKAGE)-[0-9]*/
find . -name '*~' -exec rm {} ';' find . -name '*~' -exec rm {} ';'
.PHONY: dinstall .PHONY: dinstall
dinstall: ${DEBS} dinstall: $(DEBS)
dpkg -i ${DEBS} dpkg -i $(DEBS)
.PHONY: upload .PHONY: upload
upload: ${DEBS} upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
upload: $(DEBS)
# check if working directory is clean # check if working directory is clean
git diff --exit-code --stat && git diff --exit-code --stat --staged git diff --exit-code --stat && git diff --exit-code --stat --staged
tar cf - ${DEBS} | ssh -X repoman@repo.proxmox.com upload --product pmg --dist bullseye tar cf - $(DEBS) | ssh -X repoman@repo.proxmox.com upload --product pmg --dist $(DEB_DISTRIBUTION)
$(BUILDDIR): src debian common/src Cargo.toml Makefile .cargo/config
rm -rf $(BUILDDIR) $(BUILDDIR).tmp
mkdir $(BUILDDIR).tmp
mkdir $(BUILDDIR).tmp/common
cp -a -t $(BUILDDIR).tmp src debian Cargo.toml Makefile .cargo
cp -a -t $(BUILDDIR).tmp/common common/src
mv $(BUILDDIR).tmp $(BUILDDIR)
.PHONY: dsc
dsc: $(DSC)
$(DSC): $(BUILDDIR)
cd $(BUILDDIR); PATH="/usr/local/bin:/usr/bin" dpkg-buildpackage -S -us -uc -d
lintian $(DSC)
sbuild: $(DSC)
sbuild $(DSC)

View File

@ -1 +0,0 @@
12

View File

@ -3,12 +3,11 @@ Section: perl
Priority: optional Priority: optional
Maintainer: Proxmox Support Team <support@proxmox.com> Maintainer: Proxmox Support Team <support@proxmox.com>
Build-Depends: Build-Depends:
debhelper (>= 12), debhelper-compat (= 13),
dh-cargo (>= 24), dh-cargo (>= 24),
perlmod-bin, perlmod-bin,
cargo:native <!nocheck>, cargo:native <!nocheck>,
rustc:native <!nocheck>, rustc:native <!nocheck>,
libstd-rust-dev <!nocheck>,
librust-anyhow-1+default-dev, librust-anyhow-1+default-dev,
librust-env-logger-0.9+default-dev, librust-env-logger-0.9+default-dev,
librust-hex-0.4+default-dev, librust-hex-0.4+default-dev,