summaryrefslogtreecommitdiffstats
path: root/makefile
blob: d445e58cece6e2d6477fc38fe4fd35ea5e37132e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
none:
	@echo make verify-versions

verify-versions:
	@echo check pom.xml against setup.py and types.yaml files
	@for i in */pom.xml; do \
		p=$$(dirname $$i); \
		echo Working on $$i; \
		v=$$(grep "<version>" $$i | sed 2q | tail -n 1 | sed -e 's!</\?version>!!g' -e 's/-SNAPSHOT//' -e 's/[[:space:]]//g'); \
		if grep 'version[[:space:]]*=[[:space:]]*["'"']$$v['"'"]' $$p/setup.py > /dev/null; then \
			echo "$$i version $$v verified in $$p/setup.py"; \
		else \
			grep -n "<version>" $$i /dev/null | sed 2q | tail -n 1; \
			grep -n "version[[:space:]]*=" $$p/setup.py /dev/null; \
			echo "$$i version $$v not found in $$p/setup.py. Instead found the above version."; \
			exit 1 ; \
		fi; \
		typefiles=$$( grep -l "package_version[[:space:]]*:" $$p/* 2>/dev/null ); \
		if [ -z "$$typefiles" ]; then \
			echo "No type files found in $$p"; \
			exit 1 ; \
		else \
			for typefile in $$typefiles; do \
				if grep "package_version:[[:space:]]*$$v" "$$typefile" > /dev/null 2>&1; then \
					echo "$$i version $$v verified in" "$$typefile"; \
				else \
					grep -n "<version>" $$i /dev/null | sed 2q | tail -n 1; \
					grep -n "package_version:" "$$typefile" /dev/null; \
					exit 1 ; \
				fi; \
			done; \
		fi; \
		echo; \
	done
	@pomv=$$(grep "<version>" pom.xml | sed 2q | tail -n 1 | sed -e 's!</\?version>!!g' -e 's/[[:space:]]//g'); \
	for i in */pom.xml; do \
		v=$$(grep "<version>" $$i | sed 1q | sed -e 's!</\?version>!!g' -e 's/[[:space:]]//g'); \
		if [ "$$pomv" = "$$v" ]; then \
			echo "pom.xml version $$pomv verified in $$i"; \
		else \
			grep -n "<version>" $$i /dev/null | sed 1q; \
			echo "pom.xml version $$pomv not found in $$i. Instead found $$v"; \
			exit 1 ; \
		fi; \
	done