diff options
author | 2006-12-13 07:59:07 +0000 | |
---|---|---|
committer | 2006-12-13 07:59:07 +0000 | |
commit | 10fc0614370871dfba5afba29c9f80ec75c23477 (patch) | |
tree | fc96d1c7a3e2e235f90bf4e35e3f0e7b3105257d /dev-db | |
parent | stable x86, bugs #151027 (diff) | |
download | gentoo-2-10fc0614370871dfba5afba29c9f80ec75c23477.tar.gz gentoo-2-10fc0614370871dfba5afba29c9f80ec75c23477.tar.bz2 gentoo-2-10fc0614370871dfba5afba29c9f80ec75c23477.zip |
Added new conf.d/init.d files for version 8.0 and 8.1
(Portage version: 2.1.2_rc3)
Diffstat (limited to 'dev-db')
-rw-r--r-- | dev-db/postgresql/ChangeLog | 5 | ||||
-rw-r--r-- | dev-db/postgresql/files/digest-postgresql-8.0.9-r1 | 12 | ||||
-rw-r--r-- | dev-db/postgresql/files/digest-postgresql-8.1.5-r1 | 12 | ||||
-rw-r--r-- | dev-db/postgresql/files/postgresql.conf-8.0 | 44 | ||||
-rw-r--r-- | dev-db/postgresql/files/postgresql.conf-8.1 | 44 | ||||
-rw-r--r-- | dev-db/postgresql/files/postgresql.init-8.0 | 49 | ||||
-rw-r--r-- | dev-db/postgresql/files/postgresql.init-8.1 | 49 | ||||
-rw-r--r-- | dev-db/postgresql/postgresql-8.0.9-r1.ebuild | 242 | ||||
-rw-r--r-- | dev-db/postgresql/postgresql-8.1.5-r1.ebuild | 247 |
9 files changed, 635 insertions, 69 deletions
diff --git a/dev-db/postgresql/ChangeLog b/dev-db/postgresql/ChangeLog index de1752222749..215638c2e372 100644 --- a/dev-db/postgresql/ChangeLog +++ b/dev-db/postgresql/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for dev-db/postgresql # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v 1.300 2006/11/11 13:39:14 dev-zero Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v 1.301 2006/12/13 07:59:07 dev-zero Exp $ + + 12 Dec 2006; Tiziano Müller <dev-zero@gentoo.org> ChangeLog: + Added new conf.d/init.d files for version 8.0 and 8.1. 11 Nov 2006; Tiziano Müller <dev-zero@gentoo.org> files/pg_autovacuum.conf-7.4, files/pg_autovacuum.init-7.4, diff --git a/dev-db/postgresql/files/digest-postgresql-8.0.9-r1 b/dev-db/postgresql/files/digest-postgresql-8.0.9-r1 new file mode 100644 index 000000000000..f2e11e02313b --- /dev/null +++ b/dev-db/postgresql/files/digest-postgresql-8.0.9-r1 @@ -0,0 +1,12 @@ +MD5 f9a044227ad6dc9c937d4853100733cb postgresql-base-8.0.9.tar.bz2 7824961 +RMD160 40cbea0b0a3a0f67670dfbe1670e08b48dbb1999 postgresql-base-8.0.9.tar.bz2 7824961 +SHA256 8ed190ee5468f3685a1edbc5279490819ffa6fe64f1b6f0139bdbec365852417 postgresql-base-8.0.9.tar.bz2 7824961 +MD5 0529eb29ac2c248a3b244b7bfc007456 postgresql-docs-8.0.9.tar.bz2 2262698 +RMD160 55df79bfc347147c33db925a1138c2341043f887 postgresql-docs-8.0.9.tar.bz2 2262698 +SHA256 b55d4a77c0c3b0f42c7233c08112b884e1463157160007efd70a63806ede632b postgresql-docs-8.0.9.tar.bz2 2262698 +MD5 363e009214bfde8235d900da09c7c675 postgresql-opt-8.0.9.tar.bz2 134706 +RMD160 be148e079c20c13aec1767180d993933b91c2116 postgresql-opt-8.0.9.tar.bz2 134706 +SHA256 007d5cded329dfbcc91b4f1d1ddb9473efb4316b1621294446ee611065393020 postgresql-opt-8.0.9.tar.bz2 134706 +MD5 8992a878fe5aa32e3da7fb84270614db postgresql-test-8.0.9.tar.bz2 931363 +RMD160 ae38c2225daff32449ebe6b483096f2f35aa8067 postgresql-test-8.0.9.tar.bz2 931363 +SHA256 f2b81b3cf7ade17a748fa84570c295817d82fd05b53d2e0fb9d9e922b0c613ea postgresql-test-8.0.9.tar.bz2 931363 diff --git a/dev-db/postgresql/files/digest-postgresql-8.1.5-r1 b/dev-db/postgresql/files/digest-postgresql-8.1.5-r1 new file mode 100644 index 000000000000..ac72d06c9b7b --- /dev/null +++ b/dev-db/postgresql/files/digest-postgresql-8.1.5-r1 @@ -0,0 +1,12 @@ +MD5 30a42fd5fc5326edc217e28651e5053b postgresql-base-8.1.5.tar.bz2 8044522 +RMD160 3460f38b720ce3a9687052d5523bcbd027655d6e postgresql-base-8.1.5.tar.bz2 8044522 +SHA256 cb878499848aa8abb82f1ae79574923174851b0396a5befa31f49089a3abb4df postgresql-base-8.1.5.tar.bz2 8044522 +MD5 d104e7e645ea36407831ca59470c7a12 postgresql-docs-8.1.5.tar.bz2 2489400 +RMD160 a29a5d1738f6f776597d162d9fc6d69805c74943 postgresql-docs-8.1.5.tar.bz2 2489400 +SHA256 01c0a848b0016598adfcebea74960340edf80fc037051d106b62bea14e1cd0c9 postgresql-docs-8.1.5.tar.bz2 2489400 +MD5 bcd3eec7cfc759dbfdde4f9e8fa07d27 postgresql-opt-8.1.5.tar.bz2 144784 +RMD160 5ac9b1ffdf1357316ceb1736f7b9be3ee339be3b postgresql-opt-8.1.5.tar.bz2 144784 +SHA256 4fe0dc14e02d65516348ec0e90633be2a3ada002c151fca8f2e7eba6556c8b1c postgresql-opt-8.1.5.tar.bz2 144784 +MD5 b3e050a0af7998d78f928b96d95fa6d7 postgresql-test-8.1.5.tar.bz2 947271 +RMD160 644b352354743eb5250bf422c62e1f2c340c1ed2 postgresql-test-8.1.5.tar.bz2 947271 +SHA256 60ed8d466a66dfe72994f7c8e45324e81e8ce6b91343eee07df5939f10559166 postgresql-test-8.1.5.tar.bz2 947271 diff --git a/dev-db/postgresql/files/postgresql.conf-8.0 b/dev-db/postgresql/files/postgresql.conf-8.0 index c6fd787f744d..23956741a02e 100644 --- a/dev-db/postgresql/files/postgresql.conf-8.0 +++ b/dev-db/postgresql/files/postgresql.conf-8.0 @@ -1,13 +1,47 @@ # PostgreSQL's Database Directory PGDATA="/var/lib/postgresql/data" -# Logfile path (NOTE: This must be owned by the uid/gid of $PGUSER!) -PGLOG="/var/lib/postgresql/data/postgresql.log" - # PostgreSQL User PGUSER="postgres" +# PostgreSQL Group +PGGROUP="postgres" + # Extra options to run postmaster with -# If you want to enable TCP/IP for PostgreSQL, add -i, like the following: -# PGOPTS="-N 512 -B 1024 -i" +# -N is the maximal number of client connections +# -B is the number of shared buffers and has to be at least 2x the value for -N +# Please read the man-page to postmaster for more options. Many of these options +# can be set directly in the configuration-file. PGOPTS="-N 512 -B 1024" + + +# SERVER SHUTDOWN: +# The server will receive 3 signals in the worst case: +# 1. SIGTERM +# This signals the server to ignore new connections and to +# wait for all clients to end their transactions before shutting down. +# Use WAIT_FOR_DISCONNECT to control how much time the clients +# should have until the next signal is being sent. +# 2. SIGINT +# Tell the server to forcefully disconnect all clients. +# Terminating a client results in a rollback of the open transactions for this client. +# Use WAIT_FOR_CLEANUP to determine how much time the server has +# for cleanup. (Set it to "forever" if you want to wait forever.) +# 3. SIGQUIT +# This will terminate the server immediately and results in a recovery run for the next start. + +# Wait for clients to disconnect (seconds or "forever") +WAIT_FOR_DISCONNECT=10 + +# Time the server has to clean up (seconds or "forever") +WAIT_FOR_CLEANUP=10 + +# If you have to export environment variables for the database process, +# this can be done here. +# Just define a new variable ENV_identifier="ENV_VAR_NAME=env_var_content", +# ENV_VAR_NAME will then be exported to the postgresql's environment. +# +# Example: +# ENV_plr="R_HOME=/usr/lib/R" +# This exports a variable R_HOME with the content "/usr/lib/R" + diff --git a/dev-db/postgresql/files/postgresql.conf-8.1 b/dev-db/postgresql/files/postgresql.conf-8.1 index c6fd787f744d..23956741a02e 100644 --- a/dev-db/postgresql/files/postgresql.conf-8.1 +++ b/dev-db/postgresql/files/postgresql.conf-8.1 @@ -1,13 +1,47 @@ # PostgreSQL's Database Directory PGDATA="/var/lib/postgresql/data" -# Logfile path (NOTE: This must be owned by the uid/gid of $PGUSER!) -PGLOG="/var/lib/postgresql/data/postgresql.log" - # PostgreSQL User PGUSER="postgres" +# PostgreSQL Group +PGGROUP="postgres" + # Extra options to run postmaster with -# If you want to enable TCP/IP for PostgreSQL, add -i, like the following: -# PGOPTS="-N 512 -B 1024 -i" +# -N is the maximal number of client connections +# -B is the number of shared buffers and has to be at least 2x the value for -N +# Please read the man-page to postmaster for more options. Many of these options +# can be set directly in the configuration-file. PGOPTS="-N 512 -B 1024" + + +# SERVER SHUTDOWN: +# The server will receive 3 signals in the worst case: +# 1. SIGTERM +# This signals the server to ignore new connections and to +# wait for all clients to end their transactions before shutting down. +# Use WAIT_FOR_DISCONNECT to control how much time the clients +# should have until the next signal is being sent. +# 2. SIGINT +# Tell the server to forcefully disconnect all clients. +# Terminating a client results in a rollback of the open transactions for this client. +# Use WAIT_FOR_CLEANUP to determine how much time the server has +# for cleanup. (Set it to "forever" if you want to wait forever.) +# 3. SIGQUIT +# This will terminate the server immediately and results in a recovery run for the next start. + +# Wait for clients to disconnect (seconds or "forever") +WAIT_FOR_DISCONNECT=10 + +# Time the server has to clean up (seconds or "forever") +WAIT_FOR_CLEANUP=10 + +# If you have to export environment variables for the database process, +# this can be done here. +# Just define a new variable ENV_identifier="ENV_VAR_NAME=env_var_content", +# ENV_VAR_NAME will then be exported to the postgresql's environment. +# +# Example: +# ENV_plr="R_HOME=/usr/lib/R" +# This exports a variable R_HOME with the content "/usr/lib/R" + diff --git a/dev-db/postgresql/files/postgresql.init-8.0 b/dev-db/postgresql/files/postgresql.init-8.0 index 74a762d44712..355abc9d61cf 100644 --- a/dev-db/postgresql/files/postgresql.init-8.0 +++ b/dev-db/postgresql/files/postgresql.init-8.0 @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/files/postgresql.init-8.0,v 1.2 2006/11/07 22:48:22 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/files/postgresql.init-8.0,v 1.3 2006/12/13 07:59:07 dev-zero Exp $ opts="${opts} reload" @@ -12,7 +12,8 @@ depend() { checkconfig() { if [ ! -d "$PGDATA" ] ; then eerror "Directory not found: $PGDATA" - eerror "You must create the $PGDATA directory first!" + eerror "Please make sure that PGDATA points to the right path." + eerror "You can run 'emerge postgresql --config' to setup a new database cluster." return 1 fi } @@ -26,42 +27,32 @@ start() { rm -f "$PGDATA/postmaster.pid" fi - su - $PGUSER -c "/usr/bin/pg_ctl start -D '$PGDATA' -s -l '$PGLOG' -o '$PGOPTS'" + local env_vars + for var in ${!ENV_*} ; do env_vars="${env_vars} -e ${!var}" ; done + start-stop-daemon --start \ + --pidfile "${PGDATA}/postmaster.pid" \ + --chuid ${PGUSER}:${PGGROUP} \ + --exec /usr/bin/postmaster \ + ${env_vars} -- \ + -D "${PGDATA}" \ + --silent-mode=true \ + ${PGOPTS} - while : - do - cnt=$(($cnt + 1)) - if [ -f "$PGDATA/postmaster.pid" ] ; then - ret=0 - break - fi - - if [ $cnt -eq 30 ] ; then - eerror - eerror "Please check the $PGLOG log file for errors." - eerror - ret=1 - break - fi - sleep 1 - done - eend $ret + eend $? } stop() { ebegin "Stopping PostgreSQL" - su - $PGUSER -c "/usr/bin/pg_ctl stop -D '$PGDATA' -s -m fast" - eend $? -} - -svc_restart() { - ebegin "Restarting PostgreSQL" - su - $PGUSER -c "/usr/bin/pg_ctl restart -D '$PGDATA' -s -m fast -l '$PGLOG' -o '$PGOPTS'" + # Note: we have to do --oknodo here, otherwise it will always fail + # when there are open transactions. This bug has been corrected + # in baselayout-1.13.0_alpha8. + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -TERM/${WAIT_FOR_DISCONNECT}/-INT/${WAIT_FOR_CLEANUP}/-QUIT --oknodo eend $? } reload() { ebegin "Reloading PostgreSQL configuration" - su - $PGUSER -c "/usr/bin/pg_ctl reload -D '$PGDATA' -s" + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" --signal HUP --oknodo eend $? } diff --git a/dev-db/postgresql/files/postgresql.init-8.1 b/dev-db/postgresql/files/postgresql.init-8.1 index cd432ec29151..8e6d74b732e5 100644 --- a/dev-db/postgresql/files/postgresql.init-8.1 +++ b/dev-db/postgresql/files/postgresql.init-8.1 @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/files/postgresql.init-8.1,v 1.2 2006/11/07 22:48:22 chtekk Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/files/postgresql.init-8.1,v 1.3 2006/12/13 07:59:07 dev-zero Exp $ opts="${opts} reload" @@ -12,7 +12,8 @@ depend() { checkconfig() { if [ ! -d "$PGDATA" ] ; then eerror "Directory not found: $PGDATA" - eerror "You must create the $PGDATA directory first!" + eerror "Please make sure that PGDATA points to the right path." + eerror "You can run 'emerge postgresql --config' to setup a new database cluster." return 1 fi } @@ -26,42 +27,32 @@ start() { rm -f "$PGDATA/postmaster.pid" fi - su - $PGUSER -c "/usr/bin/pg_ctl start -D '$PGDATA' -s -l '$PGLOG' -o '$PGOPTS'" + local env_vars + for var in ${!ENV_*} ; do env_vars="${env_vars} -e ${!var}" ; done + start-stop-daemon --start \ + --pidfile "${PGDATA}/postmaster.pid" \ + --chuid ${PGUSER}:${PGGROUP} \ + --exec /usr/bin/postmaster \ + ${env_vars} -- \ + -D "${PGDATA}" \ + --silent-mode=true \ + ${PGOPTS} - while : - do - cnt=$(($cnt + 1)) - if [ -f "$PGDATA/postmaster.pid" ] ; then - ret=0 - break - fi - - if [ $cnt -eq 30 ] ; then - eerror - eerror "Please check the $PGLOG log file for errors." - eerror - ret=1 - break - fi - sleep 1 - done - eend $ret + eend $? } stop() { ebegin "Stopping PostgreSQL" - su - $PGUSER -c "/usr/bin/pg_ctl stop -D '$PGDATA' -s -m fast" - eend $? -} - -svc_restart() { - ebegin "Restarting PostgreSQL" - su - $PGUSER -c "/usr/bin/pg_ctl restart -D '$PGDATA' -s -m fast -l '$PGLOG' -o '$PGOPTS'" + # Note: we have to do --oknodo here, otherwise it will always fail + # when there are open transactions. This bug has been corrected + # in baselayout-1.13.0_alpha8. + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" \ + --retry -TERM/${WAIT_FOR_DISCONNECT}/-INT/${WAIT_FOR_CLEANUP}/-QUIT --oknodo eend $? } reload() { ebegin "Reloading PostgreSQL configuration" - su - $PGUSER -c "/usr/bin/pg_ctl reload -D '$PGDATA' -s" + start-stop-daemon --stop --pidfile "${PGDATA}/postmaster.pid" --signal HUP --oknodo eend $? } diff --git a/dev-db/postgresql/postgresql-8.0.9-r1.ebuild b/dev-db/postgresql/postgresql-8.0.9-r1.ebuild new file mode 100644 index 000000000000..bd0654c16fde --- /dev/null +++ b/dev-db/postgresql/postgresql-8.0.9-r1.ebuild @@ -0,0 +1,242 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-8.0.9-r1.ebuild,v 1.1 2006/12/13 07:59:07 dev-zero Exp $ + +inherit eutils gnuconfig flag-o-matic multilib toolchain-funcs versionator + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" + +DESCRIPTION="Sophisticated and powerful Object-Relational DBMS." +HOMEPAGE="http://www.postgresql.org/" +SRC_URI="mirror://postgresql/source/v${PV}/${PN}-base-${PV}.tar.bz2 + mirror://postgresql/source/v${PV}/${PN}-opt-${PV}.tar.bz2 + doc? ( mirror://postgresql/source/v${PV}/${PN}-docs-${PV}.tar.bz2 ) + test? ( mirror://postgresql/source/v${PV}/${PN}-test-${PV}.tar.bz2 )" +LICENSE="POSTGRESQL" +SLOT="0" +IUSE="doc kerberos nls pam perl pg-intdatetime python readline selinux ssl tcl test xml zlib" + +RDEPEND="~dev-db/libpq-${PV} + >=sys-libs/ncurses-5.2 + kerberos? ( virtual/krb5 ) + pam? ( virtual/pam ) + perl? ( >=dev-lang/perl-5.6.1-r2 ) + python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base ) + readline? ( >=sys-libs/readline-4.1 ) + selinux? ( sec-policy/selinux-postgresql ) + ssl? ( >=dev-libs/openssl-0.9.6-r1 ) + tcl? ( >=dev-lang/tcl-8 ) + xml? ( dev-libs/libxml2 dev-libs/libxslt ) + zlib? ( >=sys-libs/zlib-1.1.3 )" +DEPEND="${RDEPEND} + sys-devel/autoconf + >=sys-devel/bison-1.875 + nls? ( sys-devel/gettext ) + xml? ( dev-util/pkgconfig )" + +PG_DIR="/var/lib/postgresql" +[[ -z "${PG_MAX_CONNECTIONS}" ]] && PG_MAX_CONNECTIONS="512" + +pkg_setup() { + if [[ -f "${PG_DIR}/data/PG_VERSION" ]] ; then + if [[ $(cat "${PG_DIR}/data/PG_VERSION") != $(get_version_component_range 1-2) ]] ; then + eerror "PostgreSQL ${PV} cannot upgrade your existing databases, you must" + eerror "use pg_dump to export your existing databases to a file, and then" + eerror "pg_restore to import them when you have upgraded completely." + eerror "You must remove your entire database directory to continue." + eerror "(database directory = ${PG_DIR})." + die "Remove your database directory to continue" + fi + fi + enewgroup postgres 70 + enewuser postgres 70 /bin/bash /var/lib postgres +} + +src_unpack() { + unpack ${A} + cd "${S}" + + epatch "${FILESDIR}/${PN}-${PV}-gentoo.patch" + epatch "${FILESDIR}/${PN}-${PV}-sh.patch" + + # Prepare package for future tests + if use test ; then + # Fix sandbox violation + sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source + + # We need to run the tests as a non-root user, portage seems the most fitting here, + # so if userpriv is enabled, we use it directly. If userpriv is disabled, well, we + # don't support that in this version of PostgreSQL ... :) + mkdir -p "${S}/src/test/regress/tmp_check" + chown portage "${S}/src/test/regress/tmp_check" + einfo "Tests will be run as user portage." + fi +} + +src_compile() { + filter-flags -ffast-math -feliminate-dwarf2-dups + + # Detect mips systems properly + gnuconfig_update + + cd "${S}" + + ./configure --prefix=/usr \ + --includedir=/usr/include/postgresql/pgsql \ + --sysconfdir=/etc/postgresql \ + --mandir=/usr/share/man \ + --host=${CHOST} \ + --with-docdir=/usr/share/doc/${PF} \ + --libdir=/usr/$(get_libdir) \ + --enable-depend \ + $(use_with kerberos krb5) \ + $(use_enable nls ) \ + $(use_with pam) \ + $(use_with perl) \ + $(use_enable pg-intdatetime integer-datetimes ) \ + $(use_with python) \ + $(use_with readline) \ + $(use_with ssl openssl) \ + $(use_with tcl) \ + $(use_with zlib) \ + || die "configure failed" + + emake -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "main emake failed" + + cd "${S}/contrib" + emake -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "contrib emake failed" + + if use xml ; then + cd "${S}/contrib/xml2" + emake -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "contrib/xml2 emake failed" + fi +} + +src_install() { + if use perl ; then + mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig" + sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ + "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile" + fi + + cd "${S}" + emake -j1 DESTDIR="${D}" LIBDIR="${D}/usr/$(get_libdir)" install || die "main emake install failed" + + cd "${S}/contrib" + emake -j1 DESTDIR="${D}" LIBDIR="${D}/usr/$(get_libdir)" install || die "contrib emake install failed" + + if use xml ; then + cd "${S}/contrib/xml2" + emake -j1 DESTDIR="${D}" LIBDIR="${D}/usr/$(get_libdir)" install || die "contrib/xml2 emake install failed" + fi + + cd "${S}" + dodoc README HISTORY + dodoc contrib/adddepend/* + + cd "${S}/doc" + dodoc FAQ* README.* TODO bug.template + + if use doc ; then + cd "${S}/doc" + docinto FAQ_html + dodoc src/FAQ/* + docinto sgml + dodoc src/sgml/*.{sgml,dsl} + docinto sgml/ref + dodoc src/sgml/ref/*.sgml + docinto TODO.detail + dodoc TODO.detail/* + fi + + newinitd "${FILESDIR}/postgresql.init-${PV%.*}" postgresql || die "Inserting init.d-file failed" + newconfd "${FILESDIR}/postgresql.conf-${PV%.*}" postgresql || die "Inserting conf.d-file failed" + + newinitd "${FILESDIR}/pg_autovacuum.init-${PV%.*}" pg_autovacuum || die "Inserting pg_autovacuum init.d-file failed" + newconfd "${FILESDIR}/pg_autovacuum.conf-${PV%.*}" pg_autovacuum || die "Inserting pg_autovacuum conf.d-file failed" + dosed "s:___DOCDIR___:/usr/share/doc/${PF}:" /etc/init.d/pg_autovacuum +} + +pkg_postinst() { + elog "Execute the following command to setup the initial database environment:" + elog + elog "emerge --config =${PF}" + elog + elog "If you need a global psqlrc-file, you can place it in '${ROOT}/etc/postgresql/'." +} + +pkg_config() { + einfo "Creating the data directory ..." + mkdir -p "${PG_DIR}/data" + chown -Rf postgres:postgres "${PG_DIR}" + chmod 0700 "${PG_DIR}/data" + + einfo "Initializing the database ..." + if [[ -f "${PG_DIR}/data/PG_VERSION" ]] ; then + eerror "PostgreSQL ${PV} cannot upgrade your existing databases." + eerror "You must remove your entire database directory to continue." + eerror "(database directory = ${PG_DIR})." + die "Remove your database directory to continue" + else + if use kernel_linux ; then + local SEM=`sysctl -n kernel.sem | cut -f-3` + local SEMMNI=`sysctl -n kernel.sem | cut -f4` + local SEMMNI_MIN=`expr \( ${PG_MAX_CONNECTIONS} + 15 \) / 16` + local SHMMAX=`sysctl -n kernel.shmmax` + local SHMMAX_MIN=`expr 500000 + 30600 \* ${PG_MAX_CONNECTIONS}` + + if [ ${SEMMNI} -lt ${SEMMNI_MIN} ] ; then + eerror "The current value of SEMMNI is too low" + eerror "for PostgreSQL to run ${PG_MAX_CONNECTIONS} connections!" + eerror "Temporary setting this value to ${SEMMNI_MIN} while creating the initial database." + echo ${SEM} ${SEMMNI_MIN} > /proc/sys/kernel/sem + fi + + su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data" + + if [ ! `sysctl -n kernel.sem | cut -f4` -eq ${SEMMNI} ] ; then + echo ${SEM} ${SEMMNI} > /proc/sys/kernel/sem + ewarn "Restoring the SEMMNI value to the previous value." + ewarn "Please edit the last value of kernel.sem in /etc/sysctl.conf" + ewarn "and set it to at least ${SEMMNI_MIN}:" + ewarn + ewarn " kernel.sem = ${SEM} ${SEMMNI_MIN}" + ewarn + fi + + if [ ${SHMMAX} -lt ${SHMMAX_MIN} ] ; then + eerror "The current value of SHMMAX is too low for postgresql to run." + eerror "Please edit /etc/sysctl.conf and set this value to at least ${SHMMAX_MIN}:" + eerror + eerror " kernel.shmmax = ${SHMMAX_MIN}" + eerror + fi + else + su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data" + fi + + einfo + einfo "You can use the '${ROOT}/etc/init.d/postgresql' script to run PostgreSQL instead of 'pg_ctl'." + einfo + fi +} + +src_test() { + cd "${S}" + + einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" + if hasq userpriv ${FEATURES} ; then + if ! emake -j1 check ; then + hasq test ${FEATURES} && die "Make check failed. See above for details." + hasq test ${FEATURES} || eerror "Make check failed. See above for details." + fi + else + eerror "Tests won't be run if FEATURES=userpriv is disabled!" + fi + + einfo "Yes, there are other tests which could be run." + einfo "... and no, we don't plan to add/support them." + einfo "For now, the main regressions tests will suffice." + einfo "If you think other tests are necessary, please submit a" + einfo "bug including a patch for this ebuild to enable them." +} diff --git a/dev-db/postgresql/postgresql-8.1.5-r1.ebuild b/dev-db/postgresql/postgresql-8.1.5-r1.ebuild new file mode 100644 index 000000000000..1e63bb8efcc2 --- /dev/null +++ b/dev-db/postgresql/postgresql-8.1.5-r1.ebuild @@ -0,0 +1,247 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-8.1.5-r1.ebuild,v 1.1 2006/12/13 07:59:07 dev-zero Exp $ + +inherit eutils gnuconfig flag-o-matic multilib toolchain-funcs versionator + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" + +DESCRIPTION="Sophisticated and powerful Object-Relational DBMS." +HOMEPAGE="http://www.postgresql.org/" +SRC_URI="mirror://postgresql/source/v${PV}/${PN}-base-${PV}.tar.bz2 + mirror://postgresql/source/v${PV}/${PN}-opt-${PV}.tar.bz2 + doc? ( mirror://postgresql/source/v${PV}/${PN}-docs-${PV}.tar.bz2 ) + test? ( mirror://postgresql/source/v${PV}/${PN}-test-${PV}.tar.bz2 )" +LICENSE="POSTGRESQL" +SLOT="0" +IUSE="doc kerberos nls pam perl pg-intdatetime python readline selinux ssl tcl test xml zlib" + +RDEPEND="~dev-db/libpq-${PV} + >=sys-libs/ncurses-5.2 + kerberos? ( virtual/krb5 ) + pam? ( virtual/pam ) + perl? ( >=dev-lang/perl-5.6.1-r2 ) + python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base ) + readline? ( >=sys-libs/readline-4.1 ) + selinux? ( sec-policy/selinux-postgresql ) + ssl? ( >=dev-libs/openssl-0.9.6-r1 ) + tcl? ( >=dev-lang/tcl-8 ) + xml? ( dev-libs/libxml2 dev-libs/libxslt ) + zlib? ( >=sys-libs/zlib-1.1.3 )" +DEPEND="${RDEPEND} + sys-devel/autoconf + >=sys-devel/bison-1.875 + nls? ( sys-devel/gettext ) + xml? ( dev-util/pkgconfig )" + +PG_DIR="/var/lib/postgresql" +[[ -z "${PG_MAX_CONNECTIONS}" ]] && PG_MAX_CONNECTIONS="512" + +pkg_setup() { + if [[ -f "${PG_DIR}/data/PG_VERSION" ]] ; then + if [[ $(cat "${PG_DIR}/data/PG_VERSION") != $(get_version_component_range 1-2) ]] ; then + eerror "PostgreSQL ${PV} cannot upgrade your existing databases, you must" + eerror "use pg_dump to export your existing databases to a file, and then" + eerror "pg_restore to import them when you have upgraded completely." + eerror "You must remove your entire database directory to continue." + eerror "(database directory = ${PG_DIR})." + die "Remove your database directory to continue" + fi + fi + enewgroup postgres 70 + enewuser postgres 70 /bin/bash /var/lib postgres +} + +src_unpack() { + unpack ${A} + cd "${S}" + + epatch "${FILESDIR}/${PN}-${PV}-gentoo.patch" + epatch "${FILESDIR}/${PN}-${PV}-sh.patch" + + # Prepare package for future tests + if use test ; then + # Fix sandbox violation + sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source + + # Fix broken tests + epatch "${FILESDIR}/${PN}-${PV}-regress_fix.patch" + + # We need to run the tests as a non-root user, portage seems the most fitting here, + # so if userpriv is enabled, we use it directly. If userpriv is disabled, we need to + # su - to a valid user, portage again, so we patch the test-scripts to do that. + mkdir -p "${S}/src/test/regress/tmp_check" + chown portage "${S}/src/test/regress/tmp_check" + einfo "Tests will be run as user portage." + if ! hasq userpriv ${FEATURES} ; then + mkdir -p "${S}/src/test/regress/results" + chown portage "${S}/src/test/regress/results" + epatch "${FILESDIR}/${PN}-${PV}-regress_su.patch" + sed -e "s|PORTAGETEMPDIRPG|${S}/src/test/regress|g" -i src/test/regress/pg_regress.sh + fi + fi +} + +src_compile() { + filter-flags -ffast-math -feliminate-dwarf2-dups + + # Detect mips systems properly + gnuconfig_update + + cd "${S}" + + ./configure --prefix=/usr \ + --includedir=/usr/include/postgresql/pgsql \ + --sysconfdir=/etc/postgresql \ + --mandir=/usr/share/man \ + --host=${CHOST} \ + --with-docdir=/usr/share/doc/${PF} \ + --libdir=/usr/$(get_libdir) \ + --enable-depend \ + $(use_with kerberos krb5) \ + $(use_enable nls ) \ + $(use_with pam) \ + $(use_with perl) \ + $(use_enable pg-intdatetime integer-datetimes ) \ + $(use_with python) \ + $(use_with readline) \ + $(use_with ssl openssl) \ + $(use_with tcl) \ + $(use_with zlib) \ + || die "configure failed" + + emake -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "main emake failed" + + cd "${S}/contrib" + emake -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "contrib emake failed" + + if use xml ; then + cd "${S}/contrib/xml2" + emake -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "contrib/xml2 emake failed" + fi +} + +src_install() { + if use perl ; then + mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig" + sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ + "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile" + fi + + cd "${S}" + emake -j1 DESTDIR="${D}" LIBDIR="${D}/usr/$(get_libdir)" install || die "main emake install failed" + + cd "${S}/contrib" + emake -j1 DESTDIR="${D}" LIBDIR="${D}/usr/$(get_libdir)" install || die "contrib emake install failed" + + if use xml ; then + cd "${S}/contrib/xml2" + emake -j1 DESTDIR="${D}" LIBDIR="${D}/usr/$(get_libdir)" install || die "contrib/xml2 emake install failed" + fi + + cd "${S}" + dodoc README HISTORY + dodoc contrib/adddepend/* + + cd "${S}/doc" + dodoc FAQ* README.* TODO bug.template + + if use doc ; then + cd "${S}/doc" + docinto FAQ_html + dodoc src/FAQ/* + docinto sgml + dodoc src/sgml/*.{sgml,dsl} + docinto sgml/ref + dodoc src/sgml/ref/*.sgml + docinto TODO.detail + dodoc TODO.detail/* + fi + + newinitd "${FILESDIR}/postgresql.init-${PV%.*}" postgresql || die "Inserting init.d-file failed" + newconfd "${FILESDIR}/postgresql.conf-${PV%.*}" postgresql || die "Inserting conf.d-file failed" +} + +pkg_postinst() { + elog "Execute the following command to setup the initial database environment:" + elog + elog "emerge --config =${PF}" + elog + elog "The autovacuum function, which was in contrib, has been moved to the main" + elog "PostgreSQL functions starting with 8.1." + elog "You can enable it in ${ROOT}/etc/postgresql/postgresql.conf." + elog + elog "If you need a global psqlrc-file, you can place it in '${ROOT}/etc/postgresql/'." +} + +pkg_config() { + einfo "Creating the data directory ..." + mkdir -p "${PG_DIR}/data" + chown -Rf postgres:postgres "${PG_DIR}" + chmod 0700 "${PG_DIR}/data" + + einfo "Initializing the database ..." + if [[ -f "${PG_DIR}/data/PG_VERSION" ]] ; then + eerror "PostgreSQL ${PV} cannot upgrade your existing databases." + eerror "You must remove your entire database directory to continue." + eerror "(database directory = ${PG_DIR})." + die "Remove your database directory to continue" + else + if use kernel_linux ; then + local SEM=`sysctl -n kernel.sem | cut -f-3` + local SEMMNI=`sysctl -n kernel.sem | cut -f4` + local SEMMNI_MIN=`expr \( ${PG_MAX_CONNECTIONS} + 15 \) / 16` + local SHMMAX=`sysctl -n kernel.shmmax` + local SHMMAX_MIN=`expr 500000 + 30600 \* ${PG_MAX_CONNECTIONS}` + + if [ ${SEMMNI} -lt ${SEMMNI_MIN} ] ; then + eerror "The current value of SEMMNI is too low" + eerror "for PostgreSQL to run ${PG_MAX_CONNECTIONS} connections!" + eerror "Temporary setting this value to ${SEMMNI_MIN} while creating the initial database." + echo ${SEM} ${SEMMNI_MIN} > /proc/sys/kernel/sem + fi + + su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data" + + if [ ! `sysctl -n kernel.sem | cut -f4` -eq ${SEMMNI} ] ; then + echo ${SEM} ${SEMMNI} > /proc/sys/kernel/sem + ewarn "Restoring the SEMMNI value to the previous value." + ewarn "Please edit the last value of kernel.sem in /etc/sysctl.conf" + ewarn "and set it to at least ${SEMMNI_MIN}:" + ewarn + ewarn " kernel.sem = ${SEM} ${SEMMNI_MIN}" + ewarn + fi + + if [ ${SHMMAX} -lt ${SHMMAX_MIN} ] ; then + eerror "The current value of SHMMAX is too low for postgresql to run." + eerror "Please edit /etc/sysctl.conf and set this value to at least ${SHMMAX_MIN}:" + eerror + eerror " kernel.shmmax = ${SHMMAX_MIN}" + eerror + fi + else + su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data" + fi + + einfo + einfo "You can use the '${ROOT}/etc/init.d/postgresql' script to run PostgreSQL instead of 'pg_ctl'." + einfo + fi +} + +src_test() { + cd "${S}" + + einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" + if ! emake -j1 check ; then + hasq test ${FEATURES} && die "Make check failed. See above for details." + hasq test ${FEATURES} || eerror "Make check failed. See above for details." + fi + + einfo "Yes, there are other tests which could be run." + einfo "... and no, we don't plan to add/support them." + einfo "For now, the main regressions tests will suffice." + einfo "If you think other tests are necessary, please submit a" + einfo "bug including a patch for this ebuild to enable them." +} |