Add citus_version(), analogous to PG's version()

This will provide the full project name (i.e. Citus/Citus Enterprise),
and the host system, compiler, and architecture word size.

I wanted to limit the number of copied files in 'config', so I added
only config.guess and call it manually, rather than using the macro
AC_CANONICAL_HOST, which requires several other files.
pull/1700/head
Jason Petersen 2017-10-12 10:49:26 -06:00
parent 339d0d6dc7
commit 8544878c4b
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
9 changed files with 2268 additions and 512 deletions

1460
config/config.guess vendored Normal file

File diff suppressed because it is too large Load Diff

1254
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -89,6 +89,23 @@ SAVE_CFLAGS="$CFLAGS"
AC_PROG_CC([$($PG_CONFIG --cc)]) AC_PROG_CC([$($PG_CONFIG --cc)])
CFLAGS="$SAVE_CFLAGS" CFLAGS="$SAVE_CFLAGS"
host_guess=`${SHELL} $srcdir/config/config.guess`
# Create compiler version string
if test x"$GCC" = x"yes" ; then
cc_string=`${CC} --version | sed q`
case $cc_string in [[A-Za-z]]*) ;; *) cc_string="GCC $cc_string";; esac
elif test x"$SUN_STUDIO_CC" = x"yes" ; then
cc_string=`${CC} -V 2>&1 | sed q`
else
cc_string=$CC
fi
AC_CHECK_SIZEOF([void *])
AC_DEFINE_UNQUOTED(CITUS_VERSION_STR,
["$PACKAGE_NAME $CITUS_VERSION on $host_guess, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"],
[A string containing the version number, platform, and C compiler])
# Locate source and build directory of the postgres we're building # Locate source and build directory of the postgres we're building
# against. Can't rely on either still being present, but e.g. optional # against. Can't rely on either still being present, but e.g. optional

View File

@ -12,7 +12,7 @@ EXTVERSIONS = 5.0 5.0-1 5.0-2 \
6.1-1 6.1-2 6.1-3 6.1-4 6.1-5 6.1-6 6.1-7 6.1-8 6.1-9 6.1-10 6.1-11 6.1-12 6.1-13 6.1-14 6.1-15 6.1-16 6.1-17 \ 6.1-1 6.1-2 6.1-3 6.1-4 6.1-5 6.1-6 6.1-7 6.1-8 6.1-9 6.1-10 6.1-11 6.1-12 6.1-13 6.1-14 6.1-15 6.1-16 6.1-17 \
6.2-1 6.2-2 6.2-3 6.2-4 \ 6.2-1 6.2-2 6.2-3 6.2-4 \
7.0-1 7.0-2 7.0-3 7.0-4 7.0-5 7.0-6 7.0-7 7.0-8 7.0-9 7.0-10 7.0-11 7.0-12 7.0-13 7.0-14 7.0-15 \ 7.0-1 7.0-2 7.0-3 7.0-4 7.0-5 7.0-6 7.0-7 7.0-8 7.0-9 7.0-10 7.0-11 7.0-12 7.0-13 7.0-14 7.0-15 \
7.1-1 7.1-1 7.1-2
# All citus--*.sql files in the source directory # All citus--*.sql files in the source directory
DATA = $(patsubst $(citus_abs_srcdir)/%.sql,%.sql,$(wildcard $(citus_abs_srcdir)/$(EXTENSION)--*--*.sql)) DATA = $(patsubst $(citus_abs_srcdir)/%.sql,%.sql,$(wildcard $(citus_abs_srcdir)/$(EXTENSION)--*--*.sql))
@ -172,6 +172,8 @@ $(EXTENSION)--7.0-15.sql: $(EXTENSION)--7.0-14.sql $(EXTENSION)--7.0-14--7.0-15.
cat $^ > $@ cat $^ > $@
$(EXTENSION)--7.1-1.sql: $(EXTENSION)--7.0-15.sql $(EXTENSION)--7.0-15--7.1-1.sql $(EXTENSION)--7.1-1.sql: $(EXTENSION)--7.0-15.sql $(EXTENSION)--7.0-15--7.1-1.sql
cat $^ > $@ cat $^ > $@
$(EXTENSION)--7.1-2.sql: $(EXTENSION)--7.1-1.sql $(EXTENSION)--7.1-1--7.1-2.sql
cat $^ > $@
NO_PGXS = 1 NO_PGXS = 1

View File

@ -0,0 +1,8 @@
/* citus--7.1-1--7.1-2 */
CREATE OR REPLACE FUNCTION pg_catalog.citus_version()
RETURNS text
LANGUAGE C STABLE STRICT
AS 'MODULE_PATHNAME', $$citus_version$$;
COMMENT ON FUNCTION pg_catalog.citus_version()
IS 'Citus version string';

View File

@ -1,6 +1,6 @@
# Citus extension # Citus extension
comment = 'Citus distributed database' comment = 'Citus distributed database'
default_version = '7.1-1' default_version = '7.1-2'
module_pathname = '$libdir/citus' module_pathname = '$libdir/citus'
relocatable = false relocatable = false
schema = pg_catalog schema = pg_catalog

View File

@ -0,0 +1,26 @@
/*-------------------------------------------------------------------------
*
* citus_version.c
*
* This file contains functions for displaying the Citus version string
*
* Copyright (c) 2017, Citus Data, Inc.
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "citus_version.h"
#include "utils/builtins.h"
/* exports for SQL callable functions */
PG_FUNCTION_INFO_V1(citus_version);
Datum
citus_version(PG_FUNCTION_ARGS)
{
PG_RETURN_TEXT_P(cstring_to_text(CITUS_VERSION_STR));
}

View File

@ -22,6 +22,9 @@
/* Citus version as a number */ /* Citus version as a number */
#undef CITUS_VERSION_NUM #undef CITUS_VERSION_NUM
/* A string containing the version number, platform, and C compiler */
#undef CITUS_VERSION_STR
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
@ -70,5 +73,8 @@
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
/* Define to 1 if you have the ANSI C header files. */ /* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS #undef STDC_HEADERS

View File

@ -12,5 +12,8 @@
/* Citus version as a number */ /* Citus version as a number */
#undef CITUS_VERSION_NUM #undef CITUS_VERSION_NUM
/* A string containing the version number, platform, and C compiler */
#undef CITUS_VERSION_STR
/* Define to 1 if you have the `curl' library (-lcurl). */ /* Define to 1 if you have the `curl' library (-lcurl). */
#undef HAVE_LIBCURL #undef HAVE_LIBCURL