diff options
author | Mike Gilbert <floppym@gentoo.org> | 2014-04-28 00:18:43 +0000 |
---|---|---|
committer | Mike Gilbert <floppym@gentoo.org> | 2014-04-28 00:18:43 +0000 |
commit | 881a65b714f2e3d459aed130e6abbd5baf918d3e (patch) | |
tree | ca5ab9e52f6ac0989f0a92bfd53462519e306d4f /dev-db | |
parent | version bump wrt #508616 (diff) | |
download | historical-881a65b714f2e3d459aed130e6abbd5baf918d3e.tar.gz historical-881a65b714f2e3d459aed130e6abbd5baf918d3e.tar.bz2 historical-881a65b714f2e3d459aed130e6abbd5baf918d3e.zip |
Substitute LIBDIR in initscript and systemd unit, bug 489632.
Package-Manager: portage-2.2.10/cvs/Linux x86_64
Manifest-Sign-Key: 0x0BBEEA1FEA4843A4
Diffstat (limited to 'dev-db')
-rw-r--r-- | dev-db/postgresql-server/ChangeLog | 8 | ||||
-rw-r--r-- | dev-db/postgresql-server/Manifest | 10 | ||||
-rw-r--r-- | dev-db/postgresql-server/postgresql-server-9.3.4-r1.ebuild | 353 |
3 files changed, 366 insertions, 5 deletions
diff --git a/dev-db/postgresql-server/ChangeLog b/dev-db/postgresql-server/ChangeLog index d2a426b3c6e6..2559ce1918cf 100644 --- a/dev-db/postgresql-server/ChangeLog +++ b/dev-db/postgresql-server/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-db/postgresql-server # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.293 2014/04/27 21:03:33 floppym Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.294 2014/04/28 00:18:39 floppym Exp $ + +*postgresql-server-9.3.4-r1 (28 Apr 2014) + + 28 Apr 2014; Mike Gilbert <floppym@gentoo.org> + +postgresql-server-9.3.4-r1.ebuild: + Substitute LIBDIR in initscript and systemd unit, bug 489632. 27 Apr 2014; Mike Gilbert <floppym@gentoo.org> postgresql-server-9.3.4.ebuild, postgresql-server-9999.ebuild: diff --git a/dev-db/postgresql-server/Manifest b/dev-db/postgresql-server/Manifest index 855c91dd46b3..115d5a776c66 100644 --- a/dev-db/postgresql-server/Manifest +++ b/dev-db/postgresql-server/Manifest @@ -14,6 +14,7 @@ DIST postgresql-9.3.4.tar.bz2 16691447 SHA256 9ee819574dfc8798a448dc23a99510d2d8 DIST postgresql-initscript-2.4.tbz2 2604 SHA256 4f17a2a26ec078b7f73d2b5fa7338402829fe195676d6c3f2cda6cd75c3d1e23 SHA512 2e92bb4f2ddbdfbafa9a6451ebf8be121cf66b7731c42c61f9978a4a896e7d8987fc3b2e5c6feef22a5f7b5759c3456c91e1869ba30019f71ed6b6088adf955e WHIRLPOOL 6df5d827a9fc2d78084d5c300fefa767f87af4a6918abefeea99396ecdace8966ee2c2b4f2276454a3f77df64ec7522aeb2cc1fcac8e321d091f60cc1071a13f DIST postgresql-initscript-2.5.tbz2 3280 SHA256 723b2564572722171e097b165a72453b788cb4451638677dcc5f853cbd2d3c09 SHA512 3de3c113cc121b7c1e1a28580ad83fa95f613ba082bffaec9c5feba8bf022ce069246553cd027cc82fbc7a8ea72a5782c2b04186a9765612571ab876c38555bf WHIRLPOOL 8bd84f0a58a3cebf078aeaba2cf9f8eaaeb0933aac0b89f4f8f981604c42ae43a06ca1fdf37a635f90d8957440049d9d7d4ad76bf143d42f44b5374fa98ef2de DIST postgresql-initscript-2.6.tbz2 3499 SHA256 0ab0e175a2ed735c330fd2e1c659c1130ae7217fea8d3804d5b5eb74c68ddac1 SHA512 b5c8add696b755e422db4b419c3aa8078b8f3b63e15ad2d100c8f81e654c02eee6c1971a7129d72de201afacdc72dcc50674b79e054be81d575ae1339b2e239b WHIRLPOOL 7bfc03a83f24f2a1a88bab86c71bdecaa14f4a4bb3eb12c46d6a164f9c1aad891e94445a59c55e1168a5dd5c85c78aa5198425c1914d26de86d0f22de5d031af +DIST postgresql-initscript-2.7.tbz2 3836 SHA256 fecc05fb75f782da1d8215af49134bfe593b94547458ff90692c14058384bfa2 SHA512 8ad9eba3e83d8b296ed1a035716c11c3a7b6a316470327919f168ef8fe861261b5eeb5275e8b643c94b17a94b38e2011c85dde5459b2f9c6f462a2f967f8f315 WHIRLPOOL 4de1ed1b0d8c1a3d56cf3b62456756764a9670e9655ee9f904dc2fba764f32313a74be9676544cca1fc684370b633950ccc4443ed2e59bb053e2a315b5c76b4e DIST postgresql-initscript-pre92-2.6.tbz2 7826 SHA256 eb041a09011eb47da5daa62e0971a5fed6e7e308c54b5c7f840d9f49e42adc28 SHA512 b9d15ae6812a747907008606b8e89499b228cc10eda38c503a133b02c1151316ef414b6e72a9d26c3dcc87d153f26f38b0901e338e6bdd530327bf474394df8a WHIRLPOOL a218f715aa02acae27a25daedc72c2a5069060a0d4f3cd572a95ca295d0ed822453bb468fba461adf57f36978c6968bb8ebeb6c6d786f9c3baca4a346f483480 DIST postgresql-patches-8.4-r3.tbz2 4821 SHA256 f2c47ff5cf6af20020c87bc34362615af66675d7d44dd020ccfae425880e1ace SHA512 149434a1a55f130b91b87591ac6bbbd263893e90facfdc47418320561a91cb818dea6367af5b8afbb6c9cccea6053692ee3008c62cbe40e8819c7cac04389334 WHIRLPOOL 30d5945bd65e07f114d8ee27bcbc1dc7ae136a2b5a1f62ec44aad325208dc8387ae11f58c21ebf1447822b35fe35b79d64c86cf763e146dc9c2b5da7dc883d47 DIST postgresql-patches-9.0-r4.tbz2 4525 SHA256 96f9af00dea1c33f9c77754e8ee37334012b8098361c321bd3f562ca9c32f6b8 SHA512 1e792eaf1e194e7a109a860216de98929bc12e6905846524e795fed7e8506f8f0e2e7349ead4fd9ba196c8eb6af2f5b143d0eecdb4cb7061253257acbce37873 WHIRLPOOL 8a32c0cd7f6b845496df8d1f6a0b2497625c0da36c5af1d651be086e9cd4faec48b56b04dca894a0e43e91309868db3014213d9989da5fd1d52d5b3775f8c1ad @@ -29,14 +30,15 @@ EBUILD postgresql-server-9.1.13.ebuild 11488 SHA256 bd179f5a9ed2fb06d31700b0eaf5 EBUILD postgresql-server-9.2.7.ebuild 11175 SHA256 ba87b3e1ecf88bdd4488b72eb9ff74ddb53d1d2ac5437a8eb744c911682e5adb SHA512 384a7a821e2275998ed7745657c667fb49ef8da0fb2e3a8a2eee50563ebb89293483d91619b0ec8a6aecf84e09d35afa834481234c1bcc31c913cb4ddc78bcc3 WHIRLPOOL cfc76da68a6a58a3cef591d300c3f282abdc089c34d01d02326de2b1aba5b0cec193ff23856c7d1b180197d6e4795d6a5bce0f46fd0320bf6a02d9d3c0ab3419 EBUILD postgresql-server-9.2.8.ebuild 11190 SHA256 3c2faac32c245e5489490be7a7678c7467626d04d0dd4df3104bed55de9d099f SHA512 5196cd1c3163fc3c847e4b035d6c7c2e3a41a8d7cfd90ba4945248c14b0b9999c688091f35dbc0cb7ad7c09abcfcfd4e45ac73ad6326a90586525ab56b6876d5 WHIRLPOOL 4e889ac5bc6b51907b0b61a8f338823478c12f836fedf1e1482e5e5095655d4c377b2a38390a6bbe9735b5d028aa5ba6b81f53af7aa552537681b990709b7d55 EBUILD postgresql-server-9.3.3.ebuild 11111 SHA256 42601de389a861a90a77ae71dfbfe632d563cf26b3347bb5b7011973c896dddb SHA512 9ca3fb7a69c8ab1933ed3c794df9079065aa6ac3c83c70df237d06c0363efd247ac89a549d35aff784092fe84d64ddd91a4e7fafe377e84c96e16df03f046eaf WHIRLPOOL bb76875b15973e2e685115a635d63d11a51bb8a54c228915f90a2e976dd4d22f9ce0f03de33e482d70c1f0d8e5fc297a7dff28fb1e73d7e5359e104bc4944674 +EBUILD postgresql-server-9.3.4-r1.ebuild 11313 SHA256 c5bb02ba018332d11daaf7a5de09295e27f3d0dc63d280ec966a5c7501f6affd SHA512 76c5c7b0cfadc8541cf4a3a2884f0bca61623d2b3cc461e0462e9f628fcca83d27da6a1c85000ccd97c20de21592eab247d05e9950a1b0f486f8b72c64db0992 WHIRLPOOL d3d33c85898abcbc99e6a1b0f13b42f99a3ec5615f79d44e2f2ad03f982f6f83d3439373ec0fe8c6e0f6d110243e3555cbdfcaba04ceb80a1705c312d45ca37b EBUILD postgresql-server-9.3.4.ebuild 11125 SHA256 f5da0be53dad1638afcfd435cf082633800df6cdd1754334f77af1025eaac3db SHA512 f98f10e34157916e6bb5f13b6cdd409d6af445d6f02d5da23ec9f6f3a8005b0e3ad28d88787898ab4e776b28eec34a53584ee9177c8f13e93945e69a7ba73e0e WHIRLPOOL 3b419cf1a4dbb5e69dcee790cd43f38f44ec597ca24b9ff5dd9c3d1cff1faddb44b7135cad79d65c4fda49f36de3a95febe3fc1682d4bdc6e40c0e4956814659 EBUILD postgresql-server-9999.ebuild 11313 SHA256 05931141d0584bf8289a13f1acba5a8ded3bba9084971d6e0786b473a6893f42 SHA512 1212e5ae6400ea5c9fbe9d8ed7d89653f404cb1b6df43cc4d7b78885adbdc346a3fbed510718ac5231c8e019001ec1acc982ce0a5b88b80fe4fa1831ac264d86 WHIRLPOOL a186d6d6f6bd56e9ac24c0836d0089d5c9492c232e66888be34aa428f2d14c9f1eb6b2b97fcb2072c14d5ba777ad45da875f6c5e67db12458a3c495d9a6f0bd6 -MISC ChangeLog 85184 SHA256 1eb08634abaa775165c0ff7acd03b9ca4c0e175756b083455b5f313986df2d4f SHA512 7f3cdb87a3f8b7edf4b0364799e0797faab9d62fadfd9bf556ebbcfd6b2f81fd0263a7011578427c030a806751d1bad37a6996e4f9663e4826960ead8356d2f2 WHIRLPOOL 03f6f80d1a5e137ed27cc56aef9a4288b94620f68c6d83cae31a43dc43d77c4b77af9fc00d1f9bacba2523cded5e28829f8d9fc1c214cb0fa50be41857d6253e +MISC ChangeLog 85379 SHA256 254dad63d4abb36c4783a1a0f2c9b61086825bdbf1abf112913eee04fe73ea4e SHA512 5fd8e45d7e25e0c0380fd01dffda38213768cadd994812049201c228daa6bf69c074a89314b42728bf2713e1048154aa4fbdcd43b68a74835b3689cc110fa11e WHIRLPOOL a683302a67e4736e9f2547d5977b4254dcf6b9e2de9c4e691d6733833bc6816e3c49dcc2f6436e21dada4a2043192b1303007c27a9bdaa1876e7ebcc95090b39 MISC metadata.xml 420 SHA256 ac37a5084450a782d02510149d030bd0d4a63164f2ffb7bdda3ddf344606ca62 SHA512 1731bced1ac398d90c6aca6ec209a9ea42deb0f7033d49952a6216349aeb992479c3e868b33cc1be2434cdead6185026503a58e779965455d0198edd87bf5b4c WHIRLPOOL 3bbd5598492cb7d90f4199fac80f27bcba281e1188f7f1d40ee3dd1561e530de13de109142f0add7221b49ec3a9c6a0bdb3add1446b1cc5a6cb3909fd193d19b -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) -iF4EAREIAAYFAlNdcKcACgkQC77qH+pIQ6R4cwD/fpi9ksQAjXy10A0og9SumWbE -5Oxm6sqxkymcSpgwQqYBALXHJe+gLykFFnoq4+tLBVdRkMSGQ4vW1ZxXnJpaS1Ts -=YCan +iF4EAREIAAYFAlNdnmIACgkQC77qH+pIQ6SL6gD+Mz/b42zz+Gs5QyuNBhGpVC+G +kMAOYAr/bcgtgLh/lsABAMCUO1nqOCTb8l5Px35CGj+600EsTozCRV+qsNHLUEFG +=Ari5 -----END PGP SIGNATURE----- diff --git a/dev-db/postgresql-server/postgresql-server-9.3.4-r1.ebuild b/dev-db/postgresql-server/postgresql-server-9.3.4-r1.ebuild new file mode 100644 index 000000000000..5ccf118b9c79 --- /dev/null +++ b/dev-db/postgresql-server/postgresql-server-9.3.4-r1.ebuild @@ -0,0 +1,353 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.3.4-r1.ebuild,v 1.1 2014/04/28 00:18:39 floppym Exp $ + +EAPI="5" + +PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} ) +WANT_AUTOMAKE="none" + +inherit autotools eutils flag-o-matic multilib pam prefix python-single-r1 systemd user versionator + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" + +SLOT="$(get_version_component_range 1-2)" +S="${WORKDIR}/postgresql-${PV}" +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2 + http://dev.gentoo.org/~titanofold/postgresql-patches-${SLOT}-r1.tbz2 + http://dev.gentoo.org/~floppym/dist/postgresql-initscript-2.7.tbz2" + +LICENSE="POSTGRESQL GPL-2" +DESCRIPTION="PostgreSQL server" +HOMEPAGE="http://www.postgresql.org/" + +LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW" +IUSE="doc kerberos kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl test uuid xml" + +for lingua in ${LINGUAS}; do + IUSE+=" linguas_${lingua}" +done + +wanted_languages() { + local enable_langs + + for lingua in ${LINGUAS} ; do + use linguas_${lingua} && enable_langs+="${lingua} " + done + + echo -n ${enable_langs} +} + +RDEPEND=" +~dev-db/postgresql-base-${PV}[kerberos?,pam?,pg_legacytimestamp=,python=,nls=] +perl? ( >=dev-lang/perl-5.8 ) +python? ( ${PYTHON_DEPS} ) +selinux? ( sec-policy/selinux-postgresql ) +tcl? ( >=dev-lang/tcl-8 ) +uuid? ( dev-libs/ossp-uuid ) +xml? ( dev-libs/libxml2 dev-libs/libxslt ) +" + +DEPEND="${RDEPEND} +sys-devel/flex +xml? ( virtual/pkgconfig ) +" + +PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )" + +pkg_setup() { + enewgroup postgres 70 + enewuser postgres 70 /bin/bash /var/lib/postgresql postgres + + use python && python-single-r1_pkg_setup +} + +src_prepare() { + epatch "${WORKDIR}/autoconf.patch" \ + "${WORKDIR}/bool.patch" \ + "${WORKDIR}/server.patch" \ + "${WORKDIR}/run-dir.patch" + + eprefixify src/include/pg_config_manual.h + + if use pam ; then + sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ + -i src/backend/libpq/auth.c \ + || die 'PGSQL_PAM_SERVICE rename failed.' + fi + + if use perl ; then + sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ + -i "${S}/src/pl/plperl/GNUmakefile" || die 'sed plperl failed' + fi + + if use test ; then + epatch "${WORKDIR}/regress.patch" + sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c \ + || die 'Failed regress sed' + else + echo "all install:" > "${S}/src/test/regress/GNUmakefile" + fi + + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ + -i "${WORKDIR}"/postgresql{.{init,confd,service},-check-db-dir} || + die "SLOT/LIBDIR sed failed" + + eautoconf +} + +src_configure() { + case ${CHOST} in + *-darwin*|*-solaris*) + use nls && append-libs intl + ;; + esac + + local PO="${EPREFIX%/}" + + # eval is needed to get along with pg_config quotation of space-rich entities. + eval econf "$(${PO}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \ + $(use_with perl) \ + $(use_with tcl) \ + $(use_with xml libxml) \ + $(use_with xml libxslt) \ + $(use_with uuid ossp-uuid) \ + --with-system-tzdata="${PO}/usr/share/zoneinfo" \ + --with-includes="${PO}/usr/include/postgresql-${SLOT}/" \ + --with-libraries="${PO}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \ + "$(use_enable nls nls "$(wanted_languages)")" +} + +src_compile() { + local bd + for bd in . contrib $(use xml && echo contrib/xml2); do + PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ + emake -C $bd || die "emake in $bd failed" + done +} + +src_install() { + local bd + for bd in . contrib $(use xml && echo contrib/xml2) ; do + PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ + emake install -C $bd DESTDIR="${D}" || die "emake install in $bd failed" + done + + # Avoid file collision with -base. + rm "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)/libpgcommon.a" + + dodir /etc/eselect/postgresql/slots/${SLOT} + echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ + "${ED}/etc/eselect/postgresql/slots/${SLOT}/server" + + newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} + newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} + + systemd_newunit "${WORKDIR}"/postgresql.service postgresql-${SLOT}.service + systemd_newtmpfilesd "${WORKDIR}"/postgresql.tmpfilesd postgresql-${SLOT}.conf + + insinto /usr/bin/ + newbin "${WORKDIR}"/postgresql-check-db-dir postgresql-${SLOT}-check-db-dir + + use pam && pamd_mimic system-auth postgresql-${SLOT} auth account session + + if use prefix ; then + keepdir /run/postgresql + fperms 0775 /run/postgresql + fi +} + +pkg_postinst() { + postgresql-config update + + elog "Gentoo specific documentation:" + elog "http://www.gentoo.org/doc/en/postgres-howto.xml" + elog + elog "Official documentation:" + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" + elog + elog "The default location of the Unix-domain socket is:" + elog " ${EROOT%/}/run/postgresql/" + elog + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" + elog "so that it contains your preferred locale in:" + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + elog + elog "Then, execute the following command to setup the initial database" + elog "environment:" + elog " emerge --config =${CATEGORY}/${PF}" +} + +pkg_prerm() { + if [[ -z ${REPLACED_BY_VERSION} ]] ; then + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" + ewarn "\thttp://www.gentoo.org/doc/en/postgres-howto.xml#doc_chap5" + + ebegin "Resuming removal in 10 seconds (Control-C to cancel)" + sleep 10 + eend 0 + fi +} + +pkg_postrm() { + postgresql-config update +} + +pkg_config() { + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" + [[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" + + # environment.bz2 may not contain the same locale as the current system + # locale. Unset and source from the current system locale. + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then + unset LANG + unset LC_CTYPE + unset LC_NUMERIC + unset LC_TIME + unset LC_COLLATE + unset LC_MONETARY + unset LC_MESSAGES + unset LC_ALL + source "${EROOT%/}/etc/env.d/02locale" + [ -n "${LANG}" ] && export LANG + [ -n "${LC_CTYPE}" ] && export LC_CTYPE + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC + [ -n "${LC_TIME}" ] && export LC_TIME + [ -n "${LC_COLLATE}" ] && export LC_COLLATE + [ -n "${LC_MONETARY}" ] && export LC_MONETARY + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES + [ -n "${LC_ALL}" ] && export LC_ALL + fi + + einfo "You can modify the paths and options passed to initdb by editing:" + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" + einfo + einfo "Information on options that can be passed to initdb are found at:" + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" + einfo + einfo "PG_INITDB_OPTS is currently set to:" + if [[ -z "${PG_INITDB_OPTS}" ]] ; then + einfo " (none)" + else + einfo " ${PG_INITDB_OPTS}" + fi + einfo + einfo "Configuration files will be installed to:" + einfo " ${PGDATA}" + einfo + einfo "The database cluster will be created in:" + einfo " ${DATA_DIR}" + einfo + while [ "$correct" != "true" ] ; do + einfo "Are you ready to continue? (y/n)" + read answer + if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then + correct="true" + elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then + die "Aborting initialization." + else + echo "Answer not recognized" + fi + done + + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then + eerror "The given directory, '${DATA_DIR}', is not empty." + eerror "Modify DATA_DIR to point to an empty directory." + die "${DATA_DIR} is not empty." + fi + + [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128" + einfo "Checking system parameters..." + + if ! use kernel_linux ; then + einfo "Skipped." + einfo " Tests not supported on this OS (yet)" + else + if [ -z ${SKIP_SYSTEM_TESTS} ] ; then + einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..." + + local SEMMSL=$(sysctl -n kernel.sem | cut -f1) + local SEMMNS=$(sysctl -n kernel.sem | cut -f2) + local SEMMNI=$(sysctl -n kernel.sem | cut -f4) + local SHMMAX=$(sysctl -n kernel.shmmax) + + local SEMMSL_MIN=17 + local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 )) + local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 )) + local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) )) + + for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do + if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then + eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)" + eerror "You have now several options:" + eerror " - Change the mentioned system parameter" + eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a" + eerror " value lower than ${PG_MAX_CONNECTIONS}" + eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely" + eerror "More information can be found here:" + eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html" + die "System test failed." + fi + done + einfo "Passed." + else + ewarn "SKIP_SYSTEM_TESTS set, so skipping." + fi + fi + + einfo "Creating the data directory ..." + if [[ ${EUID} == 0 ]] ; then + mkdir -p "${DATA_DIR}" + chown -Rf postgres:postgres "${DATA_DIR}" + chmod 0700 "${DATA_DIR}" + fi + + einfo "Initializing the database ..." + + if [[ ${EUID} == 0 ]] ; then + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" + else + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} + fi + + mv "${DATA_DIR%/}"/*.conf "${PGDATA}" + + einfo "The autovacuum function, which was in contrib, has been moved to the main" + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" + einfo "by default. You can disable it in the cluster's:" + einfo " ${PGDATA%/}/postgresql.conf" + einfo + einfo "The PostgreSQL server, by default, will log events to:" + einfo " ${DATA_DIR%/}/postmaster.log" + einfo + if use prefix ; then + einfo "The location of the configuration files have moved to:" + einfo " ${PGDATA}" + einfo "To start the server:" + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" + einfo "To stop:" + einfo " pg_ctl stop -D ${DATA_DIR}" + einfo + einfo "Or move the configuration files back:" + einfo "mv ${PGDATA}*.conf ${DATA_DIR}" + else + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" + einfo "instead of 'pg_ctl'." + fi +} + +src_test() { + einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" + + if [ ${UID} -ne 0 ] ; then + emake check + + einfo "If you think other tests besides the regression tests are necessary, please" + einfo "submit a bug including a patch for this ebuild to enable them." + else + ewarn "Tests cannot be run as root. Skipping." + ewarn "HINT: FEATURES=\"userpriv\"" + fi +} |