From: "Aaron Swenson" <titanofold@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/postgresql/, dev-db/postgresql/files/
Date: Sat, 7 Oct 2017 20:20:23 +0000 (UTC) [thread overview]
Message-ID: <1507407615.9d489165499bc17cf58f7872b13327b160355af3.titanofold@gentoo> (raw)
commit: 9d489165499bc17cf58f7872b13327b160355af3
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 7 20:19:36 2017 +0000
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Sat Oct 7 20:20:15 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d489165
dev-db/postgresql: Improved systemd support
Now multiple slots can run simultaneously. Thank you Evert.
Bump live ebuild EAPI to 6 and switched to git-r3 eclass.
Gentoo-Bug: https://bugs.gentoo.org/632496
Package-Manager: Portage-2.3.8, Repoman-2.3.3
dev-db/postgresql/files/postgresql.service-9.2 | 51 ++++
dev-db/postgresql/files/postgresql.service-9.6-r1 | 52 ++++
dev-db/postgresql/files/postgresql.tmpfiles | 1 +
...resql-9999.ebuild => postgresql-10.0-r1.ebuild} | 271 +++++++++++----------
...sql-9999.ebuild => postgresql-9.2.23-r1.ebuild} | 228 ++++++++---------
...sql-9999.ebuild => postgresql-9.3.19-r1.ebuild} | 223 ++++++++---------
...sql-9999.ebuild => postgresql-9.4.14-r1.ebuild} | 259 +++++++++++---------
...esql-9999.ebuild => postgresql-9.5.9-r1.ebuild} | 263 +++++++++++---------
...esql-9999.ebuild => postgresql-9.6.5-r1.ebuild} | 248 +++++++++++--------
dev-db/postgresql/postgresql-9999.ebuild | 19 +-
10 files changed, 932 insertions(+), 683 deletions(-)
diff --git a/dev-db/postgresql/files/postgresql.service-9.2 b/dev-db/postgresql/files/postgresql.service-9.2
new file mode 100644
index 00000000000..20ed27a10f2
--- /dev/null
+++ b/dev-db/postgresql/files/postgresql.service-9.2
@@ -0,0 +1,51 @@
+# It's not recommended to modify this file in-place, because it will be
+# overwritten during package upgrades. If you want to customize, the
+# best way is to create file
+# "/etc/systemd/system/postgresql-@SLOT@.service.d/*.conf"
+# containing your changes
+
+# For example, if you want to change the server's port number to 5433,
+# create a file named
+# "/etc/systemd/system/postgresql-@SLOT@.service.d/port.conf"
+# containing:
+# [Service]
+# Environment=PGPORT=5433
+# This will override the setting appearing below.
+
+[Unit]
+Description=PostgreSQL database server
+After=network.target
+
+[Service]
+Type=forking
+
+User=postgres
+Group=postgres
+
+# Port number for server to listen on
+Environment=PGPORT=5432
+
+# Location of configuration files
+Environment=PGDATA=/etc/postgresql-@SLOT@
+
+# Where the data directory is located
+Environment=DATA_DIR=/var/lib/postgresql/@SLOT@/data
+
+# Where to send early-startup messages from the server (before the logging
+# options of postgresql.conf take effect)
+# This is normally controlled by the global default set by systemd
+# StandardOutput=syslog
+
+ExecStartPre=/usr/bin/postgresql-@SLOT@-check-db-dir
+ExecStart=/usr/@LIBDIR@/postgresql-@SLOT@/bin/pg_ctl start -D ${DATA_DIR} -s -l ${DATA_DIR}/postmaster.log -o "-p ${PGPORT} -D ${PGDATA} --data-directory=${DATA_DIR}" -w -t 300
+ExecStop=/usr/@LIBDIR@/postgresql-@SLOT@/bin/pg_ctl stop -D ${DATA_DIR} -s -m fast
+ExecReload=/usr/@LIBDIR@/postgresql-@SLOT@/bin/pg_ctl reload -D ${DATA_DIR} -s
+
+# Give a reasonable amount of time for the server to start up/shut down
+TimeoutSec=300
+
+# Disable OOM kill on the postmaster
+OOMScoreAdjust=-1000
+
+[Install]
+WantedBy=multi-user.target
diff --git a/dev-db/postgresql/files/postgresql.service-9.6-r1 b/dev-db/postgresql/files/postgresql.service-9.6-r1
new file mode 100644
index 00000000000..3b92e851f29
--- /dev/null
+++ b/dev-db/postgresql/files/postgresql.service-9.6-r1
@@ -0,0 +1,52 @@
+# It's not recommended to modify this file in-place, because it will be
+# overwritten during package upgrades. If you want to customize, the
+# best way is to create file
+# "/etc/systemd/system/postgresql-@SLOT@.service.d/*.conf"
+# containing your changes
+
+# For example, if you want to change the server's port number to 5433,
+# create a file named
+# "/etc/systemd/system/postgresql-@SLOT@.service.d/port.conf"
+# containing:
+# [Service]
+# Environment=PGPORT=5433
+# This will override the setting appearing below.
+
+[Unit]
+Description=PostgreSQL database server
+After=network.target
+
+[Service]
+Type=notify
+
+User=postgres
+Group=postgres
+
+# Port number for server to listen on
+Environment=PGPORT=5432
+
+# Location of configuration files
+Environment=PGDATA=/etc/postgresql-@SLOT@
+
+# Where the data directory is located
+Environment=DATA_DIR=/var/lib/postgresql/@SLOT@/data
+
+# Where to send early-startup messages from the server (before the logging
+# options of postgresql.conf take effect)
+# This is normally controlled by the global default set by systemd
+# StandardOutput=syslog
+
+ExecStartPre=/usr/bin/postgresql-@SLOT@-check-db-dir
+ExecStart=/usr/@LIBDIR@/postgresql-@SLOT@/bin/postgres -p ${PGPORT} -D ${DATA_DIR}
+ExecReload=/bin/kill -HUP $MAINPID
+KillMode=mixed
+KillSignal=SIGINT
+
+# Give a reasonable amount of time for the server to start up/shut down
+TimeoutSec=300
+
+# Disable OOM kill on the postmaster
+OOMScoreAdjust=-1000
+
+[Install]
+WantedBy=multi-user.target
diff --git a/dev-db/postgresql/files/postgresql.tmpfiles b/dev-db/postgresql/files/postgresql.tmpfiles
new file mode 100644
index 00000000000..650ae22b7c1
--- /dev/null
+++ b/dev-db/postgresql/files/postgresql.tmpfiles
@@ -0,0 +1 @@
+d /run/postgresql 1775 root postgres -
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-10.0-r1.ebuild
similarity index 68%
copy from dev-db/postgresql/postgresql-9999.ebuild
copy to dev-db/postgresql/postgresql-10.0-r1.ebuild
index 300a8efb793..18fea4c814b 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-10.0-r1.ebuild
@@ -1,28 +1,30 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-EAPI="5"
+EAPI="6"
PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \
- python-single-r1 systemd user versionator
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
+ systemd user versionator
-KEYWORDS=""
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
-# Bump when rc released.
-SLOT="11"
+SLOT=$(get_major_version)
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
+MY_PV=${PV/_/}
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
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="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
- +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
+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 ldap libressl nls pam perl python +readline
+ selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
for lingua in ${LINGUAS}; do
IUSE+=" linguas_${lingua}"
@@ -49,36 +51,46 @@ pam? ( virtual/pam )
perl? ( >=dev-lang/perl-5.8:= )
python? ( ${PYTHON_DEPS} )
readline? ( sys-libs/readline:0= )
+server? ( systemd? ( sys-apps/systemd ) )
ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
libressl? ( dev-libs/libressl:= )
)
-server? ( systemd? ( sys-apps/systemd ) )
tcl? ( >=dev-lang/tcl-8:0= )
-uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )
zlib? ( sys-libs/zlib )
"
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
+# the libc includes UUID functions.
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
+BSD_LIBC=( elibc_{Free,Net,Open}BSD )
+
+nest_usedep() {
+ local front back
+ while [[ ${#} -gt 1 ]]; do
+ front+="${1}? ( "
+ back+=" )"
+ shift
+ done
+ echo "${front}${1}${back}"
+}
+
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
+CDEPEND+="
+uuid? (
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
+)"
+
DEPEND="${CDEPEND}
!!<sys-apps/sandbox-2.0
->=dev-lang/perl-5.8
-app-text/docbook-dsssl-stylesheets
-app-text/docbook-sgml-dtd:4.2
-app-text/docbook-xml-dtd:4.2
-app-text/docbook-xsl-stylesheets
-app-text/openjade
-dev-libs/libxml2
-dev-libs/libxslt
sys-devel/bison
sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
-src_unpack() {
- base_src_unpack
- git-2_src_unpack
-}
RDEPEND="${CDEPEND}
!dev-db/postgresql-docs:${SLOT}
@@ -87,17 +99,8 @@ RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-postgresql )
"
-pkg_pretend() {
- ewarn "You are using a live ebuild that uses the current source code as it is"
- ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
- ewarn "the GNU Makefiles may be altered by upstream without notice and the"
- ewarn "documentation for this live version is not readily available"
- ewarn "online. Ergo, the ebuild maintainers will not support building a"
- ewarn "client-only and/or document-free version."
-}
-
pkg_setup() {
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
enewgroup postgres 70
enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
@@ -118,13 +121,15 @@ src_prepare() {
# hardened and non-hardened environments. (Bug #528786)
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
+ use server || eapply "${FILESDIR}/${PN}-${SLOT}beta2-no-server.patch"
+
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
- epatch_user
+ eapply_user
}
src_configure() {
@@ -139,6 +144,17 @@ src_configure() {
local PO="${EPREFIX%/}"
+ local i uuid_config=""
+ if use uuid; then
+ for i in ${UTIL_LINUX_LIBC[@]}; do
+ use ${i} && uuid_config="--with-uuid=e2fs"
+ done
+ for i in ${BSD_LIBC[@]}; do
+ use ${i} && uuid_config="--with-uuid=bsd"
+ done
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
+ fi
+
econf \
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
--datadir="${PO}/usr/share/postgresql-${SLOT}" \
@@ -148,7 +164,6 @@ src_configure() {
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \
--with-system-tzdata="${PO}/usr/share/zoneinfo" \
$(use_enable !alpha spinlocks) \
- $(use_enable !pg_legacytimestamp integer-datetimes) \
$(use_enable threads thread-safety) \
$(use_with kerberos gssapi) \
$(use_with ldap) \
@@ -159,7 +174,7 @@ src_configure() {
$(use_with ssl openssl) \
$(usex server "$(use_with systemd)" '--without-systemd') \
$(use_with tcl) \
- $(use_with uuid ossp-uuid) \
+ ${uuid_config} \
$(use_with xml libxml) \
$(use_with xml libxslt) \
$(use_with zlib) \
@@ -167,46 +182,35 @@ src_configure() {
}
src_compile() {
- emake world
+ emake
+ emake -C contrib
}
src_install() {
- emake DESTDIR="${D}" install-world
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install -C contrib
dodoc README HISTORY doc/{TODO,bug.template}
- insinto /etc/postgresql-${SLOT}
- newins src/bin/psql/psqlrc.sample psqlrc
-
- use static-libs || find "${ED}" -name '*.a' -delete
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
-
- if use systemd; then
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6" | \
- systemd_newunit - ${PN}-${SLOT}.service
+ # man pages are already built, but if we have the target make them,
+ # they'll be generated from source before being installed so we
+ # manually install man pages.
+ # We use ${SLOT} instead of doman for postgresql.eselect
+ insinto /usr/share/postgresql-${SLOT}/man/
+ doins -r doc/src/sgml/man{1,3,7}
+ if ! use server; then
+ # Remove man pages for non-existent binaries
+ serverman=(
+ initdb
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby}
+ pg_{test_{fsync,timing},upgrade,waldump}
+ post{gres,master}
+ )
+ for m in ${serverman[@]} ; do
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
+ done
fi
-
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
-
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
-
- local f bn
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
- -mindepth 1 -maxdepth 1)
- do
- bn=$(basename "${f}")
- # Temporarily tack on tmp to workaround a file collision
- # issue. This is only necessary for 9.7 and earlier. 10 never
- # had this issue.
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
- "/usr/bin/${bn}${SLOT/.}tmp"
- done
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
# Create slot specific man pages
local bn f mansec slotted_name
@@ -232,73 +236,82 @@ src_install() {
popd > /dev/null
done
- if use prefix ; then
- keepdir /run/postgresql
- fperms 0775 /run/postgresql
- fi
-}
+ insinto /etc/postgresql-${SLOT}
+ newins src/bin/psql/psqlrc.sample psqlrc
-pkg_preinst() {
- # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
- # /usr/bin/psql97). They may have been created by the
- # postgresql.eselect module, but they're handled within this ebuild
- # now. It's alright if we momentarily delete /usr/bin/psql as it
- # will be recreated by the eselect module in pkg_ppostinst(). We
- # only worry about the 9.7 slot as that's the last slot that had its
- # slot-specific links generated by eselect.
- #
- # This can be removed when 10 is the lowest slot in the tree.
- local canonicalise
- if type -p realpath > /dev/null; then
- canonicalise=realpath
- elif type -p readlink > /dev/null; then
- canonicalise='readlink -f'
- else
- # can't die, subshell
- die "No readlink nor realpath found, cannot canonicalise"
- fi
+ use static-libs || find "${ED}" -name '*.a' -delete
- local l
- # First remove any symlinks in /usr/bin that may have been created
- # by the old eselect
- for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}"
+ local f bn
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
+ -mindepth 1 -maxdepth 1)
+ do
+ bn=$(basename "${f}")
+ # Temporarily tack on tmp to workaround a file collision
+ # issue. This is only necessary for 9.7 and earlier. 10 never
+ # had this issue.
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
+ "/usr/bin/${bn}${SLOT/.}"
done
- # Then move the symlinks created by the ebuild to their proper place.
- for l in "${ED}"/usr/bin/*tmp ; do
- mv "${l}" "${l%tmp}" \
- || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
- done
+ if use doc ; then
+ docinto html
+ dodoc doc/src/sgml/html/*
+ fi
+
+ if use server; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+
+ if use systemd; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.service-9.6-r1" | \
+ systemd_newunit - ${PN}-${SLOT}.service
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ fi
+
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
+
+ if use prefix ; then
+ keepdir /run/postgresql
+ fperms 1775 /run/postgresql
+ fi
+ fi
}
pkg_postinst() {
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
elog "If you need a global psqlrc-file, you can place it in:"
elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
- elog
- elog "Gentoo specific documentation:"
- elog "https://wiki.gentoo.org/wiki/PostgreSQL"
- elog
- elog "Official documentation:"
- elog "${EROOT%/}/usr/share/doc/${PF}/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, and other options, 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}"
+ if use server ; then
+ elog
+ elog "Gentoo specific documentation:"
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL"
+ 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}"
+ fi
}
pkg_prerm() {
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
@@ -313,6 +326,8 @@ pkg_postrm() {
}
pkg_config() {
+ use server || die "USE flag 'server' not enabled. Nothing to configure."
+
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
@@ -433,17 +448,17 @@ pkg_config() {
}
src_test() {
- einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
-
- if [[ ${UID} -ne 0 ]] ; then
+ if use server && [[ ${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
+ use server || \
+ ewarn 'Tests cannot be run without the "server" use flag enabled.'
[[ ${UID} -eq 0 ]] || \
- ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
- ewarn "Skipping."
+ ewarn 'Skipping.'
fi
}
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.2.23-r1.ebuild
similarity index 72%
copy from dev-db/postgresql/postgresql-9999.ebuild
copy to dev-db/postgresql/postgresql-9.2.23-r1.ebuild
index 300a8efb793..e51086d898b 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-9.2.23-r1.ebuild
@@ -1,19 +1,18 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-EAPI="5"
+EAPI="6"
PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \
- python-single-r1 systemd user versionator
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
+ systemd user versionator
-KEYWORDS=""
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
-# Bump when rc released.
-SLOT="11"
+SLOT="$(get_version_component_range 1-2)"
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
@@ -21,7 +20,7 @@ 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="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
+readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
for lingua in ${LINGUAS}; do
@@ -53,7 +52,6 @@ ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
libressl? ( dev-libs/libressl:= )
)
-server? ( systemd? ( sys-apps/systemd ) )
tcl? ( >=dev-lang/tcl-8:0= )
uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )
@@ -62,23 +60,11 @@ zlib? ( sys-libs/zlib )
DEPEND="${CDEPEND}
!!<sys-apps/sandbox-2.0
->=dev-lang/perl-5.8
-app-text/docbook-dsssl-stylesheets
-app-text/docbook-sgml-dtd:4.2
-app-text/docbook-xml-dtd:4.2
-app-text/docbook-xsl-stylesheets
-app-text/openjade
-dev-libs/libxml2
-dev-libs/libxslt
sys-devel/bison
sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
-src_unpack() {
- base_src_unpack
- git-2_src_unpack
-}
RDEPEND="${CDEPEND}
!dev-db/postgresql-docs:${SLOT}
@@ -87,17 +73,8 @@ RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-postgresql )
"
-pkg_pretend() {
- ewarn "You are using a live ebuild that uses the current source code as it is"
- ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
- ewarn "the GNU Makefiles may be altered by upstream without notice and the"
- ewarn "documentation for this live version is not readily available"
- ewarn "online. Ergo, the ebuild maintainers will not support building a"
- ewarn "client-only and/or document-free version."
-}
-
pkg_setup() {
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
enewgroup postgres 70
enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
@@ -113,10 +90,7 @@ src_prepare() {
sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
-i src/include/pg_config_manual.h || die
- # Rely on $PATH being in the proper order so that the correct
- # install program is used for modules utilizing PGXS in both
- # hardened and non-hardened environments. (Bug #528786)
- sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
+ use server || eapply "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
if use pam ; then
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
@@ -124,7 +98,7 @@ src_prepare() {
die 'PGSQL_PAM_SERVICE rename failed.'
fi
- epatch_user
+ eapply_user
}
src_configure() {
@@ -147,17 +121,16 @@ src_configure() {
--mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \
--with-system-tzdata="${PO}/usr/share/zoneinfo" \
- $(use_enable !alpha spinlocks) \
$(use_enable !pg_legacytimestamp integer-datetimes) \
$(use_enable threads thread-safety) \
$(use_with kerberos gssapi) \
+ $(use_with kerberos krb5) \
$(use_with ldap) \
$(use_with pam) \
$(use_with perl) \
$(use_with python) \
$(use_with readline) \
$(use_with ssl openssl) \
- $(usex server "$(use_with systemd)" '--without-systemd') \
$(use_with tcl) \
$(use_with uuid ossp-uuid) \
$(use_with xml libxml) \
@@ -167,46 +140,29 @@ src_configure() {
}
src_compile() {
- emake world
+ emake
+ emake -C contrib
}
src_install() {
- emake DESTDIR="${D}" install-world
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install -C contrib
dodoc README HISTORY doc/{TODO,bug.template}
- insinto /etc/postgresql-${SLOT}
- newins src/bin/psql/psqlrc.sample psqlrc
-
- use static-libs || find "${ED}" -name '*.a' -delete
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
-
- if use systemd; then
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6" | \
- systemd_newunit - ${PN}-${SLOT}.service
+ # man pages are already built, but if we have the target make them,
+ # they'll be generated from source before being installed so we
+ # manually install man pages.
+ # We use ${SLOT} instead of doman for postgresql.eselect
+ insinto /usr/share/postgresql-${SLOT}/man/
+ doins -r doc/src/sgml/man{1,3,7}
+ if ! use server; then
+ # Remove man pages for non-existent binaries
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
+ done
fi
-
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
-
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
-
- local f bn
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
- -mindepth 1 -maxdepth 1)
- do
- bn=$(basename "${f}")
- # Temporarily tack on tmp to workaround a file collision
- # issue. This is only necessary for 9.7 and earlier. 10 never
- # had this issue.
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
- "/usr/bin/${bn}${SLOT/.}tmp"
- done
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
# Create slot specific man pages
local bn f mansec slotted_name
@@ -218,7 +174,7 @@ src_install() {
for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
bn=$(basename "${f}")
- slotted_name=${bn%.${mansec}}${SLOT}.${mansec}
+ slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
case ${bn} in
TABLE.7|WITH.7)
echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
@@ -232,22 +188,64 @@ src_install() {
popd > /dev/null
done
- if use prefix ; then
- keepdir /run/postgresql
- fperms 0775 /run/postgresql
+ insinto /etc/postgresql-${SLOT}
+ newins src/bin/psql/psqlrc.sample psqlrc
+
+ use static-libs || find "${ED}" -name '*.a' -delete
+
+ local f bn
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
+ -mindepth 1 -maxdepth 1)
+ do
+ bn=$(basename "${f}")
+ # Temporarily tack on tmp to workaround a file collision
+ # issue. This is only necessary for 9.7 and earlier. 10 never
+ # had this issue.
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
+ "/usr/bin/${bn}${SLOT/.}tmp"
+ done
+
+ if use doc ; then
+ docinto html
+ dodoc doc/src/sgml/html/*
+
+ docinto sgml
+ dodoc doc/src/sgml/*.{sgml,dsl}
+ fi
+
+ if use server; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.confd-9.2" | newconfd - ${PN}-${SLOT}
+
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.init-9.2" | newinitd - ${PN}-${SLOT}
+
+ if use systemd; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.service-9.2" | \
+ systemd_newunit - ${PN}-${SLOT}.service
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ fi
+
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
+
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
+
+ if use prefix ; then
+ keepdir /run/postgresql
+ fperms 1775 /run/postgresql
+ fi
fi
}
pkg_preinst() {
# Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
- # /usr/bin/psql97). They may have been created by the
+ # /usr/bin/psql96). They may have been created by the
# postgresql.eselect module, but they're handled within this ebuild
# now. It's alright if we momentarily delete /usr/bin/psql as it
- # will be recreated by the eselect module in pkg_ppostinst(). We
- # only worry about the 9.7 slot as that's the last slot that had its
- # slot-specific links generated by eselect.
- #
- # This can be removed when 10 is the lowest slot in the tree.
+ # will be recreated by the eselect module in pkg_ppostinst(). This
+ # is only necessary for 9.7 and earlier. 10 and later were never
+ # handled in this manner.
local canonicalise
if type -p realpath > /dev/null; then
canonicalise=realpath
@@ -262,7 +260,9 @@ pkg_preinst() {
# First remove any symlinks in /usr/bin that may have been created
# by the old eselect
for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}"
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
+ rm "${l}" || ewarn "Couldn't remove ${l}"
+ fi
done
# Then move the symlinks created by the ebuild to their proper place.
@@ -273,32 +273,35 @@ pkg_preinst() {
}
pkg_postinst() {
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
elog "If you need a global psqlrc-file, you can place it in:"
elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
- elog
- elog "Gentoo specific documentation:"
- elog "https://wiki.gentoo.org/wiki/PostgreSQL"
- elog
- elog "Official documentation:"
- elog "${EROOT%/}/usr/share/doc/${PF}/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, and other options, 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}"
+ if use server ; then
+ elog
+ elog "Gentoo specific documentation:"
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL"
+ 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}"
+ fi
}
pkg_prerm() {
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
@@ -313,6 +316,8 @@ pkg_postrm() {
}
pkg_config() {
+ use server || die "USE flag 'server' not enabled. Nothing to configure."
+
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
@@ -394,7 +399,7 @@ pkg_config() {
# unix_socket_directory has no effect in postgresql.conf as it's
# overridden in the initscript
- sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
+ sed '/^#unix_socket_directory/d' -i "${PGDATA%/}"/postgresql.conf
cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
# This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
@@ -408,11 +413,9 @@ pkg_config() {
einfo "by default. You can disable it in the cluster's:"
einfo " ${PGDATA%/}/postgresql.conf"
einfo
- if ! use systemd; then
- einfo "The PostgreSQL server, by default, will log events to:"
- einfo " ${DATA_DIR%/}/postmaster.log"
- einfo
- fi
+ 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}"
@@ -423,9 +426,6 @@ pkg_config() {
einfo
einfo "Or move the configuration files back:"
einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
- elif use systemd; then
- einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL"
- einfo "instead of 'pg_ctl'."
else
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
einfo "instead of 'pg_ctl'."
@@ -433,17 +433,17 @@ pkg_config() {
}
src_test() {
- einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
-
- if [[ ${UID} -ne 0 ]] ; then
+ if use server && [[ ${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
+ use server || \
+ ewarn 'Tests cannot be run without the "server" use flag enabled.'
[[ ${UID} -eq 0 ]] || \
- ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
- ewarn "Skipping."
+ ewarn 'Skipping.'
fi
}
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.3.19-r1.ebuild
similarity index 73%
copy from dev-db/postgresql/postgresql-9999.ebuild
copy to dev-db/postgresql/postgresql-9.3.19-r1.ebuild
index 300a8efb793..ff42ac626f7 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-9.3.19-r1.ebuild
@@ -1,19 +1,18 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-EAPI="5"
+EAPI="6"
PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \
- python-single-r1 systemd user versionator
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
+ systemd user versionator
-KEYWORDS=""
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
-# Bump when rc released.
-SLOT="11"
+SLOT="$(get_version_component_range 1-2)"
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
@@ -21,7 +20,7 @@ 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="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
+readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
for lingua in ${LINGUAS}; do
@@ -53,7 +52,6 @@ ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
libressl? ( dev-libs/libressl:= )
)
-server? ( systemd? ( sys-apps/systemd ) )
tcl? ( >=dev-lang/tcl-8:0= )
uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )
@@ -62,23 +60,11 @@ zlib? ( sys-libs/zlib )
DEPEND="${CDEPEND}
!!<sys-apps/sandbox-2.0
->=dev-lang/perl-5.8
-app-text/docbook-dsssl-stylesheets
-app-text/docbook-sgml-dtd:4.2
-app-text/docbook-xml-dtd:4.2
-app-text/docbook-xsl-stylesheets
-app-text/openjade
-dev-libs/libxml2
-dev-libs/libxslt
sys-devel/bison
sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
-src_unpack() {
- base_src_unpack
- git-2_src_unpack
-}
RDEPEND="${CDEPEND}
!dev-db/postgresql-docs:${SLOT}
@@ -87,17 +73,8 @@ RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-postgresql )
"
-pkg_pretend() {
- ewarn "You are using a live ebuild that uses the current source code as it is"
- ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
- ewarn "the GNU Makefiles may be altered by upstream without notice and the"
- ewarn "documentation for this live version is not readily available"
- ewarn "online. Ergo, the ebuild maintainers will not support building a"
- ewarn "client-only and/or document-free version."
-}
-
pkg_setup() {
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
enewgroup postgres 70
enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
@@ -118,13 +95,15 @@ src_prepare() {
# hardened and non-hardened environments. (Bug #528786)
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
+ use server || eapply "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
+
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
- epatch_user
+ eapply_user
}
src_configure() {
@@ -147,17 +126,16 @@ src_configure() {
--mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \
--with-system-tzdata="${PO}/usr/share/zoneinfo" \
- $(use_enable !alpha spinlocks) \
$(use_enable !pg_legacytimestamp integer-datetimes) \
$(use_enable threads thread-safety) \
$(use_with kerberos gssapi) \
+ $(use_with kerberos krb5) \
$(use_with ldap) \
$(use_with pam) \
$(use_with perl) \
$(use_with python) \
$(use_with readline) \
$(use_with ssl openssl) \
- $(usex server "$(use_with systemd)" '--without-systemd') \
$(use_with tcl) \
$(use_with uuid ossp-uuid) \
$(use_with xml libxml) \
@@ -167,46 +145,29 @@ src_configure() {
}
src_compile() {
- emake world
+ emake
+ emake -C contrib
}
src_install() {
- emake DESTDIR="${D}" install-world
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install -C contrib
dodoc README HISTORY doc/{TODO,bug.template}
- insinto /etc/postgresql-${SLOT}
- newins src/bin/psql/psqlrc.sample psqlrc
-
- use static-libs || find "${ED}" -name '*.a' -delete
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
-
- if use systemd; then
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6" | \
- systemd_newunit - ${PN}-${SLOT}.service
+ # man pages are already built, but if we have the target make them,
+ # they'll be generated from source before being installed so we
+ # manually install man pages.
+ # We use ${SLOT} instead of doman for postgresql.eselect
+ insinto /usr/share/postgresql-${SLOT}/man/
+ doins -r doc/src/sgml/man{1,3,7}
+ if ! use server; then
+ # Remove man pages for non-existent binaries
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
+ done
fi
-
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
-
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
-
- local f bn
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
- -mindepth 1 -maxdepth 1)
- do
- bn=$(basename "${f}")
- # Temporarily tack on tmp to workaround a file collision
- # issue. This is only necessary for 9.7 and earlier. 10 never
- # had this issue.
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
- "/usr/bin/${bn}${SLOT/.}tmp"
- done
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
# Create slot specific man pages
local bn f mansec slotted_name
@@ -218,7 +179,7 @@ src_install() {
for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
bn=$(basename "${f}")
- slotted_name=${bn%.${mansec}}${SLOT}.${mansec}
+ slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
case ${bn} in
TABLE.7|WITH.7)
echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
@@ -232,22 +193,64 @@ src_install() {
popd > /dev/null
done
- if use prefix ; then
- keepdir /run/postgresql
- fperms 0775 /run/postgresql
+ insinto /etc/postgresql-${SLOT}
+ newins src/bin/psql/psqlrc.sample psqlrc
+
+ use static-libs || find "${ED}" -name '*.a' -delete
+
+ local f bn
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
+ -mindepth 1 -maxdepth 1)
+ do
+ bn=$(basename "${f}")
+ # Temporarily tack on tmp to workaround a file collision
+ # issue. This is only necessary for 9.7 and earlier. 10 never
+ # had this issue.
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
+ "/usr/bin/${bn}${SLOT/.}tmp"
+ done
+
+ if use doc ; then
+ docinto html
+ dodoc doc/src/sgml/html/*
+
+ docinto sgml
+ dodoc doc/src/sgml/*.{sgml,dsl}
+ fi
+
+ if use server; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+
+ if use systemd; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.service-9.2" | \
+ systemd_newunit - ${PN}-${SLOT}.service
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ fi
+
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
+
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
+
+ if use prefix ; then
+ keepdir /run/postgresql
+ fperms 1775 /run/postgresql
+ fi
fi
}
pkg_preinst() {
# Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
- # /usr/bin/psql97). They may have been created by the
+ # /usr/bin/psql96). They may have been created by the
# postgresql.eselect module, but they're handled within this ebuild
# now. It's alright if we momentarily delete /usr/bin/psql as it
- # will be recreated by the eselect module in pkg_ppostinst(). We
- # only worry about the 9.7 slot as that's the last slot that had its
- # slot-specific links generated by eselect.
- #
- # This can be removed when 10 is the lowest slot in the tree.
+ # will be recreated by the eselect module in pkg_ppostinst(). This
+ # is only necessary for 9.7 and earlier. 10 and later were never
+ # handled in this manner.
local canonicalise
if type -p realpath > /dev/null; then
canonicalise=realpath
@@ -262,7 +265,9 @@ pkg_preinst() {
# First remove any symlinks in /usr/bin that may have been created
# by the old eselect
for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}"
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
+ rm "${l}" || ewarn "Couldn't remove ${l}"
+ fi
done
# Then move the symlinks created by the ebuild to their proper place.
@@ -273,32 +278,35 @@ pkg_preinst() {
}
pkg_postinst() {
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
elog "If you need a global psqlrc-file, you can place it in:"
elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
- elog
- elog "Gentoo specific documentation:"
- elog "https://wiki.gentoo.org/wiki/PostgreSQL"
- elog
- elog "Official documentation:"
- elog "${EROOT%/}/usr/share/doc/${PF}/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, and other options, 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}"
+ if use server ; then
+ elog
+ elog "Gentoo specific documentation:"
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL"
+ 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}"
+ fi
}
pkg_prerm() {
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
@@ -313,6 +321,8 @@ pkg_postrm() {
}
pkg_config() {
+ use server || die "USE flag 'server' not enabled. Nothing to configure."
+
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
@@ -408,11 +418,9 @@ pkg_config() {
einfo "by default. You can disable it in the cluster's:"
einfo " ${PGDATA%/}/postgresql.conf"
einfo
- if ! use systemd; then
- einfo "The PostgreSQL server, by default, will log events to:"
- einfo " ${DATA_DIR%/}/postmaster.log"
- einfo
- fi
+ 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}"
@@ -423,9 +431,6 @@ pkg_config() {
einfo
einfo "Or move the configuration files back:"
einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
- elif use systemd; then
- einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL"
- einfo "instead of 'pg_ctl'."
else
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
einfo "instead of 'pg_ctl'."
@@ -433,17 +438,17 @@ pkg_config() {
}
src_test() {
- einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
-
- if [[ ${UID} -ne 0 ]] ; then
+ if use server && [[ ${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
+ use server || \
+ ewarn 'Tests cannot be run without the "server" use flag enabled.'
[[ ${UID} -eq 0 ]] || \
- ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
- ewarn "Skipping."
+ ewarn 'Skipping.'
fi
}
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.4.14-r1.ebuild
similarity index 68%
copy from dev-db/postgresql/postgresql-9999.ebuild
copy to dev-db/postgresql/postgresql-9.4.14-r1.ebuild
index 300a8efb793..d77190ea0a5 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-9.4.14-r1.ebuild
@@ -1,19 +1,18 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-EAPI="5"
+EAPI="6"
PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \
- python-single-r1 systemd user versionator
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
+ systemd user versionator
-KEYWORDS=""
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
-# Bump when rc released.
-SLOT="11"
+SLOT="$(get_version_component_range 1-2)"
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
@@ -21,7 +20,7 @@ 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="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
+readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
for lingua in ${LINGUAS}; do
@@ -53,32 +52,41 @@ ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
libressl? ( dev-libs/libressl:= )
)
-server? ( systemd? ( sys-apps/systemd ) )
tcl? ( >=dev-lang/tcl-8:0= )
-uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )
zlib? ( sys-libs/zlib )
"
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
+# the libc includes UUID functions.
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
+BSD_LIBC=( elibc_{Free,Net,Open}BSD )
+
+nest_usedep() {
+ local front back
+ while [[ ${#} -gt 1 ]]; do
+ front+="${1}? ( "
+ back+=" )"
+ shift
+ done
+ echo "${front}${1}${back}"
+}
+
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
+CDEPEND+="
+uuid? (
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
+)"
+
DEPEND="${CDEPEND}
!!<sys-apps/sandbox-2.0
->=dev-lang/perl-5.8
-app-text/docbook-dsssl-stylesheets
-app-text/docbook-sgml-dtd:4.2
-app-text/docbook-xml-dtd:4.2
-app-text/docbook-xsl-stylesheets
-app-text/openjade
-dev-libs/libxml2
-dev-libs/libxslt
sys-devel/bison
sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
-src_unpack() {
- base_src_unpack
- git-2_src_unpack
-}
RDEPEND="${CDEPEND}
!dev-db/postgresql-docs:${SLOT}
@@ -87,17 +95,8 @@ RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-postgresql )
"
-pkg_pretend() {
- ewarn "You are using a live ebuild that uses the current source code as it is"
- ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
- ewarn "the GNU Makefiles may be altered by upstream without notice and the"
- ewarn "documentation for this live version is not readily available"
- ewarn "online. Ergo, the ebuild maintainers will not support building a"
- ewarn "client-only and/or document-free version."
-}
-
pkg_setup() {
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
enewgroup postgres 70
enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
@@ -118,13 +117,15 @@ src_prepare() {
# hardened and non-hardened environments. (Bug #528786)
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
+ use server || eapply "${FILESDIR}/${PN}-9.4.10-no-server.patch"
+
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
- epatch_user
+ eapply_user
}
src_configure() {
@@ -139,6 +140,17 @@ src_configure() {
local PO="${EPREFIX%/}"
+ local i uuid_config=""
+ if use uuid; then
+ for i in ${UTIL_LINUX_LIBC[@]}; do
+ use ${i} && uuid_config="--with-uuid=e2fs"
+ done
+ for i in ${BSD_LIBC[@]}; do
+ use ${i} && uuid_config="--with-uuid=bsd"
+ done
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
+ fi
+
econf \
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
--datadir="${PO}/usr/share/postgresql-${SLOT}" \
@@ -147,7 +159,6 @@ src_configure() {
--mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \
--with-system-tzdata="${PO}/usr/share/zoneinfo" \
- $(use_enable !alpha spinlocks) \
$(use_enable !pg_legacytimestamp integer-datetimes) \
$(use_enable threads thread-safety) \
$(use_with kerberos gssapi) \
@@ -157,9 +168,8 @@ src_configure() {
$(use_with python) \
$(use_with readline) \
$(use_with ssl openssl) \
- $(usex server "$(use_with systemd)" '--without-systemd') \
$(use_with tcl) \
- $(use_with uuid ossp-uuid) \
+ ${uuid_config} \
$(use_with xml libxml) \
$(use_with xml libxslt) \
$(use_with zlib) \
@@ -167,46 +177,29 @@ src_configure() {
}
src_compile() {
- emake world
+ emake
+ emake -C contrib
}
src_install() {
- emake DESTDIR="${D}" install-world
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install -C contrib
dodoc README HISTORY doc/{TODO,bug.template}
- insinto /etc/postgresql-${SLOT}
- newins src/bin/psql/psqlrc.sample psqlrc
-
- use static-libs || find "${ED}" -name '*.a' -delete
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
-
- if use systemd; then
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6" | \
- systemd_newunit - ${PN}-${SLOT}.service
+ # man pages are already built, but if we have the target make them,
+ # they'll be generated from source before being installed so we
+ # manually install man pages.
+ # We use ${SLOT} instead of doman for postgresql.eselect
+ insinto /usr/share/postgresql-${SLOT}/man/
+ doins -r doc/src/sgml/man{1,3,7}
+ if ! use server; then
+ # Remove man pages for non-existent binaries
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
+ done
fi
-
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
-
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
-
- local f bn
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
- -mindepth 1 -maxdepth 1)
- do
- bn=$(basename "${f}")
- # Temporarily tack on tmp to workaround a file collision
- # issue. This is only necessary for 9.7 and earlier. 10 never
- # had this issue.
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
- "/usr/bin/${bn}${SLOT/.}tmp"
- done
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
# Create slot specific man pages
local bn f mansec slotted_name
@@ -218,7 +211,7 @@ src_install() {
for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
bn=$(basename "${f}")
- slotted_name=${bn%.${mansec}}${SLOT}.${mansec}
+ slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
case ${bn} in
TABLE.7|WITH.7)
echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
@@ -232,22 +225,64 @@ src_install() {
popd > /dev/null
done
- if use prefix ; then
- keepdir /run/postgresql
- fperms 0775 /run/postgresql
+ insinto /etc/postgresql-${SLOT}
+ newins src/bin/psql/psqlrc.sample psqlrc
+
+ use static-libs || find "${ED}" -name '*.a' -delete
+
+ local f bn
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
+ -mindepth 1 -maxdepth 1)
+ do
+ bn=$(basename "${f}")
+ # Temporarily tack on tmp to workaround a file collision
+ # issue. This is only necessary for 9.7 and earlier. 10 never
+ # had this issue.
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
+ "/usr/bin/${bn}${SLOT/.}tmp"
+ done
+
+ if use doc ; then
+ docinto html
+ dodoc doc/src/sgml/html/*
+
+ docinto sgml
+ dodoc doc/src/sgml/*.{sgml,dsl}
+ fi
+
+ if use server; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+
+ if use systemd; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.service-9.2" | \
+ systemd_newunit - ${PN}-${SLOT}.service
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ fi
+
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
+
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
+
+ if use prefix ; then
+ keepdir /run/postgresql
+ fperms 1775 /run/postgresql
+ fi
fi
}
pkg_preinst() {
# Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
- # /usr/bin/psql97). They may have been created by the
+ # /usr/bin/psql96). They may have been created by the
# postgresql.eselect module, but they're handled within this ebuild
# now. It's alright if we momentarily delete /usr/bin/psql as it
- # will be recreated by the eselect module in pkg_ppostinst(). We
- # only worry about the 9.7 slot as that's the last slot that had its
- # slot-specific links generated by eselect.
- #
- # This can be removed when 10 is the lowest slot in the tree.
+ # will be recreated by the eselect module in pkg_ppostinst(). This
+ # is only necessary for 9.7 and earlier. 10 and later were never
+ # handled in this manner.
local canonicalise
if type -p realpath > /dev/null; then
canonicalise=realpath
@@ -262,7 +297,9 @@ pkg_preinst() {
# First remove any symlinks in /usr/bin that may have been created
# by the old eselect
for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}"
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
+ rm "${l}" || ewarn "Couldn't remove ${l}"
+ fi
done
# Then move the symlinks created by the ebuild to their proper place.
@@ -273,32 +310,35 @@ pkg_preinst() {
}
pkg_postinst() {
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
elog "If you need a global psqlrc-file, you can place it in:"
elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
- elog
- elog "Gentoo specific documentation:"
- elog "https://wiki.gentoo.org/wiki/PostgreSQL"
- elog
- elog "Official documentation:"
- elog "${EROOT%/}/usr/share/doc/${PF}/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, and other options, 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}"
+ if use server ; then
+ elog
+ elog "Gentoo specific documentation:"
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL"
+ 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}"
+ fi
}
pkg_prerm() {
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
@@ -313,6 +353,8 @@ pkg_postrm() {
}
pkg_config() {
+ use server || die "USE flag 'server' not enabled. Nothing to configure."
+
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
@@ -408,11 +450,9 @@ pkg_config() {
einfo "by default. You can disable it in the cluster's:"
einfo " ${PGDATA%/}/postgresql.conf"
einfo
- if ! use systemd; then
- einfo "The PostgreSQL server, by default, will log events to:"
- einfo " ${DATA_DIR%/}/postmaster.log"
- einfo
- fi
+ 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}"
@@ -423,9 +463,6 @@ pkg_config() {
einfo
einfo "Or move the configuration files back:"
einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
- elif use systemd; then
- einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL"
- einfo "instead of 'pg_ctl'."
else
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
einfo "instead of 'pg_ctl'."
@@ -433,17 +470,17 @@ pkg_config() {
}
src_test() {
- einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
-
- if [[ ${UID} -ne 0 ]] ; then
+ if use server && [[ ${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
+ use server || \
+ ewarn 'Tests cannot be run without the "server" use flag enabled.'
[[ ${UID} -eq 0 ]] || \
- ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
- ewarn "Skipping."
+ ewarn 'Skipping.'
fi
}
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.5.9-r1.ebuild
similarity index 68%
copy from dev-db/postgresql/postgresql-9999.ebuild
copy to dev-db/postgresql/postgresql-9.5.9-r1.ebuild
index 300a8efb793..721f27ae0f9 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-9.5.9-r1.ebuild
@@ -1,19 +1,18 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-EAPI="5"
+EAPI="6"
PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \
- python-single-r1 systemd user versionator
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
+ systemd user versionator
-KEYWORDS=""
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
-# Bump when rc released.
-SLOT="11"
+SLOT="$(get_version_component_range 1-2)"
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
@@ -21,7 +20,7 @@ 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="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
+readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
for lingua in ${LINGUAS}; do
@@ -53,32 +52,41 @@ ssl? (
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
libressl? ( dev-libs/libressl:= )
)
-server? ( systemd? ( sys-apps/systemd ) )
tcl? ( >=dev-lang/tcl-8:0= )
-uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )
zlib? ( sys-libs/zlib )
"
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
+# the libc includes UUID functions.
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
+BSD_LIBC=( elibc_{Free,Net,Open}BSD )
+
+nest_usedep() {
+ local front back
+ while [[ ${#} -gt 1 ]]; do
+ front+="${1}? ( "
+ back+=" )"
+ shift
+ done
+ echo "${front}${1}${back}"
+}
+
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
+CDEPEND+="
+uuid? (
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
+)"
+
DEPEND="${CDEPEND}
!!<sys-apps/sandbox-2.0
->=dev-lang/perl-5.8
-app-text/docbook-dsssl-stylesheets
-app-text/docbook-sgml-dtd:4.2
-app-text/docbook-xml-dtd:4.2
-app-text/docbook-xsl-stylesheets
-app-text/openjade
-dev-libs/libxml2
-dev-libs/libxslt
sys-devel/bison
sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
-src_unpack() {
- base_src_unpack
- git-2_src_unpack
-}
RDEPEND="${CDEPEND}
!dev-db/postgresql-docs:${SLOT}
@@ -87,17 +95,8 @@ RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-postgresql )
"
-pkg_pretend() {
- ewarn "You are using a live ebuild that uses the current source code as it is"
- ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
- ewarn "the GNU Makefiles may be altered by upstream without notice and the"
- ewarn "documentation for this live version is not readily available"
- ewarn "online. Ergo, the ebuild maintainers will not support building a"
- ewarn "client-only and/or document-free version."
-}
-
pkg_setup() {
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
enewgroup postgres 70
enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
@@ -118,13 +117,15 @@ src_prepare() {
# hardened and non-hardened environments. (Bug #528786)
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
+ use server || eapply "${FILESDIR}/${PN}-9.5.5-no-server.patch"
+
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
- epatch_user
+ eapply_user
}
src_configure() {
@@ -139,6 +140,17 @@ src_configure() {
local PO="${EPREFIX%/}"
+ local i uuid_config=""
+ if use uuid; then
+ for i in ${UTIL_LINUX_LIBC[@]}; do
+ use ${i} && uuid_config="--with-uuid=e2fs"
+ done
+ for i in ${BSD_LIBC[@]}; do
+ use ${i} && uuid_config="--with-uuid=bsd"
+ done
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
+ fi
+
econf \
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
--datadir="${PO}/usr/share/postgresql-${SLOT}" \
@@ -157,9 +169,8 @@ src_configure() {
$(use_with python) \
$(use_with readline) \
$(use_with ssl openssl) \
- $(usex server "$(use_with systemd)" '--without-systemd') \
$(use_with tcl) \
- $(use_with uuid ossp-uuid) \
+ ${uuid_config} \
$(use_with xml libxml) \
$(use_with xml libxslt) \
$(use_with zlib) \
@@ -167,46 +178,29 @@ src_configure() {
}
src_compile() {
- emake world
+ emake
+ emake -C contrib
}
src_install() {
- emake DESTDIR="${D}" install-world
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install -C contrib
dodoc README HISTORY doc/{TODO,bug.template}
- insinto /etc/postgresql-${SLOT}
- newins src/bin/psql/psqlrc.sample psqlrc
-
- use static-libs || find "${ED}" -name '*.a' -delete
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
-
- if use systemd; then
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6" | \
- systemd_newunit - ${PN}-${SLOT}.service
+ # man pages are already built, but if we have the target make them,
+ # they'll be generated from source before being installed so we
+ # manually install man pages.
+ # We use ${SLOT} instead of doman for postgresql.eselect
+ insinto /usr/share/postgresql-${SLOT}/man/
+ doins -r doc/src/sgml/man{1,3,7}
+ if ! use server; then
+ # Remove man pages for non-existent binaries
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
+ done
fi
-
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
-
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
-
- local f bn
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
- -mindepth 1 -maxdepth 1)
- do
- bn=$(basename "${f}")
- # Temporarily tack on tmp to workaround a file collision
- # issue. This is only necessary for 9.7 and earlier. 10 never
- # had this issue.
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
- "/usr/bin/${bn}${SLOT/.}tmp"
- done
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
# Create slot specific man pages
local bn f mansec slotted_name
@@ -218,7 +212,7 @@ src_install() {
for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
bn=$(basename "${f}")
- slotted_name=${bn%.${mansec}}${SLOT}.${mansec}
+ slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
case ${bn} in
TABLE.7|WITH.7)
echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
@@ -232,22 +226,64 @@ src_install() {
popd > /dev/null
done
- if use prefix ; then
- keepdir /run/postgresql
- fperms 0775 /run/postgresql
+ insinto /etc/postgresql-${SLOT}
+ newins src/bin/psql/psqlrc.sample psqlrc
+
+ use static-libs || find "${ED}" -name '*.a' -delete
+
+ local f bn
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
+ -mindepth 1 -maxdepth 1)
+ do
+ bn=$(basename "${f}")
+ # Temporarily tack on tmp to workaround a file collision
+ # issue. This is only necessary for 9.7 and earlier. 10 never
+ # had this issue.
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
+ "/usr/bin/${bn}${SLOT/.}tmp"
+ done
+
+ if use doc ; then
+ docinto html
+ dodoc doc/src/sgml/html/*
+
+ docinto sgml
+ dodoc doc/src/sgml/*.{sgml,dsl}
+ fi
+
+ if use server; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+
+ if use systemd; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.service-9.2" | \
+ systemd_newunit - ${PN}-${SLOT}.service
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ fi
+
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
+
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
+
+ if use prefix ; then
+ keepdir /run/postgresql
+ fperms 1775 /run/postgresql
+ fi
fi
}
pkg_preinst() {
# Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
- # /usr/bin/psql97). They may have been created by the
+ # /usr/bin/psql96). They may have been created by the
# postgresql.eselect module, but they're handled within this ebuild
# now. It's alright if we momentarily delete /usr/bin/psql as it
- # will be recreated by the eselect module in pkg_ppostinst(). We
- # only worry about the 9.7 slot as that's the last slot that had its
- # slot-specific links generated by eselect.
- #
- # This can be removed when 10 is the lowest slot in the tree.
+ # will be recreated by the eselect module in pkg_ppostinst(). This
+ # is only necessary for 9.7 and earlier. 10 and later were never
+ # handled in this manner.
local canonicalise
if type -p realpath > /dev/null; then
canonicalise=realpath
@@ -262,7 +298,9 @@ pkg_preinst() {
# First remove any symlinks in /usr/bin that may have been created
# by the old eselect
for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}"
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
+ rm "${l}" || ewarn "Couldn't remove ${l}"
+ fi
done
# Then move the symlinks created by the ebuild to their proper place.
@@ -273,32 +311,40 @@ pkg_preinst() {
}
pkg_postinst() {
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
+ if use alpha && use server ; then
+ ewarn "PostgreSQL 9.5+ no longer has native spinlock support on Alpha platforms."
+ ewarn "As a result, performance will be extremely degraded."
+ fi
+
elog "If you need a global psqlrc-file, you can place it in:"
elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
- elog
- elog "Gentoo specific documentation:"
- elog "https://wiki.gentoo.org/wiki/PostgreSQL"
- elog
- elog "Official documentation:"
- elog "${EROOT%/}/usr/share/doc/${PF}/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, and other options, 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}"
+ if use server ; then
+ elog
+ elog "Gentoo specific documentation:"
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL"
+ 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}"
+ fi
}
pkg_prerm() {
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
@@ -313,6 +359,8 @@ pkg_postrm() {
}
pkg_config() {
+ use server || die "USE flag 'server' not enabled. Nothing to configure."
+
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
@@ -408,11 +456,9 @@ pkg_config() {
einfo "by default. You can disable it in the cluster's:"
einfo " ${PGDATA%/}/postgresql.conf"
einfo
- if ! use systemd; then
- einfo "The PostgreSQL server, by default, will log events to:"
- einfo " ${DATA_DIR%/}/postmaster.log"
- einfo
- fi
+ 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}"
@@ -423,9 +469,6 @@ pkg_config() {
einfo
einfo "Or move the configuration files back:"
einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
- elif use systemd; then
- einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL"
- einfo "instead of 'pg_ctl'."
else
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
einfo "instead of 'pg_ctl'."
@@ -433,17 +476,17 @@ pkg_config() {
}
src_test() {
- einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
-
- if [[ ${UID} -ne 0 ]] ; then
+ if use server && [[ ${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
+ use server || \
+ ewarn 'Tests cannot be run without the "server" use flag enabled.'
[[ ${UID} -eq 0 ]] || \
- ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
- ewarn "Skipping."
+ ewarn 'Skipping.'
fi
}
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.6.5-r1.ebuild
similarity index 69%
copy from dev-db/postgresql/postgresql-9999.ebuild
copy to dev-db/postgresql/postgresql-9.6.5-r1.ebuild
index 300a8efb793..df077d0dfb8 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-9.6.5-r1.ebuild
@@ -1,19 +1,21 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-EAPI="5"
+EAPI="6"
PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \
- python-single-r1 systemd user versionator
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
+ systemd user versionator
-KEYWORDS=""
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
-# Bump when rc released.
-SLOT="11"
+SLOT="$(get_version_component_range 1-2)"
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
+MY_PV=${PV/_/}
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
@@ -21,7 +23,7 @@ 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="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
+readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
for lingua in ${LINGUAS}; do
@@ -55,30 +57,40 @@ ssl? (
)
server? ( systemd? ( sys-apps/systemd ) )
tcl? ( >=dev-lang/tcl-8:0= )
-uuid? ( dev-libs/ossp-uuid )
xml? ( dev-libs/libxml2 dev-libs/libxslt )
zlib? ( sys-libs/zlib )
"
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
+# the libc includes UUID functions.
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
+BSD_LIBC=( elibc_{Free,Net,Open}BSD )
+
+nest_usedep() {
+ local front back
+ while [[ ${#} -gt 1 ]]; do
+ front+="${1}? ( "
+ back+=" )"
+ shift
+ done
+ echo "${front}${1}${back}"
+}
+
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
+CDEPEND+="
+uuid? (
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
+)"
+
DEPEND="${CDEPEND}
!!<sys-apps/sandbox-2.0
->=dev-lang/perl-5.8
-app-text/docbook-dsssl-stylesheets
-app-text/docbook-sgml-dtd:4.2
-app-text/docbook-xml-dtd:4.2
-app-text/docbook-xsl-stylesheets
-app-text/openjade
-dev-libs/libxml2
-dev-libs/libxslt
sys-devel/bison
sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
-src_unpack() {
- base_src_unpack
- git-2_src_unpack
-}
RDEPEND="${CDEPEND}
!dev-db/postgresql-docs:${SLOT}
@@ -87,17 +99,8 @@ RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-postgresql )
"
-pkg_pretend() {
- ewarn "You are using a live ebuild that uses the current source code as it is"
- ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
- ewarn "the GNU Makefiles may be altered by upstream without notice and the"
- ewarn "documentation for this live version is not readily available"
- ewarn "online. Ergo, the ebuild maintainers will not support building a"
- ewarn "client-only and/or document-free version."
-}
-
pkg_setup() {
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
enewgroup postgres 70
enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
@@ -118,13 +121,15 @@ src_prepare() {
# hardened and non-hardened environments. (Bug #528786)
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
+ use server || eapply "${FILESDIR}/${PN}-${SLOT}.3-no-server.patch"
+
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
- epatch_user
+ eapply_user
}
src_configure() {
@@ -139,6 +144,17 @@ src_configure() {
local PO="${EPREFIX%/}"
+ local i uuid_config=""
+ if use uuid; then
+ for i in ${UTIL_LINUX_LIBC[@]}; do
+ use ${i} && uuid_config="--with-uuid=e2fs"
+ done
+ for i in ${BSD_LIBC[@]}; do
+ use ${i} && uuid_config="--with-uuid=bsd"
+ done
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
+ fi
+
econf \
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
--datadir="${PO}/usr/share/postgresql-${SLOT}" \
@@ -159,7 +175,7 @@ src_configure() {
$(use_with ssl openssl) \
$(usex server "$(use_with systemd)" '--without-systemd') \
$(use_with tcl) \
- $(use_with uuid ossp-uuid) \
+ ${uuid_config} \
$(use_with xml libxml) \
$(use_with xml libxslt) \
$(use_with zlib) \
@@ -167,46 +183,29 @@ src_configure() {
}
src_compile() {
- emake world
+ emake
+ emake -C contrib
}
src_install() {
- emake DESTDIR="${D}" install-world
+ emake DESTDIR="${D}" install
+ emake DESTDIR="${D}" install -C contrib
dodoc README HISTORY doc/{TODO,bug.template}
- insinto /etc/postgresql-${SLOT}
- newins src/bin/psql/psqlrc.sample psqlrc
-
- use static-libs || find "${ED}" -name '*.a' -delete
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
-
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
-
- if use systemd; then
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6" | \
- systemd_newunit - ${PN}-${SLOT}.service
+ # man pages are already built, but if we have the target make them,
+ # they'll be generated from source before being installed so we
+ # manually install man pages.
+ # We use ${SLOT} instead of doman for postgresql.eselect
+ insinto /usr/share/postgresql-${SLOT}/man/
+ doins -r doc/src/sgml/man{1,3,7}
+ if ! use server; then
+ # Remove man pages for non-existent binaries
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
+ done
fi
-
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
-
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
-
- local f bn
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
- -mindepth 1 -maxdepth 1)
- do
- bn=$(basename "${f}")
- # Temporarily tack on tmp to workaround a file collision
- # issue. This is only necessary for 9.7 and earlier. 10 never
- # had this issue.
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
- "/usr/bin/${bn}${SLOT/.}tmp"
- done
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
# Create slot specific man pages
local bn f mansec slotted_name
@@ -218,7 +217,7 @@ src_install() {
for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
bn=$(basename "${f}")
- slotted_name=${bn%.${mansec}}${SLOT}.${mansec}
+ slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
case ${bn} in
TABLE.7|WITH.7)
echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
@@ -232,22 +231,64 @@ src_install() {
popd > /dev/null
done
- if use prefix ; then
- keepdir /run/postgresql
- fperms 0775 /run/postgresql
+ insinto /etc/postgresql-${SLOT}
+ newins src/bin/psql/psqlrc.sample psqlrc
+
+ use static-libs || find "${ED}" -name '*.a' -delete
+
+ local f bn
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
+ -mindepth 1 -maxdepth 1)
+ do
+ bn=$(basename "${f}")
+ # Temporarily tack on tmp to workaround a file collision
+ # issue. This is only necessary for 9.7 and earlier. 10 never
+ # had this issue.
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
+ "/usr/bin/${bn}${SLOT/.}tmp"
+ done
+
+ if use doc ; then
+ docinto html
+ dodoc doc/src/sgml/html/*
+
+ docinto sgml
+ dodoc doc/src/sgml/*.{sgml,dsl}
+ fi
+
+ if use server; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
+
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
+
+ if use systemd; then
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
+ "${FILESDIR}/${PN}.service-9.6-r1" | \
+ systemd_newunit - ${PN}-${SLOT}.service
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
+ fi
+
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
+
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
+
+ if use prefix ; then
+ keepdir /run/postgresql
+ fperms 1775 /run/postgresql
+ fi
fi
}
pkg_preinst() {
# Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
- # /usr/bin/psql97). They may have been created by the
+ # /usr/bin/psql96). They may have been created by the
# postgresql.eselect module, but they're handled within this ebuild
# now. It's alright if we momentarily delete /usr/bin/psql as it
- # will be recreated by the eselect module in pkg_ppostinst(). We
- # only worry about the 9.7 slot as that's the last slot that had its
- # slot-specific links generated by eselect.
- #
- # This can be removed when 10 is the lowest slot in the tree.
+ # will be recreated by the eselect module in pkg_ppostinst(). This
+ # is only necessary for 9.7 and earlier. 10 and later were never
+ # handled in this manner.
local canonicalise
if type -p realpath > /dev/null; then
canonicalise=realpath
@@ -262,7 +303,9 @@ pkg_preinst() {
# First remove any symlinks in /usr/bin that may have been created
# by the old eselect
for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}"
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
+ rm "${l}" || ewarn "Couldn't remove ${l}"
+ fi
done
# Then move the symlinks created by the ebuild to their proper place.
@@ -273,32 +316,35 @@ pkg_preinst() {
}
pkg_postinst() {
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
elog "If you need a global psqlrc-file, you can place it in:"
elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
- elog
- elog "Gentoo specific documentation:"
- elog "https://wiki.gentoo.org/wiki/PostgreSQL"
- elog
- elog "Official documentation:"
- elog "${EROOT%/}/usr/share/doc/${PF}/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, and other options, 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}"
+ if use server ; then
+ elog
+ elog "Gentoo specific documentation:"
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL"
+ 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}"
+ fi
}
pkg_prerm() {
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
@@ -313,6 +359,8 @@ pkg_postrm() {
}
pkg_config() {
+ use server || die "USE flag 'server' not enabled. Nothing to configure."
+
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
@@ -433,17 +481,17 @@ pkg_config() {
}
src_test() {
- einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
-
- if [[ ${UID} -ne 0 ]] ; then
+ if use server && [[ ${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
+ use server || \
+ ewarn 'Tests cannot be run without the "server" use flag enabled.'
[[ ${UID} -eq 0 ]] || \
- ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
- ewarn "Skipping."
+ ewarn 'Skipping.'
fi
}
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9999.ebuild
index 300a8efb793..af236abbcc1 100644
--- a/dev-db/postgresql/postgresql-9999.ebuild
+++ b/dev-db/postgresql/postgresql-9999.ebuild
@@ -1,11 +1,11 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-EAPI="5"
+EAPI="6"
PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \
+inherit eutils flag-o-matic git-r3 linux-info multilib pam prefix \
python-single-r1 systemd user versionator
KEYWORDS=""
@@ -13,7 +13,7 @@ KEYWORDS=""
# Bump when rc released.
SLOT="11"
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
+EGIT_REPO_URI="https://git.postgresql.org/git/postgresql.git"
LICENSE="POSTGRESQL GPL-2"
DESCRIPTION="PostgreSQL RDBMS"
@@ -75,11 +75,6 @@ sys-devel/flex
nls? ( sys-devel/gettext )
xml? ( virtual/pkgconfig )
"
-src_unpack() {
- base_src_unpack
- git-2_src_unpack
-}
-
RDEPEND="${CDEPEND}
!dev-db/postgresql-docs:${SLOT}
!dev-db/postgresql-base:${SLOT}
@@ -124,7 +119,7 @@ src_prepare() {
die 'PGSQL_PAM_SERVICE rename failed.'
fi
- epatch_user
+ eapply_user
}
src_configure() {
@@ -188,8 +183,9 @@ src_install() {
if use systemd; then
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
- "${FILESDIR}/${PN}.service-9.6" | \
+ "${FILESDIR}/${PN}.service-9.6-r1" | \
systemd_newunit - ${PN}-${SLOT}.service
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
fi
newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
@@ -234,7 +230,7 @@ src_install() {
if use prefix ; then
keepdir /run/postgresql
- fperms 0775 /run/postgresql
+ fperms 1775 /run/postgresql
fi
}
@@ -273,6 +269,7 @@ pkg_preinst() {
}
pkg_postinst() {
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
postgresql-config update
elog "If you need a global psqlrc-file, you can place it in:"
next reply other threads:[~2017-10-07 20:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-07 20:20 Aaron Swenson [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-09-27 5:53 [gentoo-commits] repo/gentoo:master commit in: dev-db/postgresql/, dev-db/postgresql/files/ Patrick Lauer
2024-02-04 5:02 Aaron W. Swenson
2024-02-02 14:05 Patrick Lauer
2021-09-23 20:51 Aaron W. Swenson
2021-02-21 14:21 Aaron W. Swenson
2020-11-14 13:59 Aaron W. Swenson
2018-06-13 11:19 Aaron Swenson
2018-03-22 16:16 Aaron Swenson
2018-02-11 23:11 Thomas Deutschmann
2018-02-10 18:38 Aaron Swenson
2017-08-10 15:03 Aaron Swenson
2016-10-28 16:15 Aaron Swenson
2015-09-06 12:49 Aaron Swenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1507407615.9d489165499bc17cf58f7872b13327b160355af3.titanofold@gentoo \
--to=titanofold@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox