Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 May 2006 12:13:58 +0800 (CST)
From:      Xin LI <delphij@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        girgen@FreeBSD.org
Subject:   ports/97767: [PATCH] Some improvements over postgresql81-server
Message-ID:  <200605240413.k4O4DwK3091059@tarsier.delphij.net>
Resent-Message-ID: <200605240420.k4O4KBXs011281@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         97767
>Category:       ports
>Synopsis:       [PATCH] Some improvements over postgresql81-server
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 24 04:20:11 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Xin LI
>Release:        FreeBSD 6.1-RELEASE i386
>Organization:
The FreeBSD Project
>Environment:
System: FreeBSD tarsier.delphij.net 6.1-RELEASE FreeBSD 6.1-RELEASE #31: Sun May 7 00:55:05 CST 2006 delphij@tarsier.delphij.net:/usr/obj/usr/src/sys/TARSIER i386


>Description:
	The attached patch fixes some issues involved in the
postgresql81-server port:

	- Make use of USE_RC_SUBR instead of doing the sed
	  work with our own one.  This makes it possible
	  to install new style rc.d scripts more properly.
	- Use the port infrastructure to do pkg-message
	  stuff.
	- Pet portlint 

	These are not urgent changes.  Similiar changes
may apply to previous versions of postgresql ports as
well.

	Maintainer cc'ed.
>How-To-Repeat:
>Fix:


--- patch-postgresql81-server begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/databases/postgresql81-server/Makefile,v
retrieving revision 1.155
diff -u -r1.155 Makefile
--- Makefile	23 May 2006 21:18:58 -0000	1.155
+++ Makefile	24 May 2006 04:01:18 -0000
@@ -6,12 +6,12 @@
 #
 
 PORTNAME?=	postgresql
-PKGNAMESUFFIX?=	-server
 PORTVERSION?=	8.1.4
-PORTREVISION?=	0
+PORTREVISION?=	1
 CATEGORIES?=	databases
 MASTER_SITES=	${MASTER_SITE_PGSQL}
 MASTER_SITE_SUBDIR=	source/v${PORTVERSION}
+PKGNAMESUFFIX?=	-server
 DISTFILES?=	postgresql-base-${PORTVERSION}${EXTRACT_SUFX} \
 		postgresql-opt-${PORTVERSION}${EXTRACT_SUFX}
 
@@ -48,12 +48,10 @@
 BUILD_DIRS?=	src/port src/timezone src/backend src/backend/utils/mb/conversion_procs \
 		src/pl src/utils
 INSTALL_DIRS?=	${BUILD_DIRS}
-PKGMESSAGE=	${WRKDIR}/.pkg-message${PKGNAMESUFFIX}
 
 .if !defined(CLIENT_ONLY) && !defined(SLAVE_ONLY)
 SERVER_ONLY=	yes
-USE_RC_SUBR=	yes
-RCSCRIPT=	${PREFIX}/etc/rc.d/010.pgsql.sh
+USE_RC_SUBR=	pgsql.sh
 USE_PGSQL=	yes
 WANT_PGSQL_VER=	${PORTVERSION:C/([0-9][0-9]*)\.([0-9][0-9]*).*/\1\2/g}
 .endif
@@ -75,7 +73,7 @@
 .include <bsd.port.pre.mk>
 
 .if ${ARCH} == "alpha" && ${OSVERSION} < 500000
-BROKEN=		"Coredump during build on alpha 4.x"
+BROKEN=		Coredump during build on alpha 4.x
 .endif
 
 .if !defined(SLAVE_ONLY)
@@ -259,11 +257,9 @@
 		cd ${WRKSRC}/$${dir} && ${SETENV} ${MAKE_ENV} ${GMAKE}; \
 	done
 
