From 0af231dff5b75251d671ca6bcca8416da5c7f3c0 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 15 Nov 2012 23:31:58 +0000 Subject: [PATCH] Use a single version number for program, library and SQL Having the SQL on a different numbering scheme is useful to provide an ungrade path. But pg_repack has no need of such a path as it can be uninstalled with no problem, so we are not going to provide update script. Hence it's much easier to have a single version number for everything. --- lib/.gitignore | 1 + lib/Makefile | 13 +++++-------- lib/{pg_repack.control => pg_repack.control.in} | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) rename lib/{pg_repack.control => pg_repack.control.in} (81%) diff --git a/lib/.gitignore b/lib/.gitignore index 1c46949..7833838 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -1,3 +1,4 @@ /.deps/ /pg_repack.sql /pg_repack--[0-9.]*.sql +/pg_repack.control diff --git a/lib/Makefile b/lib/Makefile index 135daff..045cc0a 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -17,12 +17,6 @@ OBJS = repack.o pgut/pgut-be.o pgut/pgut-spi.o REPACK_VERSION = $(shell grep '"version":' ../META.json | head -1 \ | sed -e 's/\s*"version":\s*"\(.*\)",/\1/') -# The version of the extension, read from the .control file. -# Note that it doesn't need to be the same of the library version: it should -# be increased only when the sql changes. -EXTVER = $(shell grep -e '^default_version' $(EXTENSION).control \ - | sed -e "s/[^']*'\([^']*\)'.*/\1/") - PG_CPPFLAGS = -DREPACK_VERSION=$(REPACK_VERSION) # Support CREATE EXTENSION for PG >= 9.1 and a simple sql script for PG < 9.1 @@ -30,7 +24,7 @@ HAVE_EXTENSION = $(shell $(PG_CONFIG) --version \ | grep -qE " 8\.| 9\.0" && echo no || echo yes) ifeq ($(HAVE_EXTENSION),yes) -DATA_built = pg_repack--$(EXTVER).sql +DATA_built = pg_repack--$(REPACK_VERSION).sql pg_repack.control else DATA_built = pg_repack.sql DATA = uninstall_pg_repack.sql @@ -49,5 +43,8 @@ pg_repack.sql: pg_repack.sql.in sed 's,MODULE_PATHNAME,$$libdir/$(MODULE_big),g' $< >> $@; \ echo "\nCOMMIT;" >> $@; -pg_repack--$(EXTVER).sql: pg_repack.sql.in +pg_repack--$(REPACK_VERSION).sql: pg_repack.sql.in cat $< > $@; + +pg_repack.control: pg_repack.control.in + sed 's,REPACK_VERSION,$(REPACK_VERSION),g' $< > $@ diff --git a/lib/pg_repack.control b/lib/pg_repack.control.in similarity index 81% rename from lib/pg_repack.control rename to lib/pg_repack.control.in index 3e932a2..8f9e90c 100644 --- a/lib/pg_repack.control +++ b/lib/pg_repack.control.in @@ -1,5 +1,5 @@ # pg_repack extension comment = 'Reorganize tables in PostgreSQL databases with minimal locks' -default_version = '1.2dev0' +default_version = 'REPACK_VERSION' module_pathname = '$libdir/pg_repack' relocatable = false