Make the version number arith without using bc

Not as available as I thought.

Can't use the 0 prefix to make the 3rd number optional as $(()) parses is as
octal, so only use the first 2 numbers.

Also fixed collate test: not available on PG 9.0.
This commit is contained in:
Daniele Varrazzo
2013-04-18 01:10:22 +01:00
parent dd06f25930
commit 14c4d4653e
3 changed files with 16 additions and 13 deletions

View File

@ -8,9 +8,9 @@
PG_CONFIG ?= pg_config
# version as a number, e.g. 9.1.4 -> 90104
# version as a number, e.g. 9.1.4 -> 901
VERSION := $(shell $(PG_CONFIG) --version | awk '{print $$2}')
INTVERSION := $(shell echo $(VERSION) | sed -E 's/([0-9]+)\.([0-9]+)\.?([0-9]+)?.*/(\1*100+\2)*100+0\3/' | bc)
INTVERSION := $(shell echo $$(($$(echo $(VERSION) | sed -E 's/([0-9]+)\.([0-9]+).*/\1*100+\2/'))))
SRCS = pg_repack.c pgut/pgut.c pgut/pgut-fe.c
OBJS = $(SRCS:.c=.o)
@ -21,7 +21,7 @@ PROGRAM = pg_repack
# Test suite
#
ifeq ($(shell echo $$(($(INTVERSION) >= 90100))),1)
ifeq ($(shell echo $$(($(INTVERSION) >= 901))),1)
REGRESS = init-extension
else
REGRESS = init-legacy
@ -29,8 +29,8 @@ endif
REGRESS += repack tablespace
# This test depends on collate, not supported before 9.0
ifeq ($(shell echo $$(($(INTVERSION) >= 90000))),1)
# This test depends on collate, not supported before 9.1
ifeq ($(shell echo $$(($(INTVERSION) >= 901))),1)
REGRESS += issue3
endif