-.  if exists(${MASTERDIR}/pkg-message${PKGNAMESUFFIX})
-post-build:
-	@ ${SED} "s|/usr/local|${PREFIX}|g" \
-		< ${MASTERDIR}/pkg-message${PKGNAMESUFFIX} \
-		> ${PKGMESSAGE}
+.  if exists(${MASTERDIR}/files/pkg-message${PKGNAMESUFFIX}.in)
+SUB_FILES+=	pkg-message${PKGNAMESUFFIX}
+PKGMESSAGE=	${WRKSRC}/pkg-message${PKGNAMESUFFIX}
 .  endif
 .endif
 
@@ -290,11 +286,6 @@
 		${CP} ${PREFIX}/share/postgresql/dot.$i.dist ~pgsql/.$i; \
 	fi
 .    endfor
-	@ ${SED} -e "s|%%PREFIX%%|${PREFIX}|g; s|%%RC_SUBR%%|${RC_SUBR}|g" \
-		< ${FILESDIR}/pgsql.sh.tmpl \
-		> ${RCSCRIPT} ;\
-	${CHMOD} 554 ${RCSCRIPT} ;\
-	${CHOWN} root:pgsql ${RCSCRIPT} ;\
 	${CHOWN} -R pgsql:pgsql ~pgsql/. ;\
 	${MKDIR} ${PREFIX}/etc/periodic/daily ;\
 	${INSTALL_SCRIPT} ${FILESDIR}/502.pgsql \
Index: pkg-message-client
===================================================================
RCS file: pkg-message-client
diff -N pkg-message-client
--- pkg-message-client	23 Nov 2004 19:15:11 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-The PostgreSQL port has a collection of "side orders":
-
-postgresql-doc
-  For all of the html documentation
-
-p5-Pg
-  A perl5 API for client access to PostgreSQL databases.
-
-postgresql-tcltk 
-  If you want tcl/tk client support.
-
-postgresql-jdbc
-  For Java JDBC support.
-
-postgresql-odbc
-  For client access from unix applications using ODBC as access
-  method. Not needed to access unix PostgreSQL servers from Win32
-  using ODBC. See below.
-
-ruby-postgres, py-PyGreSQL
-  For client access to PostgreSQL databases using the ruby & python
-  languages.
-
-p5-postgresql-plperl, postgresql-pltcl & postgresql-plruby
-  For using perl5, tcl & ruby as procedural languages.
-
-postgresql-contrib
-  Lots of contributed utilities, postgresql functions and
-  datatypes. There you find autovacuum, pgcrypto and many other cool
-  things.
-
-etc...
Index: pkg-message-contrib
===================================================================
RCS file: pkg-message-contrib
diff -N pkg-message-contrib
--- pkg-message-contrib	23 Nov 2004 19:15:11 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
-The PostgreSQL contrib utilities have been installed. Please see
-/usr/local/share/doc/postgresql/contrib/README
-for more information.
Index: pkg-message-plperl
===================================================================
RCS file: pkg-message-plperl
diff -N pkg-message-plperl
--- pkg-message-plperl	23 Nov 2004 19:15:11 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
-PL/Perl has been installed. Check the createlang(l) manpage for more
-info. You can install PL/Perl as trusted or untrusted, by using either
-"createlang plperl" or "createlang plperlu".
Index: pkg-message-plpython
===================================================================
RCS file: pkg-message-plpython
diff -N pkg-message-plpython
--- pkg-message-plpython	31 Jan 2005 00:36:16 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
-PL/Python has been installed. Check the createlang(l) manpage for more
-info. You can install PL/Python by using "createlang plpythonu" (it
-exists as an untrusted language only).
Index: pkg-message-pltcl
===================================================================
RCS file: pkg-message-pltcl
diff -N pkg-message-pltcl
--- pkg-message-pltcl	23 Nov 2004 19:15:11 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,3 +0,0 @@
-PL/Tcl has been  installed. Check the createlang(l) manpage for more
-info. You can install pltcl as trusted or untrusted, by using either
-"createlang pltcl" or "createlang pltclu".
Index: pkg-message-server
===================================================================
RCS file: pkg-message-server
diff -N pkg-message-server
--- pkg-message-server	9 Feb 2005 17:48:10 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,49 +0,0 @@
-For procedural languages and postgresql functions, please note that
-you might have to update them when updating the server.
-
-If you have many tables and many clients running, consider raising
-kern.maxfiles using sysctl(8), or reconfigure your kernel
-appropriately.
-
-You should vacuum and backup your database regularly. There is a
-periodic script, ${LOCALBASE}/etc/periodic/daily/502.pgsql, that you
-may find useful. Per default, it perfoms vacuum on all databases
-nightly. See the script for instructions.
-
-To allow many simultaneous connections to your PostgreSQL server, you
-should raise the SystemV shared memory limits in your kernel. Here are
-example values for allowing up to 180 clients (configurations in
-postgresql.conf also needed, of course):
-  options         SYSVSHM
-  options         SYSVSEM
-  options         SYSVMSG
-  options         SHMMAXPGS=65536
-  options         SEMMNI=40
-  options         SEMMNS=240
-  options         SEMUME=40
-  options         SEMMNU=120
-
-If you plan to access your PostgreSQL server using ODBC, please
-consider running the SQL script /usr/local/share/postgresql/odbc.sql
-to get the functions required for ODBC compliance.
-
-======================================================================
-
-To initialize the database, run
-
-  /usr/local/etc/rc.d/010.pgsql.sh initdb
-
-You can then start PostgreSQL by running:
-
-  /usr/local/etc/rc.d/010.pgsql.sh start
-
-For postmaster settings, see ~pgsql/data/postgresql.conf
-
-NB. FreeBSD's PostgreSQL port now by default logs to syslog
-    See ~pgsql/data/postgresql.conf for more info
-
-======================================================================
-
-To run PostgreSQL at startup, add
-'postgresql_enable="YES"' to /etc/rc.conf
-
Index: pkg-plist-server
===================================================================
RCS file: /home/ncvs/ports/databases/postgresql81-server/pkg-plist-server,v
retrieving revision 1.6
diff -u -r1.6 pkg-plist-server
--- pkg-plist-server	22 Jan 2006 05:52:11 -0000	1.6
+++ pkg-plist-server	24 May 2006 03:33:52 -0000
@@ -1,7 +1,6 @@
 bin/postmaster
 bin/postgres
 etc/periodic/daily/502.pgsql
