+# Shortcut for common operations:
+
+CRATES != /usr/bin/cargo metadata --no-deps --format-version=1 | jq -r .workspace_members'[]' | awk '{ print $$1 }'
+
+# By default we just run checks:
.PHONY: all
all: check
-.PHONY: check
-check:
- cargo test --all-features
+.PHONY: deb
+deb: $(foreach c,$(CRATES), $c-deb)
+ echo $(foreach c,$(CRATES), $c-deb)
+ lintian build/*.deb
+
+.PHONY: dsc
+dsc: $(foreach c,$(CRATES), $c-dsc)
+ echo $(foreach c,$(CRATES), $c-dsc)
+ lintian build/*.dsc
+
+.PHONY: autopkgtest
+autopkgtest: $(foreach c,$(CRATES), $c-autopkgtest)
.PHONY: dinstall
-dinstall: deb
+dinstall:
+ $(MAKE) clean
+ $(MAKE) deb
sudo -k dpkg -i build/librust-*.deb
-.PHONY: build
-build:
- rm -rf build
- rm -f debian/control
- mkdir build
- debcargo package \
- --config "$(PWD)/debian/debcargo.toml" \
- --changelog-ready \
- --no-overlay-write-back \
- --directory "$(PWD)/build/proxmox-acme-rs" \
- "proxmox-acme-rs" \
- "$$(dpkg-parsechangelog -l "debian/changelog" -SVersion | sed -e 's/-.*//')"
- echo system >build/rust-toolchain
- rm -f build/proxmox-acme-rs/Cargo.lock
- find build/proxmox-acme-rs/debian -name '*.hint' -delete
- cp build/proxmox-acme-rs/debian/control debian/control
+%-deb:
+ ./build.sh $*
+ touch $@
-.PHONY: deb
-deb: build
- (cd build/proxmox-acme-rs && CARGO=/usr/bin/cargo RUSTC=/usr/bin/rustc dpkg-buildpackage -b -uc -us)
- lintian build/*.deb
+%-dsc:
+ BUILDCMD='dpkg-buildpackage -S -us -uc -d' ./build.sh $*
+ touch $@
+
+%-autopkgtest:
+ autopkgtest build/$* build/*.deb -- null
+ touch $@
+
+.PHONY: check
+check:
+ cargo test
+
+# Run the api-test server, serving the api-test/www/ subdir as 'www' dir over
+# http:
+.PHONY: apitest
+apitest:
+ cargo run -p api-test -- api-test/www/
+
+# Prints a diff between the current code and the one rustfmt would produce
+.PHONY: fmt
+fmt:
+ cargo +nightly fmt -- --check
+
+# Doc without dependencies
+.PHONY: doc
+doc:
+ cargo doc --no-deps
.PHONY: clean
clean:
- rm -rf build *.deb *.buildinfo *.changes *.orig.tar.gz
cargo clean
+ rm -rf build/
+ rm -f -- *-deb *-dsc *-autopkgtest *.build *.buildinfo *.changes
+
+.PHONY: update
+update:
+ cargo update
-upload: deb
+%-upload: %-deb
cd build; \
- dcmd --deb rust-proxmox-acme-rs_*.changes \
+ dcmd --deb rust-$*_*.changes \
| grep -v '.changes$$' \
- | tar -cf "rust-proxmox-acme-rs-debs.tar" -T-; \
- cat "rust-proxmox-acme-rs-debs.tar" | ssh -X repoman@repo.proxmox.com upload --product devel --dist bullseye; \
- rm -f rust-proxmox-acme-rs-debs.tar
+ | tar -cf "$@.tar" -T-; \
+ cat "$@.tar" | ssh -X repoman@repo.proxmox.com upload --product devel --dist bookworm