diff options
author | Martin Jackson <mjolnir@gentoo.org> | 2007-02-12 03:34:18 +0000 |
---|---|---|
committer | Martin Jackson <mjolnir@gentoo.org> | 2007-02-12 03:34:18 +0000 |
commit | 23e38dfd8242024e65dfbe5c9a14af46830793b1 (patch) | |
tree | 3cfe12fe052fdafdeaf87373fabc312f8d350710 /dev-db | |
parent | 8.1 branch fix for 165482 (diff) | |
download | historical-23e38dfd8242024e65dfbe5c9a14af46830793b1.tar.gz historical-23e38dfd8242024e65dfbe5c9a14af46830793b1.tar.bz2 historical-23e38dfd8242024e65dfbe5c9a14af46830793b1.zip |
Fixing the 8.1 branch for 165482
Package-Manager: portage-2.1.2-r9
Diffstat (limited to 'dev-db')
-rw-r--r-- | dev-db/postgresql/ChangeLog | 11 | ||||
-rw-r--r-- | dev-db/postgresql/files/digest-postgresql-8.1.8 | 12 | ||||
-rw-r--r-- | dev-db/postgresql/files/postgresql-8.1.8-gentoo.patch | 51 | ||||
-rw-r--r-- | dev-db/postgresql/files/postgresql-8.1.8-regress_fix.patch | 33 | ||||
-rw-r--r-- | dev-db/postgresql/files/postgresql-8.1.8-regress_su.patch | 116 | ||||
-rw-r--r-- | dev-db/postgresql/files/postgresql-8.1.8-sh.patch | 34 | ||||
-rw-r--r-- | dev-db/postgresql/postgresql-8.1.8.ebuild | 247 |
7 files changed, 503 insertions, 1 deletions
diff --git a/dev-db/postgresql/ChangeLog b/dev-db/postgresql/ChangeLog index b39afe535e00..f3cd12cabd70 100644 --- a/dev-db/postgresql/ChangeLog +++ b/dev-db/postgresql/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for dev-db/postgresql # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v 1.318 2007/02/12 02:04:18 mjolnir Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v 1.319 2007/02/12 03:34:18 mjolnir Exp $ + +*postgresql-8.1.8 (12 Feb 2007) + + 12 Feb 2007; Martin Jackson <mjolnir@gentoo.org> + +files/postgresql-8.1.8-gentoo.patch, + +files/postgresql-8.1.8-regress_fix.patch, + +files/postgresql-8.1.8-regress_su.patch, + +files/postgresql-8.1.8-sh.patch, +postgresql-8.1.8.ebuild: + Fixing the 8.1 branch for 165482 *postgresql-8.0.12 (12 Feb 2007) diff --git a/dev-db/postgresql/files/digest-postgresql-8.1.8 b/dev-db/postgresql/files/digest-postgresql-8.1.8 new file mode 100644 index 000000000000..2c580c1eedc3 --- /dev/null +++ b/dev-db/postgresql/files/digest-postgresql-8.1.8 @@ -0,0 +1,12 @@ +MD5 5da7d5bf67e01ddc1fbd92a072ccd3f3 postgresql-base-8.1.8.tar.bz2 8094972 +RMD160 fa3801e9dd25c5d8e9de8fd9f015371824204d78 postgresql-base-8.1.8.tar.bz2 8094972 +SHA256 7a7fdab1993af6de06aa3264cdb3df3618e4a6216b574833c352b50efd5454af postgresql-base-8.1.8.tar.bz2 8094972 +MD5 7d552916141e2686682f2e01f0a88c9d postgresql-docs-8.1.8.tar.bz2 2499550 +RMD160 7c812e4c4d07f00ff933dea9adaddf2211fe6044 postgresql-docs-8.1.8.tar.bz2 2499550 +SHA256 b5f0e095f8e1533ba69cdb1d599d7e2bfa07549a6a75bb6be899991339d30859 postgresql-docs-8.1.8.tar.bz2 2499550 +MD5 58b437f38a1214cff80b7076cbbc967c postgresql-opt-8.1.8.tar.bz2 144643 +RMD160 2a31e70be662ee6753bcc8e712ea5a693079f692 postgresql-opt-8.1.8.tar.bz2 144643 +SHA256 ffcc9519a7a697b370630ab1afb1280d3d9e62a25a7904291153d0de6fca6750 postgresql-opt-8.1.8.tar.bz2 144643 +MD5 a953a4b1f5eddaea326242ce9571cb3f postgresql-test-8.1.8.tar.bz2 946918 +RMD160 5f8e591e29ffd4adec8d130a73c1a916e7ea63fd postgresql-test-8.1.8.tar.bz2 946918 +SHA256 3dd46fea627951cf85cd6b5f0318cc4f1f04ed19814fdaf0f919868699f656dc postgresql-test-8.1.8.tar.bz2 946918 diff --git a/dev-db/postgresql/files/postgresql-8.1.8-gentoo.patch b/dev-db/postgresql/files/postgresql-8.1.8-gentoo.patch new file mode 100644 index 000000000000..13c36350e049 --- /dev/null +++ b/dev-db/postgresql/files/postgresql-8.1.8-gentoo.patch @@ -0,0 +1,51 @@ +diff -Nru postgresql-8.1.5.orig/src/bin/Makefile postgresql-8.1.5/src/bin/Makefile +--- postgresql-8.1.5.orig/src/bin/Makefile 2006-11-05 13:20:34.000000000 +0100 ++++ postgresql-8.1.5/src/bin/Makefile 2006-11-05 15:50:53.000000000 +0100 +@@ -14,7 +14,7 @@ + include $(top_builddir)/src/Makefile.global + + DIRS := initdb ipcclean pg_ctl pg_dump \ +- psql scripts pg_config pg_controldata pg_resetxlog ++ psql scripts pg_controldata pg_resetxlog + ifeq ($(PORTNAME), win32) + DIRS+=pgevent + endif +diff -Nru postgresql-8.1.5.orig/src/interfaces/Makefile postgresql-8.1.5/src/interfaces/Makefile +--- postgresql-8.1.5.orig/src/interfaces/Makefile 2006-11-05 13:20:34.000000000 +0100 ++++ postgresql-8.1.5/src/interfaces/Makefile 2006-11-05 15:50:53.000000000 +0100 +@@ -12,7 +12,7 @@ + top_builddir = ../.. + include $(top_builddir)/src/Makefile.global + +-DIRS := libpq ecpg ++DIRS := ecpg + + ALLDIRS := $(DIRS) + +diff -Nru postgresql-8.1.5.orig/src/Makefile postgresql-8.1.5/src/Makefile +--- postgresql-8.1.5.orig/src/Makefile 2006-11-05 13:20:34.000000000 +0100 ++++ postgresql-8.1.5/src/Makefile 2006-11-05 15:50:53.000000000 +0100 +@@ -18,7 +18,6 @@ + $(MAKE) -C timezone $@ + $(MAKE) -C backend $@ + $(MAKE) -C backend/utils/mb/conversion_procs $@ +- $(MAKE) -C include $@ + $(MAKE) -C interfaces $@ + $(MAKE) -C bin $@ + $(MAKE) -C pl $@ +@@ -47,7 +46,6 @@ + $(MAKE) -C port $@ + $(MAKE) -C timezone $@ + $(MAKE) -C backend $@ +- $(MAKE) -C include $@ + $(MAKE) -C interfaces $@ + $(MAKE) -C bin $@ + $(MAKE) -C pl $@ +@@ -61,7 +59,6 @@ + -$(MAKE) -C port $@ + -$(MAKE) -C timezone $@ + -$(MAKE) -C backend $@ +- -$(MAKE) -C include $@ + -$(MAKE) -C interfaces $@ + -$(MAKE) -C bin $@ + -$(MAKE) -C pl $@ diff --git a/dev-db/postgresql/files/postgresql-8.1.8-regress_fix.patch b/dev-db/postgresql/files/postgresql-8.1.8-regress_fix.patch new file mode 100644 index 000000000000..0cb39d576f34 --- /dev/null +++ b/dev-db/postgresql/files/postgresql-8.1.8-regress_fix.patch @@ -0,0 +1,33 @@ +--- src/test/regress/sql/interval.sql 2006-08-05 14:45:52.000000000 +0200 ++++ src/test/regress/sql/interval.sql 2006-08-05 14:46:15.000000000 +0200 +@@ -61,12 +61,6 @@ + + SELECT '' AS ten, * FROM INTERVAL_TBL; + +--- test avg(interval), which is somewhat fragile since people have been +--- known to change the allowed input syntax for type interval without +--- updating pg_aggregate.agginitval +- +-select avg(f1) from interval_tbl; +- + -- test long interval input + select '4 millenniums 5 centuries 4 decades 1 year 4 months 4 days 17 minutes 31 seconds'::interval; + +--- src/test/regress/expected/interval.out 2006-08-05 14:46:23.000000000 +0200 ++++ src/test/regress/expected/interval.out 2006-08-05 14:46:51.000000000 +0200 +@@ -212,15 +212,6 @@ + | @ 5 mons 12 hours + (10 rows) + +--- test avg(interval), which is somewhat fragile since people have been +--- known to change the allowed input syntax for type interval without +--- updating pg_aggregate.agginitval +-select avg(f1) from interval_tbl; +- avg +-------------------------------------------------- +- @ 4 years 1 mon 9 days 28 hours 18 mins 23 secs +-(1 row) +- + -- test long interval input + select '4 millenniums 5 centuries 4 decades 1 year 4 months 4 days 17 minutes 31 seconds'::interval; + interval diff --git a/dev-db/postgresql/files/postgresql-8.1.8-regress_su.patch b/dev-db/postgresql/files/postgresql-8.1.8-regress_su.patch new file mode 100644 index 000000000000..28e29253dacb --- /dev/null +++ b/dev-db/postgresql/files/postgresql-8.1.8-regress_su.patch @@ -0,0 +1,116 @@ +--- src/test/regress/pg_regress.sh 2006-08-01 10:57:17.000000000 +0200 ++++ src/test/regress/pg_regress.sh 2006-08-04 00:14:39.000000000 +0200 +@@ -81,8 +81,8 @@ + # Initialize default settings + # ---------- + +-: ${inputdir=.} +-: ${outputdir=.} ++: ${inputdir=PORTAGETEMPDIRPG} ++: ${outputdir=PORTAGETEMPDIRPG} + + libdir='@libdir@' + bindir='@bindir@' +@@ -410,7 +410,8 @@ + message "initializing database system" + [ "$debug" = yes ] && initdb_options="--debug" + [ "$nolocale" = yes ] && initdb_options="$initdb_options --no-locale" +- "$bindir/initdb" -D "$PGDATA" -L "$datadir" --noclean $initdb_options >"$LOGDIR/initdb.log" 2>&1 ++ chown portage "${datadir}" "${temp_install}" "${inputdir}/testtablespace" ++ su -s /bin/sh -l portage -c "PGTZ='PST8PDT' PGDATESTYLE='ISO, MDY' $bindir/initdb -D '$PGDATA' -L '$datadir' --noclean $initdb_options" >"$LOGDIR/initdb.log" 2>&1 + + if [ $? -ne 0 ] + then +@@ -433,7 +434,7 @@ + else + postmaster_options="$postmaster_options -c listen_addresses=" + fi +- "$bindir/postmaster" -D "$PGDATA" -F $postmaster_options >"$LOGDIR/postmaster.log" 2>&1 & ++ su -s /bin/sh -l portage -c "PGTZ='PST8PDT' PGDATESTYLE='ISO, MDY' $bindir/postmaster -D '$PGDATA' -F $postmaster_options" >"$LOGDIR/postmaster.log" 2>&1 & + postmaster_pid=$! + + # Wait till postmaster is able to accept connections (normally only +@@ -441,7 +442,7 @@ + # wait forever, however. + i=0 + max=60 +- until "$bindir/psql" -X $psql_options postgres </dev/null 2>/dev/null ++ until su -s /bin/sh -l portage -c "PGTZ='PST8PDT' PGDATESTYLE='ISO, MDY' $bindir/psql -X $psql_options postgres </dev/null 2>/dev/null" + do + i=`expr $i + 1` + if [ $i -ge $max ] +@@ -498,7 +499,7 @@ + fi + + message "dropping database \"$dbname\"" +- "$bindir/dropdb" $psql_options "$dbname" ++ su -s /bin/sh -l portage -c "PGTZ='PST8PDT' PGDATESTYLE='ISO, MDY' $bindir/dropdb $psql_options '$dbname'" + # errors can be ignored + fi + +@@ -538,17 +539,17 @@ + # ---------- + + message "creating database \"$dbname\"" +-"$bindir/createdb" $encoding_opt $psql_options --template template0 "$dbname" ++su -s /bin/sh -l portage -c "PGTZ='PST8PDT' PGDATESTYLE='Postgres, MDY' $bindir/createdb $encoding_opt $psql_options --template template0 '$dbname'" + if [ $? -ne 0 ]; then + echo "$me: createdb failed" + (exit 2); exit + fi + +-"$bindir/psql" -q -X $psql_options -c "\ ++su -s /bin/sh -l portage -c "PGTZ='PST8PDT' PGDATESTYLE='Postgres, MDY' $bindir/psql -q -X $psql_options -c \"\ + alter database \"$dbname\" set lc_messages to 'C'; + alter database \"$dbname\" set lc_monetary to 'C'; + alter database \"$dbname\" set lc_numeric to 'C'; +-alter database \"$dbname\" set lc_time to 'C';" "$dbname" ++alter database \"$dbname\" set lc_time to 'C';\" '$dbname'" + if [ $? -ne 0 ]; then + echo "$me: could not set database default locales" + (exit 2); exit +@@ -560,7 +561,7 @@ + # ---------- + + message "dropping regression test user accounts" +-"$bindir/psql" -q -X $psql_options -c 'DROP GROUP regressgroup1; DROP GROUP regressgroup2; DROP USER regressuser1, regressuser2, regressuser3, regressuser4;' $dbname 2>/dev/null ++su -s /bin/sh -l portage -c "PGTZ='PST8PDT' PGDATESTYLE='Postgres, MDY' $bindir/psql -q -X $psql_options -c 'DROP GROUP regressgroup1; DROP GROUP regressgroup2; DROP USER regressuser1, regressuser2, regressuser3, regressuser4;' '$dbname' 2>/dev/null" + if [ $? -eq 2 ]; then + echo "$me: could not drop user accounts" + (exit 2); exit +@@ -575,7 +576,7 @@ + for lang in xyzzy $load_langs ; do + if [ "$lang" != "xyzzy" ]; then + message "installing $lang" +- "$bindir/createlang" $psql_options $lang $dbname ++ su -s /bin/sh -l portage -c "PGTZ='PST8PDT' PGDATESTYLE='Postgres, MDY' $bindir/createlang $psql_options $lang '$dbname'" + if [ $? -ne 0 ] && [ $? -ne 2 ]; then + echo "$me: createlang $lang failed" + (exit 2); exit +@@ -635,7 +636,7 @@ + # Run a single test + formatted=`echo $1 | awk '{printf "%-20.20s", $1;}'` + $ECHO_N "test $formatted ... $ECHO_C" +- ( $PSQL -d "$dbname" <"$inputdir/sql/$1.sql" >"$outputdir/results/$1.out" 2>&1 )& ++ ( su -s /bin/sh -l portage -c "PGTZ='PST8PDT' PGDATESTYLE='Postgres, MDY' ${PSQL} -d '${dbname}' < '${inputdir}/sql/${1}.sql' > '${outputdir}/results/${1}.out' 2>&1" )& + wait + else + # Start a parallel group +@@ -646,7 +647,7 @@ + fi + for name do + ( +- $PSQL -d "$dbname" <"$inputdir/sql/$name.sql" >"$outputdir/results/$name.out" 2>&1 ++ su -s /bin/sh -l portage -c "PGTZ='PST8PDT' PGDATESTYLE='Postgres, MDY' ${PSQL} -d '${dbname}' < '${inputdir}/sql/${name}.sql' > '${outputdir}/results/${name}.out' 2>&1" + $ECHO_N " $name$ECHO_C" + ) & + if [ $maxconnections -gt 0 ] ; then +@@ -740,7 +741,7 @@ + + if [ -n "$postmaster_pid" ]; then + message "shutting down postmaster" +- "$bindir/pg_ctl" -s -D "$PGDATA" stop ++ su -s /bin/sh -l portage -c "PGTZ='PST8PDT' PGDATESTYLE='Postgres, MDY' $bindir/pg_ctl -s -D '$PGDATA' stop" + wait "$postmaster_pid" + unset postmaster_pid + fi diff --git a/dev-db/postgresql/files/postgresql-8.1.8-sh.patch b/dev-db/postgresql/files/postgresql-8.1.8-sh.patch new file mode 100644 index 000000000000..6350771080e8 --- /dev/null +++ b/dev-db/postgresql/files/postgresql-8.1.8-sh.patch @@ -0,0 +1,34 @@ +--- src/include/storage/s_lock.h 2005-01-01 07:03:42.000000000 +0900 ++++ src/include/storage/s_lock.h 2005-08-17 23:09:19.000000000 +0900 +@@ -300,6 +300,31 @@ + #endif /* __s390__ || __s390x__ */ + + ++#if defined(__sh__) ++#define HAS_TEST_AND_SET ++ ++typedef unsigned char slock_t; ++ ++#define TAS(lock) tas(lock) ++ ++static __inline__ int ++tas(volatile slock_t *lock) ++{ ++ register int _res = 1; ++ ++ __asm__ __volatile__( ++ "tas.b @%1\n\t" ++ "movt %0\n\t" ++ "xor #1,%0" ++: "=z"(_res) ++: "r"(lock) ++: "t","memory"); ++ return _res; ++} ++ ++#endif /* __sh__ */ ++ ++ + #if defined(__sparc__) + #define HAS_TEST_AND_SET + diff --git a/dev-db/postgresql/postgresql-8.1.8.ebuild b/dev-db/postgresql/postgresql-8.1.8.ebuild new file mode 100644 index 000000000000..9224d0b53b08 --- /dev/null +++ b/dev-db/postgresql/postgresql-8.1.8.ebuild @@ -0,0 +1,247 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-8.1.8.ebuild,v 1.1 2007/02/12 03:34:18 mjolnir 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." +} |