From: Sandro Santilli Date: Mon, 27 Feb 2012 11:22:12 +0000 (+0000) Subject: Set script version to master version + svn revision (#1608) X-Git-Tag: 2.0.0beta1~52 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e748f87f3babd6698a6523e0d937b356c7ec4afb;p=postgis Set script version to master version + svn revision (#1608) Affects postgis_scripts_released() and posgis_scripts_installed(). Needs some wider testing of upgrade scripts and then will attach the same version to raster and topology. git-svn-id: http://svn.osgeo.org/postgis/trunk@9304 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/configure.ac b/configure.ac index ac9c49958..1e4d241df 100644 --- a/configure.ac +++ b/configure.ac @@ -757,8 +757,7 @@ fi POSTGIS_LIB_VERSION="$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION.$POSTGIS_MICRO_VERSION" POSTGIS_BUILD_DATE=`date -u "+%Y-%m-%d %H:%M:%S"` -POSTGIS_SCRIPTS_SVNREV=`perl utils/read_scripts_version.pl` -POSTGIS_SCRIPTS_VERSION="$POSTGIS_MAJOR_VERSION.$POSTGIS_MINOR_VERSION r$POSTGIS_SCRIPTS_SVNREV" +POSTGIS_SCRIPTS_VERSION="$POSTGIS_LIB_VERSION" AC_DEFINE_UNQUOTED([POSTGIS_VERSION], ["$POSTGIS_VERSION"], [PostGIS version]) AC_DEFINE_UNQUOTED([POSTGIS_LIB_VERSION], ["$POSTGIS_LIB_VERSION"], [PostGIS library version]) diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c index 75d16ccdc..796675fc6 100644 --- a/postgis/lwgeom_functions_basic.c +++ b/postgis/lwgeom_functions_basic.c @@ -171,8 +171,13 @@ Datum postgis_lib_build_date(PG_FUNCTION_ARGS) PG_FUNCTION_INFO_V1(postgis_scripts_released); Datum postgis_scripts_released(PG_FUNCTION_ARGS) { - char *ver = POSTGIS_SCRIPTS_VERSION; - text *result = cstring2text(ver); + char ver[64]; + text *result; + + snprintf(ver, 64, "%s r%d", POSTGIS_LIB_VERSION, POSTGIS_SVN_REVISION); + ver[63] = '\0'; + + result = cstring2text(ver); PG_RETURN_TEXT_P(result); } diff --git a/postgis/postgis.sql.in.c b/postgis/postgis.sql.in.c index d48dbf8a9..9b8738093 100644 --- a/postgis/postgis.sql.in.c +++ b/postgis/postgis.sql.in.c @@ -2318,7 +2318,8 @@ CREATE OR REPLACE FUNCTION postgis_lib_version() RETURNS text AS 'MODULE_PATHNAME' LANGUAGE 'C' IMMUTABLE; -- a new lib will require a new session --- NOTE: starting at 1.1.0 this is the same of postgis_lib_version() +-- NOTE: from 1.1.0 to 1.5.x this was the same of postgis_lib_version() +-- NOTE: from 2.0.0 up it includes postgis_svn_revision() CREATE OR REPLACE FUNCTION postgis_scripts_released() RETURNS text AS 'MODULE_PATHNAME' LANGUAGE 'C' IMMUTABLE; diff --git a/postgis/sqldefines.h.in b/postgis/sqldefines.h.in index a2bb56b59..491bcc602 100644 --- a/postgis/sqldefines.h.in +++ b/postgis/sqldefines.h.in @@ -1,6 +1,8 @@ #ifndef _LWPGIS_DEFINES #define _LWPGIS_DEFINES +#include "../postgis_svn_revision.h" + /* * Define just the version numbers; otherwise we get some strange substitutions in postgis.sql.in */ @@ -17,7 +19,12 @@ */ #define _POSTGIS_SQL_SELECT_POSTGIS_VERSION 'SELECT ''@POSTGIS_VERSION@''::text AS version' #define _POSTGIS_SQL_SELECT_POSTGIS_BUILD_DATE 'SELECT ''@POSTGIS_BUILD_DATE@''::text AS version' -#define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION 'SELECT ''@POSTGIS_SCRIPTS_VERSION@''::text AS version' + +#if POSTGIS_SVN_REVISION +# define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '@POSTGIS_SCRIPTS_VERSION@'::text || ' r' || POSTGIS_SVN_REVISION::text AS version $$ +#else +# define _POSTGIS_SQL_SELECT_POSTGIS_SCRIPTS_VERSION $$ SELECT '@POSTGIS_SCRIPTS_VERSION@'::text AS version $$ +#endif #define SRID_USR_MAX @SRID_USR_MAX@