buildsys: various improvements

- make deb and dsc targets phony and always rebuild the build/ dir
- add the build/*.{deb,dsc} files as targets without forcing a
  recreation of the build/ dir
- make upload target autodetect the distribution

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2023-08-24 10:08:38 +02:00
parent c18fcb9151
commit 9c16f1c85e

View File

@ -1,3 +1,12 @@
include /usr/share/dpkg/pkg-info.mk
SRCPACKAGE=rust-pathpatterns
PACKAGE=lib$(SRCPACKAGE)-dev
ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB=$(PACKAGE)_$(DEB_VERSION)_$(ARCH).deb
DSC=$(SRCPACKAGE)_$(DEB_VERSION)_$(ARCH).deb
.PHONY: all .PHONY: all
all: check all: check
@ -27,12 +36,14 @@ build:
cp build/pathpatterns/debian/control debian/control cp build/pathpatterns/debian/control debian/control
.PHONY: deb .PHONY: deb
deb: build deb: build build/$(DEB)
build/$(DEB): | build
(cd build/pathpatterns && CARGO=/usr/bin/cargo RUSTC=/usr/bin/rustc dpkg-buildpackage -b -uc -us) (cd build/pathpatterns && CARGO=/usr/bin/cargo RUSTC=/usr/bin/rustc dpkg-buildpackage -b -uc -us)
lintian build/*.deb lintian build/*.deb
.PHONY: dsc .PHONY: dsc
dsc: build dsc: build build/$(DSC)
build/$(DSC): | build
(cd build/pathpatterns && CARGO=/usr/bin/cargo RUSTC=/usr/bin/rustc dpkg-buildpackage -S -uc -us) (cd build/pathpatterns && CARGO=/usr/bin/cargo RUSTC=/usr/bin/rustc dpkg-buildpackage -S -uc -us)
lintian build/*.dsc lintian build/*.dsc
@ -41,9 +52,9 @@ clean:
rm -rf build *.deb *.dsc *.buildinfo *.changes *.orig.tar.gz rm -rf build *.deb *.dsc *.buildinfo *.changes *.orig.tar.gz
cargo clean cargo clean
upload: deb .PHONY: upload
cd build; \ upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
dcmd --deb rust-pathpatterns_*.changes \ upload: build/$(DEB)
| grep -v '.changes$$' \ # check if working directory is clean
| tar -cf- -T- \ git diff --exit-code --stat && git diff --exit-code --stat --staged
| ssh -X repoman@repo.proxmox.com upload --product devel --dist buster tar -C build -cf - $(DEB) | ssh -X repoman@repo.proxmox.com upload --product devel --dist $(DEB_DISTRIBUTION)