-etc/rc.d/010.pgsql.sh
 lib/libpgport.a
 lib/postgresql/ascii_and_mic.so
 lib/postgresql/cyrillic_and_mic.so
Index: files/pgsql.sh.in
===================================================================
RCS file: files/pgsql.sh.in
diff -N files/pgsql.sh.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pgsql.sh.in	24 May 2006 03:21:53 -0000
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# PROVIDE: postgresql
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following line to /etc/rc.conf to enable PostgreSQL:
+#
+#  postgresql_enable="YES"
+#  # optional
+#  postgresql_data="%%PREFIX%%/pgsql/data"
+#  postgresql_flags="-w -s -m fast"
+#
+# This scripts takes one of the following commands:
+#
+#   start stop restart reload status initdb
+#
+# For postmaster startup options, edit ${postgresql_data}/postgresql.conf
+
+prefix=%%PREFIX%%
+command=${prefix}/bin/pg_ctl
+
+. %%RC_SUBR%%
+
+load_rc_config postgresql
+
+# set defaults
+postgresql_enable=${postgresql_enable:-"NO"}
+postgresql_flags=${postgresql_flags:-"-w -s -m fast"}
+postgresql_user=pgsql
+eval postgresql_data=${postgresql_data:-"~${postgresql_user}/data"}
+postgresql_class=${postgresql_class:-"default"}
+
+name=postgresql
+rcvar=`set_rcvar`
+command_args="-D ${postgresql_data} ${postgresql_flags}"
+extra_commands="reload initdb"
+
+start_cmd="postgresql_command start"
+stop_cmd="postgresql_command stop"
+restart_cmd="postgresql_command restart"
+reload_cmd="postgresql_command reload"
+status_cmd="postgresql_command status"
+
+initdb_cmd="postgresql_initdb"
+
+postgresql_command()
+{
+    su -l ${postgresql_user} -c "exec ${command} ${command_args} ${rc_arg}"
+}
+    
+postgresql_initdb()
+{
+    su -l -c ${postgresql_class} ${postgresql_user} -c "exec ${prefix}/bin/initdb -D ${postgresql_data}"
+}
+
+run_rc_command "$1"
Index: files/pgsql.sh.tmpl
===================================================================
RCS file: files/pgsql.sh.tmpl
diff -N files/pgsql.sh.tmpl
--- files/pgsql.sh.tmpl	23 May 2006 21:18:58 -0000	1.22
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,59 +0,0 @@
-#!/bin/sh
-
-# $FreeBSD: ports/databases/postgresql81-server/files/pgsql.sh.tmpl,v 1.22 2006/05/23 21:18:58 girgen Exp $
-#
-# PROVIDE: postgresql
-# REQUIRE: LOGIN
-# KEYWORD: shutdown
-#
-# Add the following line to /etc/rc.conf to enable PostgreSQL:
-#
-#  postgresql_enable="YES"
-#  # optional
-#  postgresql_data="%%PREFIX%%/pgsql/data"
-#  postgresql_flags="-w -s -m fast"
-#
-# This scripts takes one of the following commands:
-#
-#   start stop restart reload status initdb
-#
-# For postmaster startup options, edit ${postgresql_data}/postgresql.conf
-
-prefix=%%PREFIX%%
-command=${prefix}/bin/pg_ctl
-
-. %%RC_SUBR%%
-
-load_rc_config postgresql
-
-# set defaults
-postgresql_enable=${postgresql_enable:-"NO"}
-postgresql_flags=${postgresql_flags:-"-w -s -m fast"}
-postgresql_user=pgsql
-eval postgresql_data=${postgresql_data:-"~${postgresql_user}/data"}
-postgresql_class=${postgresql_class:-"default"}
-
-name=postgresql
-rcvar=`set_rcvar`
-command_args="-D ${postgresql_data} ${postgresql_flags}"
-extra_commands="reload initdb"
-
-start_cmd="postgresql_command start"
-stop_cmd="postgresql_command stop"
-restart_cmd="postgresql_command restart"
-reload_cmd="postgresql_command reload"
-status_cmd="postgresql_command status"
-
-initdb_cmd="postgresql_initdb"
-
-postgresql_command()
-{
-    su -l ${postgresql_user} -c "exec ${command} ${command_args} ${rc_arg}"
-}
-    
-postgresql_initdb()
-{
-    su -l -c ${postgresql_class} ${postgresql_user} -c "exec ${prefix}/bin/initdb -D ${postgresql_data}"
-}
-
-run_rc_command "$1"
Index: files/pkg-message-client.in
===================================================================
RCS file: files/pkg-message-client.in
diff -N files/pkg-message-client.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pkg-message-client.in	23 Nov 2004 19:15:11 -0000
@@ -0,0 +1,32 @@
+The PostgreSQL port has a collection of "side orders":
+
+postgresql-doc
+  For all of the html documentation
+
+p5-Pg
+  A perl5 API for client access to PostgreSQL databases.
+
+postgresql-tcltk 
+  If you want tcl/tk client support.
+
+postgresql-jdbc
+  For Java JDBC support.
+
+postgresql-odbc
+  For client access from unix applications using ODBC as access
+  method. Not needed to access unix PostgreSQL servers from Win32
+  using ODBC. See below.
+
+ruby-postgres, py-PyGreSQL
+  For client access to PostgreSQL databases using the ruby & python
+  languages.
+
+p5-postgresql-plperl, postgresql-pltcl & postgresql-plruby
+  For using perl5, tcl & ruby as procedural languages.
+
+postgresql-contrib
+  Lots of contributed utilities, postgresql functions and
+  datatypes. There you find autovacuum, pgcrypto and many other cool
+  things.
+
+etc...
Index: files/pkg-message-contrib.in
===================================================================
RCS file: files/pkg-message-contrib.in
diff -N files/pkg-message-contrib.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pkg-message-contrib.in	24 May 2006 03:44:05 -0000
@@ -0,0 +1,3 @@
+The PostgreSQL contrib utilities have been installed. Please see
+%%PREFIX%%/share/doc/postgresql/contrib/README
+for more information.
Index: files/pkg-message-plperl.in
===================================================================
RCS file: files/pkg-message-plperl.in
diff -N files/pkg-message-plperl.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pkg-message-plperl.in	23 Nov 2004 19:15:11 -0000
@@ -0,0 +1,3 @@
+PL/Perl has been installed. Check the createlang(l) manpage for more
+info. You can install PL/Perl as trusted or untrusted, by using either
+"createlang plperl" or "createlang plperlu".
Index: files/pkg-message-plpython.in
===================================================================
RCS file: files/pkg-message-plpython.in
diff -N files/pkg-message-plpython.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pkg-message-plpython.in	31 Jan 2005 00:36:16 -0000
@@ -0,0 +1,3 @@
+PL/Python has been installed. Check the createlang(l) manpage for more
+info. You can install PL/Python by using "createlang plpythonu" (it
+exists as an untrusted language only).
Index: files/pkg-message-pltcl.in
===================================================================
RCS file: files/pkg-message-pltcl.in
diff -N files/pkg-message-pltcl.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pkg-message-pltcl.in	23 Nov 2004 19:15:11 -0000
@@ -0,0 +1,3 @@
+PL/Tcl has been  installed. Check the createlang(l) manpage for more
+info. You can install pltcl as trusted or untrusted, by using either
+"createlang pltcl" or "createlang pltclu".
Index: files/pkg-message-server.in
===================================================================
RCS file: files/pkg-message-server.in
diff -N files/pkg-message-server.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pkg-message-server.in	24 May 2006 03:43:44 -0000
@@ -0,0 +1,49 @@
+For procedural languages and postgresql functions, please note that
+you might have to update them when updating the server.
+
+If you have many tables and many clients running, consider raising
+kern.maxfiles using sysctl(8), or reconfigure your kernel
+appropriately.
+
+You should vacuum and backup your database regularly. There is a
+periodic script, ${LOCALBASE}/etc/periodic/daily/502.pgsql, that you
+may find useful. Per default, it perfoms vacuum on all databases
+nightly. See the script for instructions.
+
+To allow many simultaneous connections to your PostgreSQL server, you
+should raise the SystemV shared memory limits in your kernel. Here are
+example values for allowing up to 180 clients (configurations in
+postgresql.conf also needed, of course):
+  options         SYSVSHM
+  options         SYSVSEM
+  options         SYSVMSG
+  options         SHMMAXPGS=65536
+  options         SEMMNI=40
+  options         SEMMNS=240
+  options         SEMUME=40
+  options         SEMMNU=120
+
+If you plan to access your PostgreSQL server using ODBC, please
+consider running the SQL script %%PREFIX%%/share/postgresql/odbc.sql
+to get the functions required for ODBC compliance.
+
+======================================================================
+
+To initialize the database, run
+
+  %%PREFIX%%/etc/rc.d/pgsql.sh initdb
+
+You can then start PostgreSQL by running:
+
+  %%PREFIX%%/etc/rc.d/pgsql.sh start
+
+For postmaster settings, see ~pgsql/data/postgresql.conf
+
+NB. FreeBSD's PostgreSQL port now by default logs to syslog
+    See ~pgsql/data/postgresql.conf for more info
+
+======================================================================
+
+To run PostgreSQL at startup, add
+'postgresql_enable="YES"' to /etc/rc.conf
+
--- patch-postgresql81-server ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605240413.k4O4DwK3091059>