diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2000-07-02 15:21:27 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2000-07-02 15:21:27 +0000 |
commit | 6fb9d2e347b14445b85d6c97f7d16527d41ccce6 (patch) | |
tree | b75bd707655a8abeca16f69ed58f9391d5308c5c /src/bin | |
parent | 07dfe9773127d82a960101a5a18bd9393dff0d40 (diff) | |
download | postgresql-6fb9d2e347b14445b85d6c97f7d16527d41ccce6.tar.gz postgresql-6fb9d2e347b14445b85d6c97f7d16527d41ccce6.zip |
Version number now set in configure, available through Makefile.global
and config.h. Adjusted all referring code.
Scrapped pg_version and changed initdb accordingly. Integrated
src/utils/version.c into src/backend/utils/init/miscinit.c. Changed all
callers.
Set version number to `7.1devel'. (Non-numeric version suffixes now allowed.)
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/Makefile | 4 | ||||
-rw-r--r-- | src/bin/initdb/Makefile | 6 | ||||
-rw-r--r-- | src/bin/initdb/initdb.sh | 19 | ||||
-rw-r--r-- | src/bin/pg_dump/pg_dump.c | 20 | ||||
-rw-r--r-- | src/bin/pg_version/Makefile | 43 | ||||
-rw-r--r-- | src/bin/pg_version/pg_version.c | 46 | ||||
-rw-r--r-- | src/bin/psql/common.c | 3 | ||||
-rw-r--r-- | src/bin/psql/startup.c | 7 |
8 files changed, 35 insertions, 113 deletions
diff --git a/src/bin/Makefile b/src/bin/Makefile index 156a588fb1c..d3e1556b5db 100644 --- a/src/bin/Makefile +++ b/src/bin/Makefile @@ -4,7 +4,7 @@ # # Copyright (c) 1994, Regents of the University of California # -# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.27 2000/07/01 15:02:19 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.28 2000/07/02 15:20:56 petere Exp $ # #------------------------------------------------------------------------- @@ -13,7 +13,7 @@ top_builddir = ../.. include ../Makefile.global DIRS := initdb initlocation ipcclean pg_ctl pg_dump pg_id \ - pg_passwd pg_version psql scripts + pg_passwd psql scripts ifdef MULTIBYTE DIRS += pg_encoding diff --git a/src/bin/initdb/Makefile b/src/bin/initdb/Makefile index 0224abec6ec..850deb86b83 100644 --- a/src/bin/initdb/Makefile +++ b/src/bin/initdb/Makefile @@ -4,7 +4,7 @@ # # Copyright (c) 1994, Regents of the University of California # -# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.18 2000/06/27 00:30:53 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.19 2000/07/02 15:21:00 petere Exp $ # #------------------------------------------------------------------------- @@ -14,8 +14,8 @@ include ../../Makefile.global all: initdb -initdb: initdb.sh - sed -e 's/__MULTIBYTE__/$(MULTIBYTE)/g' < $< > $@ +initdb: initdb.sh ../../Makefile.global + sed -e 's/__MULTIBYTE__/$(MULTIBYTE)/g' -e 's/__VERSION__/$(VERSION)/g' < $< > $@ install: all installdirs $(INSTALL_SCRIPT) initdb $(bindir)/initdb diff --git a/src/bin/initdb/initdb.sh b/src/bin/initdb/initdb.sh index a83bb981246..25f55ef0838 100644 --- a/src/bin/initdb/initdb.sh +++ b/src/bin/initdb/initdb.sh @@ -26,7 +26,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.97 2000/06/22 22:31:22 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.98 2000/07/02 15:21:00 petere Exp $ # #------------------------------------------------------------------------- @@ -88,7 +88,7 @@ else fi # Check if needed programs actually exist in path -for prog in postgres pg_version pg_id +for prog in postgres pg_id do if [ ! -x "$PGPATH/$prog" ] then @@ -117,6 +117,13 @@ then exit 1 fi +# Replaced at build time +VERSION=__VERSION__ +short_version=`echo $VERSION | sed -e 's!^\([0-9][0-9]*\.[0-9][0-9]*\).*!\1!'` +if [ x"$short_version" = x"" ] ; then + echo "$CMDNAME: bug: version number is out of format" + exit 1 +fi # 0 is the default (non-)encoding MULTIBYTEID=0 @@ -144,6 +151,10 @@ do usage=t break ;; + --version) + echo "initdb (PostgreSQL) $VERSION" + exit 0 + ;; --debug|-d) debug=1 echo "Running with debug mode on." @@ -439,7 +450,7 @@ cat "$TEMPLATE" \ | "$PGPATH"/postgres $FIRSTRUN template1 \ || exit_nicely -"$PGPATH"/pg_version "$PGDATA"/base/template1 || exit_nicely +echo $short_version > "$PGDATA"/base/template1/PG_VERSION || exit_nicely #---------------------------------------------------------------------------- # Create the global classes, if requested. @@ -456,7 +467,7 @@ then | "$PGPATH"/postgres $BACKENDARGS template1 \ || exit_nicely - "$PGPATH"/pg_version "$PGDATA" || exit_nicely + echo $short_version > "$PGDATA/PG_VERSION" || exit_nicely cp "$PG_HBA_SAMPLE" "$PGDATA"/pg_hba.conf || exit_nicely cp "$POSTGRESQL_CONF_SAMPLE" "$PGDATA"/postgresql.conf || exit_nicely diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 603b0e62263..48b75e6447b 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -22,7 +22,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.152 2000/06/14 18:17:50 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.153 2000/07/02 15:21:05 petere Exp $ * * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb * @@ -70,7 +70,6 @@ #include "catalog/pg_language.h" #include "catalog/pg_trigger.h" #include "catalog/pg_type.h" -#include "version.h" #include "libpq-fe.h" #ifndef HAVE_STRDUP @@ -177,7 +176,7 @@ help(const char *progname) static void version(void) { - puts("pg_dump (PostgreSQL) " PG_RELEASE "." PG_VERSION "." PG_SUBVERSION); + puts("pg_dump (PostgreSQL) " PG_VERSION); puts("Portions Copyright (c) 1996-2000, PostgreSQL, Inc"); puts("Portions Copyright (C) 1996 Regents of the University of California"); puts("Read the file COPYRIGHT to see the usage and distribution terms."); @@ -541,10 +540,11 @@ static void check_database_version(bool ignoreVersion) { PGresult *res; - const char *dbversion; - const char *myversion = "PostgreSQL " PG_RELEASE "." PG_VERSION; - int myversionlen = strlen(myversion); + double myversion; + const char *remoteversion_str; + double remoteversion; + myversion = strtod(PG_VERSION, NULL); res = PQexec(g_conn, "SELECT version()"); if (!res || PQresultStatus(res) != PGRES_TUPLES_OK || @@ -553,11 +553,13 @@ check_database_version(bool ignoreVersion) fprintf(stderr, "check_database_version(): command failed. Explanation from backend: '%s'.\n", PQerrorMessage(g_conn)); exit_nicely(g_conn); } - dbversion = PQgetvalue(res, 0, 0); - if (strncmp(dbversion, myversion, myversionlen) != 0) + + remoteversion_str = PQgetvalue(res, 0, 0); + remoteversion = strtod(remoteversion_str + 11, NULL); + if (myversion != remoteversion) { fprintf(stderr, "Database version: %s\npg_dump version: %s\n", - dbversion, PG_RELEASE "." PG_VERSION); + remoteversion_str, PG_VERSION); if (ignoreVersion) fprintf(stderr, "Proceeding despite version mismatch.\n"); else diff --git a/src/bin/pg_version/Makefile b/src/bin/pg_version/Makefile deleted file mode 100644 index 373031fc9fb..00000000000 --- a/src/bin/pg_version/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------- -# -# Makefile for src/bin/pg_version -# -# Portions Copyright (c) 1996-2000, PostgreSQL, Inc -# Portions Copyright (c) 1994, Regents of the University of California -# -# $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/Makefile,v 1.7 2000/06/27 00:31:29 petere Exp $ -# -#------------------------------------------------------------------------- - -subdir = src/bin/pg_version -top_builddir = ../../.. -include ../../Makefile.global - -OBJS= pg_version.o $(top_builddir)/src/utils/version.o $(STRERROR2) - -all: pg_version$(X) - -pg_version$(X): $(OBJS) - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) - -$(top_builddir)/src/utils/version.o: $(top_srcdir)/src/utils/version.c $(top_builddir)/src/include/version.h - $(MAKE) -C $(top_builddir)/src/utils version.o - -install: all installdirs - $(INSTALL_PROGRAM) pg_version$(X) $(bindir)/pg_version$(X) - -installdirs: - $(mkinstalldirs) $(bindir) - -uninstall: - rm -f $(bindir)/pg_version$(X) - -depend dep: - $(CC) -MM $(CFLAGS) *.c >depend - -clean distclean maintainer-clean: - rm -f pg_version$(X) pg_version.o - -ifeq (depend,$(wildcard depend)) -include depend -endif diff --git a/src/bin/pg_version/pg_version.c b/src/bin/pg_version/pg_version.c deleted file mode 100644 index 91d1609531a..00000000000 --- a/src/bin/pg_version/pg_version.c +++ /dev/null @@ -1,46 +0,0 @@ -/*------------------------------------------------------------------------- - * - * pg_version.c - * - * - * Portions Copyright (c) 1996-2000, PostgreSQL, Inc - * Portions Copyright (c) 1994, Regents of the University of California - * - * - * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_version/Attic/pg_version.c,v 1.12 2000/01/26 05:57:40 momjian Exp $ - * - *------------------------------------------------------------------------- - */ -#include <stdlib.h> -#include <stdio.h> - -#include "version.h" /* interface to SetPgVersion */ - - - -int -main(int argc, char **argv) -{ - int retcode; /* our eventual return code */ - char *reason; /* Reason that SetPgVersion failed, NULL - * if it didn't. */ - - if (argc < 2) - { - fprintf(stderr, "pg_version: missing argument\n"); - exit(1); - } - SetPgVersion(argv[1], &reason); - if (reason) - { - fprintf(stderr, - "pg_version is unable to create the PG_VERSION file. " - "SetPgVersion gave this reason: %s\n", - reason); - retcode = 10; - } - else - retcode = 0; - return retcode; -} diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index d3551c5accc..4c802198a63 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.20 2000/04/12 17:16:22 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.21 2000/07/02 15:21:17 petere Exp $ */ #include "postgres.h" #include "common.h" @@ -28,7 +28,6 @@ #include "libpq-fe.h" #include "postgres_ext.h" #include "pqsignal.h" -#include "version.h" #include "settings.h" #include "variables.h" diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index 46c77ca3b23..88ef5865afd 100644 --- a/src/bin/psql/startup.c +++ b/src/bin/psql/startup.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.33 2000/05/14 18:05:05 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.34 2000/07/02 15:21:17 petere Exp $ */ #include "postgres.h" @@ -22,7 +22,6 @@ #endif #include "libpq-fe.h" -#include "version.h" #include "command.h" #include "common.h" @@ -580,7 +579,7 @@ process_psqlrc(void) exit(EXIT_FAILURE); } - sprintf(psqlrc, "%s/.psqlrc-" PG_RELEASE "." PG_VERSION "." PG_SUBVERSION, home); + sprintf(psqlrc, "%s/.psqlrc-" PG_VERSION, home); if (access(psqlrc, R_OK) == 0) process_file(psqlrc); else @@ -602,7 +601,7 @@ process_psqlrc(void) static void showVersion(void) { - puts("psql (PostgreSQL) " PG_RELEASE "." PG_VERSION "." PG_SUBVERSION); + puts("psql (PostgreSQL) " PG_VERSION); #if defined(USE_READLINE) || defined (USE_HISTORY) || defined(MULTIBYTE) fputs("contains ", stdout); |