summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-03-28 15:56:14 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-03-28 15:56:14 +0100
commit9ff11f6ef6b2bfd62091440a28ad489011ede04f (patch)
tree27e3f8335702c6229a2b445695e5c13cd08d0c12 /Makefile
parent878c5a83cbeb536e8dd0b9db28ba51b28b090f2b (diff)
Add a sanity check for the crate versions.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 17 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 96fe9820..254347f3 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,9 @@ CARGO_TARGET_DIR ?= $(shell pwd)/target
CARGO_TARGET_DIR := $(abspath $(CARGO_TARGET_DIR))
# The tests to run.
CARGO_TEST_ARGS ?= --all
+# Version as stated in the top-level Cargo.toml.
+VERSION ?= $(shell grep '^version[[:space:]]*=[[:space:]]*' Cargo.toml\
+ | cut -d'"' -f2)
# Signing source distributions.
SIGN_WITH ?= XXXXXXXXXXXXXXXX
@@ -129,3 +132,17 @@ clean:
CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) $(CARGO) $(CARGO_FLAGS) clean
$(MAKE) -Copenpgp-ffi clean
$(MAKE) -Cffi clean
+
+.PHONY: sanity-check-versions
+sanity-check-versions:
+ set -e ; V=$(VERSION) ; VV=$(shell echo $(VERSION) | cut -d. -f1-2) ;\
+ bad() { echo "bad $$*." ; exit 1 ; } ;\
+ find . -name Cargo.toml | while read TOML ; do \
+ echo -n "$$TOML " ;\
+ grep '^version *=' $$TOML | grep -q $$V || bad version ;\
+ grep '^documentation *=' $$TOML | grep -q $$V || bad documentation ;\
+ grep '{ *path *= *"' $$TOML | while read L ; do \
+ echo $$L | grep -q $$VV || bad intra-workspace dependency ;\
+ done ;\
+ echo good. ;\
+ done