提交 0de5fc63 编写于 作者: D Daniel Gustafsson

Ensure version output regardless of code tree

Rather than relying on always having a full cloned repository when
building, add fallbacks which work for trees with constrained (such
as shallow-cloned trees), or no, history. When the tagged commit is
reachable, use git describe, else rely on the version string in
configure since that's required to always be there regardless of
distribution mode. If we have git tree then include the HEAD sha1
as well.

While there, clean up versioning to more clearly separate us from
upstream.
上级 3ab8ef38
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for Greenplum Database 8.3.23.
# Generated by GNU Autoconf 2.69 for Greenplum Database 5.0.0-alpha.
#
# Report bugs to <support@greenplum.org>.
#
......@@ -582,8 +582,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='Greenplum Database'
PACKAGE_TARNAME='greenplum-database'
PACKAGE_VERSION='8.3.23'
PACKAGE_STRING='Greenplum Database 8.3.23'
PACKAGE_VERSION='5.0.0-alpha'
PACKAGE_STRING='Greenplum Database 5.0.0-alpha'
PACKAGE_BUGREPORT='support@greenplum.org'
PACKAGE_URL=''
......@@ -774,6 +774,7 @@ build_cpu
build
PG_MAJORVERSION
configure_args
PG_PACKAGE_VERSION
target_alias
host_alias
build_alias
......@@ -1426,7 +1427,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures Greenplum Database 8.3.23 to adapt to many kinds of systems.
\`configure' configures Greenplum Database 5.0.0-alpha to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1492,7 +1493,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of Greenplum Database 8.3.23:";;
short | recursive ) echo "Configuration of Greenplum Database 5.0.0-alpha:";;
esac
cat <<\_ACEOF
......@@ -1642,7 +1643,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
Greenplum Database configure 8.3.23
Greenplum Database configure 5.0.0-alpha
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -2391,7 +2392,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by Greenplum Database $as_me 8.3.23, which was
It was created by Greenplum Database $as_me 5.0.0-alpha, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -2739,6 +2740,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
PG_PACKAGE_VERSION=8.3.23
......@@ -2777,10 +2780,10 @@ configure_args=$ac_configure_args
cat >>confdefs.h <<_ACEOF
#define PG_VERSION "$PACKAGE_VERSION"
#define PG_VERSION "$PG_PACKAGE_VERSION"
_ACEOF
PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`
PG_MAJORVERSION=`expr "$PG_PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`
cat >>confdefs.h <<_ACEOF
......@@ -5458,7 +5461,7 @@ else
fi
cat >>confdefs.h <<_ACEOF
#define PG_VERSION_STR "PostgreSQL $PACKAGE_VERSION (Greenplum Database $GP_VERSION) on $host, compiled by $cc_string"
#define PG_VERSION_STR "PostgreSQL $PG_VERSION (Greenplum Database $GP_VERSION) on $host, compiled by $cc_string"
_ACEOF
......@@ -5468,12 +5471,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
if test "$GP_VERSION" = "devel" ; then
GP_VERSION="4.3.0"
fi
GP_MAJORVERSION=`expr "$GP_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`
GP_MAJORVERSION=`expr "$GP_VERSION" : '\([0-9][0-9]*\)'`
cat >>confdefs.h <<_ACEOF
......@@ -8329,7 +8327,7 @@ fi
# Supply a numeric version string for use by 3rd party add-ons
# awk -F is a regex on some platforms, and not on others, so make "." a tab
PG_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
PG_VERSION_NUM="`echo "$PG_PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
tr '.' ' ' |
$AWK '{printf "%d%02d%02d", $1, $2, (NF >= 3) ? $3 : 0}'`"
......@@ -8339,7 +8337,7 @@ _ACEOF
#
GP_VERSION_NUM="`echo "$GP_VERSION" | sed 's/[A-Za-z].*$//' |
GP_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
tr '.' ' ' |
$AWK '{printf "%d%02d%02d", $1, $2, (NF >= 3) ? $3 : 0}'`"
......@@ -17051,7 +17049,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by Greenplum Database $as_me 8.3.23, which was
This file was extended by Greenplum Database $as_me 5.0.0-alpha, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -17121,7 +17119,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
Greenplum Database config.status 8.3.23
Greenplum Database config.status 5.0.0-alpha
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
......@@ -17,7 +17,12 @@ dnl Read the Autoconf manual for details.
dnl
m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
AC_INIT([Greenplum Database], [8.3.23], [support@greenplum.org])
dnl The PACKAGE_VERSION from upstream PostgreSQL is maintained in the
dnl PG_PACKAGE_VERSION variable, when merging make sure to update this
dnl variable with the merge conflict from the AC_INIT() statement.
AC_INIT([Greenplum Database], [5.0.0-alpha], [support@greenplum.org])
[PG_PACKAGE_VERSION=8.3.23]
AC_SUBST(PG_PACKAGE_VERSION)
dnl m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.63], [], [m4_fatal([Autoconf version 2.63 is required.
dnl Untested combinations of 'autoconf' and PostgreSQL versions are not
......@@ -29,8 +34,8 @@ AC_CONFIG_AUX_DIR(config)
AC_PREFIX_DEFAULT(/usr/local/gpdb)
AC_SUBST(configure_args, [$ac_configure_args])
AC_DEFINE_UNQUOTED(PG_VERSION, "$PACKAGE_VERSION", [Postgres version Greenplum Database is based on])
[PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`]
AC_DEFINE_UNQUOTED(PG_VERSION, "$PG_PACKAGE_VERSION", [Postgres version Greenplum Database is based on])
[PG_MAJORVERSION=`expr "$PG_PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`]
AC_SUBST(PG_MAJORVERSION)
AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major version as a string])
......@@ -575,21 +580,14 @@ else
cc_string=$CC
fi
AC_DEFINE_UNQUOTED(PG_VERSION_STR,
["PostgreSQL $PACKAGE_VERSION (Greenplum Database $GP_VERSION) on $host, compiled by $cc_string"],
["PostgreSQL $PG_VERSION (Greenplum Database $GP_VERSION) on $host, compiled by $cc_string"],
[A string containing the version number, platform, and C compiler])
AC_DEFINE_UNQUOTED(GP_VERSION,
["$GP_VERSION"],
[A string containing the Greenplum version number])
dnl If we are a development build, fake a numeric version number
dnl this needs to be manually updated each time we branch a new version
if test "$GP_VERSION" = "devel" ; then
GP_VERSION="4.3.0"
fi
[GP_MAJORVERSION=`expr "$GP_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`]
[GP_MAJORVERSION=`expr "$GP_VERSION" : '\([0-9][0-9]*\)'`]
AC_SUBST(GP_MAJORVERSION)
AC_DEFINE_UNQUOTED(GP_MAJORVERSION, "$GP_MAJORVERSION", [Greenplum major version as a string])
......@@ -1089,13 +1087,13 @@ AC_SUBST(ADDON_DIR)
# Supply a numeric version string for use by 3rd party add-ons
# awk -F is a regex on some platforms, and not on others, so make "." a tab
[PG_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
[PG_VERSION_NUM="`echo "$PG_PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
tr '.' ' ' |
$AWK '{printf "%d%02d%02d", $1, $2, (NF >= 3) ? $3 : 0}'`"]
AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version as a number])
#
[GP_VERSION_NUM="`echo "$GP_VERSION" | sed 's/[A-Za-z].*$//' |
[GP_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
tr '.' ' ' |
$AWK '{printf "%d%02d%02d", $1, $2, (NF >= 3) ? $3 : 0}'`"]
AC_DEFINE_UNQUOTED(GP_VERSION_NUM, $GP_VERSION_NUM, [Greenplum version as a number])
......
......@@ -21,7 +21,7 @@ include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
majorversion=`echo $(VERSION) | sed -e 's/^\([0-9]*\)\.\([0-9]*\).*/\1\2/g'`
majorversion=`echo $(PG_VERSION) | sed -e 's/^\([0-9]*\)\.\([0-9]*\).*/\1\2/g'`
xlogdump_oid2name.o: oid2name.txt
......
#!/bin/bash
# Make sure we're running from the root git repository, not whatever submodule
# we could have been called from.
pushd $(dirname "$0") > /dev/null
VERSION=$(perl -e 'while(<>){print $1 if (/^PACKAGE_VERSION='\''(.+)'\''$/)}' < configure)
BUILDNUMBER=dev
# Call git describe, and convert it to a semi-semantic version, like
# 5.0.0-alpha.0+dev.52.g123abc
generate_dev_version() {
git describe | perl -pe 's/(.*)-([0-9]*)-(g[0-9a-f]*)/\1+dev.\2.\3/'
}
# Make sure we're running from the root git repository, not whatever submodule
# we could have been called from.
GP_VERSION=$(cd "$(dirname "$0")"; generate_dev_version)
# If we are in a Git repository and have git installed, build the version
# string using the latest tag in case it's reachable
if type git >/dev/null 2>&1 && [ -d '.git' ] ; then
GP_BUILDNUMBER=dev
if [ -f BUILD_NUMBER ] ; then
GP_BUILDNUMBER=`cat BUILD_NUMBER`
# Check for tag reachability, in case of shallow clones we might not
# be able to use git describe since the commit which was tagged is
# unreachable even if we have pulled the tags. If we can reach it,
# overwrite the VERSION from autoconf with the output, else append
# HEAD commit info
if git describe >/dev/null 2>&1 ; then
VERSION=$(generate_dev_version)
else
VERSION+=+
VERSION+=$(git rev-parse --short HEAD)
fi
fi
FLAG="${1:-noflag}"
if [ "$FLAG" = '--short' ] ; then
echo "${GP_VERSION}"
echo "${VERSION}"
else
echo "${GP_VERSION} build ${GP_BUILDNUMBER}"
if [ -f BUILD_NUMBER ] ; then
BUILDNUMBER=`cat BUILD_NUMBER`
fi
echo "${VERSION} build ${BUILDNUMBER}"
fi
popd > /dev/null
......@@ -32,10 +32,11 @@ all:
BLD_ARCH = @BLD_ARCH@
# PostgreSQL version number
VERSION = @PACKAGE_VERSION@
MAJORVERSION = @PG_MAJORVERSION@
PG_VERSION = @PG_PACKAGE_VERSION@
PG_MAJORVERSION = @PG_MAJORVERSION@
# GPDB version number
GP_VERSION = @PACKAGE_VERSION@
GP_MAJORVERSION = @GP_MAJORVERSION@
ADDON_DIR = @ADDON_DIR@
......
......@@ -89,7 +89,7 @@ postgres_bki_srcs: process_col_defaults.pl $(POSTGRES_BKI_SRCS)
cat $(POSTGRES_BKI_SRCS) $(top_srcdir)/src/include/catalog/catversion.h | $(PERL) process_foreign_keys.pl > 5.0.json
postgres.bki: genbki.sh postgres_bki_srcs $(top_srcdir)/src/include/pg_config_manual.h
AWK='$(AWK)' $(SHELL) $< $(pg_includes) --set-version=$(VERSION) -o postgres postgres_bki_srcs
AWK='$(AWK)' $(SHELL) $< $(pg_includes) --set-version=$(PG_VERSION) -o postgres postgres_bki_srcs
.PHONY: install-data
install-data: $(BKIFILES) installdirs
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册