Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6fb9d2e

Browse files
committed
Version number now set in configure, available through Makefile.global
and config.h. Adjusted all referring code.Scrapped pg_version and changed initdb accordingly. Integratedsrc/utils/version.c into src/backend/utils/init/miscinit.c. Changed allcallers.Set version number to `7.1devel'. (Non-numeric version suffixes now allowed.)
1 parent07dfe97 commit6fb9d2e

File tree

23 files changed

+629
-859
lines changed

23 files changed

+629
-859
lines changed

‎configure

Lines changed: 481 additions & 473 deletions
Large diffs are not rendered by default.

‎configure.in

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ AC_CONFIG_HEADER(src/include/config.h)
66
AC_PREREQ(2.13)
77
AC_CONFIG_AUX_DIR(`pwd`/config)
88

9+
VERSION='7.1devel'
10+
AC_SUBST(VERSION)
11+
AC_DEFINE_UNQUOTED(PG_VERSION, "$VERSION")
12+
913
mkinstalldirs="\$(SHELL) \$(top_srcdir)/config/mkinstalldirs"
1014
AC_SUBST(mkinstalldirs)
1115

@@ -309,13 +313,13 @@ AC_PROG_CPP
309313
AC_PROG_GCC_TRADITIONAL
310314
AC_SUBST(GCC)
311315

312-
if test "$CC" = "gcc"
313-
then
314-
CC_VERSION=`${CC} --version`
316+
if test x"$GCC" = x"yes" ; then
317+
cc_string="GCC `${CC} --version`"
315318
else
316-
CC_VERSION=""
319+
cc_string=$CC
317320
fi
318-
AC_SUBST(CC_VERSION)
321+
AC_DEFINE_UNQUOTED(PG_VERSION_STR, ["PostgreSQL $VERSION on $host, compiled by $cc_string"], [A canonical string containing the version number, platform, and C compiler])
322+
319323

320324

321325
dnl We exclude tcl support unless user says --with-tcl
@@ -1198,6 +1202,5 @@ AC_OUTPUT(
11981202
src/Makefile.global
11991203
src/backend/port/Makefile
12001204
src/backend/catalog/genbki.sh
1201-
src/include/version.h
12021205
src/test/regress/GNUmakefile
12031206
)

‎src/GNUmakefile.in

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/Attic/GNUmakefile.in,v 1.55 2000/07/01 21:16:42 petere Exp $
10+
# $Header: /cvsroot/pgsql/src/Attic/GNUmakefile.in,v 1.56 2000/07/02 15:20:41 petere Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

@@ -24,14 +24,12 @@ ETAGS = @etags@
2424
XARGS = @xargs@
2525

2626
all:
27-
$(MAKE) -C utils all
2827
$(MAKE) -C backend all
2928
$(MAKE) -C interfaces all
3029
$(MAKE) -C bin all
3130
$(MAKE) -C pl all
3231

3332
install: installdirs
34-
$(MAKE) -C utils install
3533
$(MAKE) -C backend install
3634
$(MAKE) -C interfaces install
3735
$(MAKE) -C bin install

‎src/Makefile.global.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.84 2000/07/01 21:16:42 petere Exp $
10+
# $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.85 2000/07/02 15:20:41 petere Exp $
1111
#
1212
# NOTES
1313
# Essentially all Postgres make files include this file and use the
@@ -35,6 +35,9 @@
3535
#
3636
#-------------------------------------------------------------------------
3737

38+
# PostgreSQL version number
39+
VERSION = @VERSION@
40+
3841
ifndef SRCDIR
3942
# This should be changed once we have separate build dirs.
4043
top_srcdir = $(top_builddir)

‎src/backend/Makefile

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#
3535
#
3636
# IDENTIFICATION
37-
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.56 2000/06/28 03:30:57 tgl Exp $
37+
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.57 2000/07/02 15:20:44 petere Exp $
3838
#
3939
#-------------------------------------------------------------------------
4040

@@ -57,10 +57,8 @@ ifeq ($(PORTNAME), qnx4)
5757
OBJS+= bootstrap/bootstrap.o
5858
endif
5959

60-
VERSIONOBJ =$(SRCDIR)/utils/version.o
61-
6260
ifeq ($(MAKE_DLL), true)
63-
DLLOBJS=$(OBJS)$(VERSIONOBJ)
61+
DLLOBJS=$(OBJS)
6462
DLLLIBS= -L/usr/local/lib -lcygipc -lcrypt -lcygwin -lkernel32
6563

6664
postgres.def:$(DLLOBJS)
@@ -74,8 +72,8 @@ all: prebuildheaders postgres $(POSTGRES_IMP)
7472

7573
ifneq ($(PORTNAME), win)
7674

77-
postgres:$(OBJS)$(VERSIONOBJ)
78-
$(CC)$(CFLAGS) -o postgres$(OBJS)$(VERSIONOBJ)$(LDFLAGS)
75+
postgres:$(OBJS)
76+
$(CC)$(CFLAGS) -o postgres$(OBJS)$(LDFLAGS)
7977

8078
else
8179

@@ -93,9 +91,6 @@ $(OBJS): $(DIRS:%=%.dir)
9391
$(DIRS:%=%.dir):
9492
$(MAKE) -C $(subst .dir,,$@) all
9593

96-
$(VERSIONOBJ):$(SRCDIR)/utils/version.c$(SRCDIR)/include/version.h
97-
$(MAKE) -C$(SRCDIR)/utils version.o
98-
9994
$(SRCDIR)/utils/dllinit.o:$(SRCDIR)/utils/dllinit.c
10095
$(MAKE) -C$(SRCDIR)/utils dllinit.o
10196

‎src/backend/postmaster/postmaster.c

Lines changed: 22 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.150 2000/06/28 03:31:52 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.151 2000/07/02 15:20:48 petere Exp $
1515
*
1616
* NOTES
1717
*
@@ -84,7 +84,6 @@
8484
#include"access/xlog.h"
8585
#include"tcop/tcopprot.h"
8686
#include"utils/guc.h"
87-
#include"version.h"
8887

8988
/*
9089
* "postmaster.opts" is a file containing options for postmaser.
@@ -300,68 +299,47 @@ intassert_enabled = 1;
300299
#endif
301300

302301
staticvoid
303-
checkDataDir(constchar*DataDir,bool*DataDirOK)
302+
checkDataDir(constchar*DataDir)
304303
{
304+
charpath[MAXPGPATH];
305+
FILE*fp;
306+
305307
if (DataDir==NULL)
306308
{
307309
fprintf(stderr,"%s does not know where to find the database system "
308310
"data. You must specify the directory that contains the "
309311
"database system either by specifying the -D invocation "
310312
"option or by setting the PGDATA environment variable.\n\n",
311313
progname);
312-
*DataDirOK= false;
314+
exit(2);
313315
}
314-
else
315-
{
316-
charpath[MAXPGPATH];
317-
FILE*fp;
318316

319-
snprintf(path,sizeof(path),"%s%cbase%ctemplate1%cpg_class",
320-
DataDir,SEP_CHAR,SEP_CHAR,SEP_CHAR);
321-
fp=AllocateFile(path,PG_BINARY_R);
322-
if (fp==NULL)
323-
{
324-
fprintf(stderr,"%s does not find the database system. "
325-
"Expected to find it "
326-
"in the PGDATA directory \"%s\", but unable to open file "
327-
"with pathname \"%s\".\n\n",
328-
progname,DataDir,path);
329-
*DataDirOK= false;
330-
}
331-
else
332-
{
333-
char*reason;
317+
snprintf(path,sizeof(path),"%s%cbase%ctemplate1%cpg_class",
318+
DataDir,SEP_CHAR,SEP_CHAR,SEP_CHAR);
334319

335-
/* reason ValidatePgVersion failed. NULL if didn't */
320+
fp=AllocateFile(path,PG_BINARY_R);
321+
if (fp==NULL)
322+
{
323+
fprintf(stderr,"%s does not find the database system. "
324+
"Expected to find it "
325+
"in the PGDATA directory \"%s\", but unable to open file "
326+
"with pathname \"%s\".\n\n",
327+
progname,DataDir,path);
328+
exit(2);
329+
}
336330

337-
FreeFile(fp);
331+
FreeFile(fp);
338332

339-
ValidatePgVersion(DataDir,&reason);
340-
if (reason)
341-
{
342-
fprintf(stderr,
343-
"Database system in directory %s "
344-
"is not compatible with this version of "
345-
"Postgres, or we are unable to read the "
346-
"PG_VERSION file. "
347-
"Explanation from ValidatePgVersion: %s\n\n",
348-
DataDir,reason);
349-
free(reason);
350-
*DataDirOK= false;
351-
}
352-
else
353-
*DataDirOK= true;
354-
}
355-
}
333+
ValidatePgVersion(DataDir);
356334
}
357335

336+
358337
int
359338
PostmasterMain(intargc,char*argv[])
360339
{
361340
intopt;
362341
intstatus;
363342
intsilentflag=0;
364-
boolDataDirOK;/* We have a usable PGDATA value */
365343
charoriginal_extraoptions[MAXPGPATH];
366344

367345
IsUnderPostmaster= true;/* so that backends know this */
@@ -435,12 +413,7 @@ PostmasterMain(int argc, char *argv[])
435413
}
436414

437415
optind=1;/* start over */
438-
checkDataDir(DataDir,&DataDirOK);/* issues error messages */
439-
if (!DataDirOK)
440-
{
441-
fprintf(stderr,"No data directory -- can't proceed.\n");
442-
exit(2);
443-
}
416+
checkDataDir(DataDir);/* issues error messages */
444417

445418
ProcessConfigFile(PGC_POSTMASTER);
446419

‎src/backend/utils/adt/version.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
*
66
* IDENTIFICATION
77
*
8-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/version.c,v 1.9 1999/07/1720:18:00 momjian Exp $
8+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/version.c,v 1.10 2000/07/02 15:20:51 petere Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
1212

1313

1414
#include"postgres.h"
15-
#include"version.h"
1615

1716

1817
text*version(void);

‎src/backend/utils/init/miscinit.c

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.50 2000/06/14 18:17:46 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.51 2000/07/02 15:20:56 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -24,6 +24,7 @@
2424
#include<grp.h>
2525
#include<pwd.h>
2626
#include<stdlib.h>
27+
#include<errno.h>
2728

2829
#include"catalog/catname.h"
2930
#include"catalog/pg_shadow.h"
@@ -520,3 +521,51 @@ SetPidFile(pid_t pid)
520521

521522
return (0);
522523
}
524+
525+
526+
527+
/*
528+
* Determine whether the PG_VERSION file in directory `path' indicates
529+
* a data version compatible with the version of this program.
530+
*
531+
* If compatible, return. Otherwise, elog(FATAL).
532+
*/
533+
void
534+
ValidatePgVersion(constchar*path)
535+
{
536+
charfull_path[MAXPGPATH];
537+
FILE*file;
538+
intret;
539+
longfile_major,file_minor;
540+
longmy_major=0,my_minor=0;
541+
char*endptr;
542+
constchar*version_string=PG_VERSION;
543+
544+
my_major=strtol(version_string,&endptr,10);
545+
if (*endptr=='.')
546+
my_minor=strtol(endptr+1,NULL,10);
547+
548+
snprintf(full_path,MAXPGPATH,"%s/PG_VERSION",path);
549+
550+
file=AllocateFile(full_path,"r");
551+
if (!file)
552+
{
553+
if (errno==ENOENT)
554+
elog(FATAL,"File %s is missing. This is not a valid data directory.",full_path);
555+
else
556+
elog(FATAL,"cannot open %s: %s",full_path,strerror(errno));
557+
}
558+
559+
ret=fscanf(file,"%ld.%ld",&file_major,&file_minor);
560+
if (ret==EOF)
561+
elog(FATAL,"cannot read %s: %s",full_path,strerror(errno));
562+
elseif (ret!=2)
563+
elog(FATAL,"`%s' does not have a valid format. You need to initdb.",full_path);
564+
565+
FreeFile(file);
566+
567+
if (my_major!=file_major||my_minor!=file_minor)
568+
elog(FATAL,"The data directory was initalized by PostgreSQL version %ld.%ld, "
569+
"which is not compatible with this verion %s.",
570+
file_major,file_minor,version_string);
571+
}

‎src/backend/utils/init/postinit.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.60 2000/06/28 03:32:43 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.61 2000/07/02 15:20:56 petere Exp $
1212
*
1313
*
1414
*-------------------------------------------------------------------------
@@ -34,7 +34,6 @@
3434
#include"utils/portal.h"
3535
#include"utils/relcache.h"
3636
#include"utils/syscache.h"
37-
#include"version.h"
3837

3938
#ifdefMULTIBYTE
4039
#include"mb/pg_wchar.h"
@@ -267,9 +266,7 @@ InitPostgres(const char *dbname)
267266
elog(FATAL,"Database system not found. Data directory '%s' does not exist.",
268267
DataDir);
269268

270-
ValidatePgVersion(DataDir,&reason);
271-
if (reason!=NULL)
272-
elog(FATAL,reason);
269+
ValidatePgVersion(DataDir);
273270

274271
/*-----------------
275272
* Find oid and path of the database we're about to open. Since we're
@@ -300,9 +297,7 @@ InitPostgres(const char *dbname)
300297
elog(FATAL,"Database \"%s\" does not exist. The data directory '%s' is missing.",
301298
dbname,fullpath);
302299

303-
ValidatePgVersion(fullpath,&reason);
304-
if (reason!=NULL)
305-
elog(FATAL,"%s",reason);
300+
ValidatePgVersion(fullpath);
306301

307302
if (chdir(fullpath)==-1)
308303
elog(FATAL,"Unable to change directory to '%s': %s",fullpath,strerror(errno));

‎src/bin/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.27 2000/07/01 15:02:19 petere Exp $
7+
# $Header: /cvsroot/pgsql/src/bin/Makefile,v 1.28 2000/07/02 15:20:56 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -13,7 +13,7 @@ top_builddir = ../..
1313
include ../Makefile.global
1414

1515
DIRS := initdb initlocation ipcclean pg_ctl pg_dump pg_id\
16-
pg_passwdpg_versionpsql scripts
16+
pg_passwd psql scripts
1717

1818
ifdefMULTIBYTE
1919
DIRS += pg_encoding

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp