Gentoo Archives: gentoo-commits

From: Aaron Swenson <titanofold@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/postgresql/, dev-db/postgresql/files/
Date: Thu, 10 Aug 2017 15:03:38
Message-Id: 1502377401.8475b7b1352af134678fe0280d97478a8e713013.titanofold@gentoo
1 commit: 8475b7b1352af134678fe0280d97478a8e713013
2 Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
3 AuthorDate: Thu Aug 10 15:03:21 2017 +0000
4 Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
5 CommitDate: Thu Aug 10 15:03:21 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8475b7b1
7
8 dev-db/postgresql: Security Version Bump
9
10 Security releases:
11 9.2.22
12 9.3.18
13 9.4.13
14 9.5.8
15 9.6.4
16
17 Version bump:
18 10_beta3
19
20 Three security vulnerabilities have been closed by this release:
21 * CVE-2017-7546: Empty password accepted in some authentication methods
22 * CVE-2017-7547: The "pg_user_mappings" catalog view discloses passwords
23 to users lacking server privileges
24 * CVE-2017-7548: lo_put() function ignores ACLs
25
26 Full release notes at: https://www.postgresql.org/about/news/1772/
27
28 Gentoo-Bug: 627462
29
30 Package-Manager: Portage-2.3.6, Repoman-2.3.1
31
32 dev-db/postgresql/Manifest | 6 +
33 .../files/postgresql-9.6.3-no-server.patch | 145 ++++++
34 dev-db/postgresql/postgresql-10_beta3.ebuild | 464 +++++++++++++++++++
35 dev-db/postgresql/postgresql-9.2.22.ebuild | 445 ++++++++++++++++++
36 dev-db/postgresql/postgresql-9.3.18.ebuild | 450 +++++++++++++++++++
37 dev-db/postgresql/postgresql-9.4.13.ebuild | 482 ++++++++++++++++++++
38 dev-db/postgresql/postgresql-9.5.8.ebuild | 488 ++++++++++++++++++++
39 dev-db/postgresql/postgresql-9.6.4.ebuild | 495 +++++++++++++++++++++
40 8 files changed, 2975 insertions(+)
41
42 diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest
43 index e6c7f829533..8fe58158126 100644
44 --- a/dev-db/postgresql/Manifest
45 +++ b/dev-db/postgresql/Manifest
46 @@ -1,17 +1,23 @@
47 DIST postgresql-10beta2.tar.bz2 19790809 SHA256 0d6b50236039fc92e8784bd908b452c38ef63c0f9029f34e7115fbc30e17b195 SHA512 58abb8e38252ddf50d975588c9d43bf28d1169b499d068ace9324c6380ac1916975ca9a9a708dffb499e333e8b85c381efe8821166e2071236d6c8c4498f97a0 WHIRLPOOL 920fbc7459f0f9a9a3b72200ab2a4042672f351dc5b63dc7b63e2fafe0a74838fff1da0d814c37d81d28dc07e85bd4f14330ac367df2fb61f1ed0f56927e2131
48 +DIST postgresql-10beta3.tar.bz2 19914123 SHA256 6722546739f8e2dd379e8031784e86c5c588638df6c477046ebdd479586bcb3e SHA512 cdbda1c17d58f2999ad71a208d6aa3b18b82bfc8f185eb4ce36496b27ae23bca03f76925e4b242a4c3c2eec96ca0b135e696f55b59282b208ecfe7f8b642f24f WHIRLPOOL 5db99df6c8d0b455a3e6c8d4a734be52bb5dc6b3225cb0f3d547ea22e87e4eae45709667bad71bc1fe8e7f024345c1b9e186b07faf9c23a9db046c9bfc01e8af
49 DIST postgresql-9.1.24.tar.bz2 15863767 SHA256 de0d84e9f32af145fcd66d8d324f6ef1a0b17944ea344b7bbe9d99fff68ae5d3 SHA512 a9ad0d62846598afee317eeda83406b5f85a658bfe7eb78aff6c59c904223dd165adbd5870598b74aa0e012878489f0c285e6ac7b07ebddf3cf8d81ba70bea7e WHIRLPOOL f58d79df5562c3fc22dae96ba064e19a4c83f42358911575f854cb2e062457f9331547cb19f9970003a2e15b7e8c609b9aab2a1e17099a446c89786581ccb13b
50 DIST postgresql-9.2.19.tar.bz2 16466698 SHA256 1d29d73a4f590fcc348280f13ac2ff6a0f72c94908c54e3c20b7ab1560e8dbad SHA512 d3b4c5578bf6d6580028e775bff81a921258cb53b6b06567d96a352d14f3b63063adb480b2f5e2029baf8a034e14b5cd75eebc04f1ed7b16c849e1a5ec1f4867 WHIRLPOOL c13b45fd7aee08ea472557c9f40d79c45abd572fefcc215002b562b8046b1937bf522f6f7f6e280ff1e434c9698734cda9f1c3dacd3c8fee5f33dad0da21f75f
51 DIST postgresql-9.2.20.tar.bz2 16480653 SHA256 0b8abdae8400cabea5587a726003c9dd71c73c049bdae523abc35f9312dd8f26 SHA512 16f7861e0372481dbc5c69ac977bab46f592045f32951a245f3677121261640fcc169a75e730d592e36c15c9a120e7d06755550bdabf121ad89d76a17535d0f9 WHIRLPOOL af5005564056185fa240fd97bec862738f9951bb57082485beba3eacf5d8bf709c58d01f8bde656a391eee173d592d9cf792be87de04a09869aa3d82c8719320
52 DIST postgresql-9.2.21.tar.bz2 16508040 SHA256 0697e843523ee60c563f987f9c65bc4201294b18525d6e5e4b2c50c6d4058ef9 SHA512 c548cd1ba34ad71dd3f1acde5775ba2e71121f004324fac44dbe123a91d599ced0f1b8be675ed07b77712e8c23f376ff6221349385c19a88c4edbbb186f17861 WHIRLPOOL c46fd4909e2d534b98c8a97f0f5410ab40285c118517a36ee73d0e1234483144d1f58785a59df53fdbfab7c2876a60d000bf574dff0be3030f8c909509b1bfe6
53 +DIST postgresql-9.2.22.tar.bz2 16531224 SHA256 a70e94fa58776b559a8f7b5301371ac4922c9e3ed313ccbef20862514de7c192 SHA512 3e5ab04c2be2719579b2ebbf64b220522acfd9ea74029dd2ed699f60230da224bdc99de4ee5529b513e5586de0377764c4e54deb3dd93d5c53c4d666dce2b6b7 WHIRLPOOL ff1817463b488f4793cd0851df846b961d5510b7c1cf4a560717755ca47c363eb782bc1f2cd7a5d8cbc49727dea64394c6b30038105fc584749157157948964d
54 DIST postgresql-9.3.15.tar.bz2 17059932 SHA256 a9fcba1446a93aa95e3e1b6535756f0472d10b0f267a0845f8b2b29f89de5c4f SHA512 35c30cdb5599f99c94ab921f9f5e7671a8c0b7bca8fe3b616630ae13d6eda8d329e77e7e802da6a83cb09c3c9ca10fa8ce0de8a184e6fff471130e1cd68ce762 WHIRLPOOL 7a627b2da1dc3671df7edfe58420f81ce24202c1251225054674d79e431bc36e1a70c84aaacb76c59e9eefb26429cbbb9ea80c45a989e3564b69e334d3dd4d84
55 DIST postgresql-9.3.16.tar.bz2 17108969 SHA256 845f5e4ac8cf026b6a77c5a180a2fe869f51e9d06acf8d0365b05505a2c66873 SHA512 2e379aca5db79ab5795e6f1e4ff8b21b1aa284cfb0d34655430d8b959cebac7982ee6eda66833a1fb208a36a51251c946565982cd5dff619ab334603ded530e7 WHIRLPOOL fea45fb6563fc4c56a1853baf83bbdd59991871176aa00a4fcdda5e95a9277d187ddd2fc5d0c3c76f090e7a359d2d5af140e8af3f6a964897beb41ef8435483e
56 DIST postgresql-9.3.17.tar.bz2 17158802 SHA256 9c03e5f280cfe9bd202fa01af773eb146abd8ab3065f7279d574c568f6948dbe SHA512 4b6fc079c2bb728b13b72eb2f7d92183ffb1a9b32110d99dfce674032ac499963b75a021265ba08dc95c34ae35a7edac65ef1e658e66ee2da41c1ce646a702dc WHIRLPOOL f573aaa6acf6d542ed647f392bdb42cd60f650e66174c603f0344d64e2962f2fbb46f0233226188ee9a3a75b2de6532738aac28876bd097556eb4f6c0de21667
57 +DIST postgresql-9.3.18.tar.bz2 17194269 SHA256 ad60d12a5a3dd0f6f5904c41b87e43eff49d3f74e45129fe52c5744366ff2fe0 SHA512 df3f2e0bb396cac74021fcc1a989d04515c12e73846b7392ae859c32668d73ae0027607426072672b6228d7533cc512f72b5729bf5c8f7b0e8d0270727784455 WHIRLPOOL c5b3db88e01c507556b354acb1ecf2bbf43246d023c5d9e1d8479ce4aa9944beca518abbd3e810830af1d75356272b4df3eb58358edfdd265cdc395f62ac8c33
58 DIST postgresql-9.4.10.tar.bz2 17802812 SHA256 7061678bed1981c681ce54c76b98b6ec17743f090a9775104a45e7e1a8826ecf SHA512 2fcf47769b22c69bc82c9d6edc317e18dfcb4a96534e012bae4355e5088afa83da98b21e08a07766794f0a166888acbd16705a806464ea11711ed97c3b4012fb WHIRLPOOL e6ed3c209043cbbacb0698e1be367f20028d649d4cff62b5d6edd162c6ad629a3ec5f55854bd12334a3d3165462fecb34188bd62cd398cfc242a3579810b5b85
59 DIST postgresql-9.4.11.tar.bz2 17832915 SHA256 e3eb51d045c180b03d2de1f0c3af9356e10be49448e966ca01dfc2c6d1cc9d23 SHA512 a3ed866d82ab4b90c2a7ec2abec0308015845947f42b76e420cce8f268e1c374806a9fab00ba0563d742a53014a30fa0eaa90804a09fd162b76fcbfbeff6b70f WHIRLPOOL cb53a9e1ee518b43c8be135e3b09005314c8dd108eacd37e6a5be45b2391b31a4acf8427c7aac86524f0ef0e264b46329c97aa5b01e6c4d0b63cd6f7e081697c
60 DIST postgresql-9.4.12.tar.bz2 17833119 SHA256 fca055481875d1c49e31c28443f56472a1474b3fbe25b7ae64440c6118f82e64 SHA512 69951f9e66069aad1049a0ea9fdcd7bf2f84b42e7c6e0f761d78ab22131a39cf56448ef0ddc28170b66970bf53edf2d2355530fcfc0a2dca92b66d69686b7ecb WHIRLPOOL ca023aab29d7993e236c52df58d6fae6f9bd1649cf20f1e1b118ff232dc41674001d3dc9bc945e3f9dd61779dde27cb93265b89d3615e47f49ea46751d8e97c3
61 +DIST postgresql-9.4.13.tar.bz2 17867502 SHA256 0080f55d65194de8b96a2dab153443f8248ff2b2b10e6ab4cda2dcadcac7f2ab SHA512 98e5721ab1ebc88070a5c2c9ef10e4fc21825de495db71f011577aa15fdd31c2dc0429d48e1624f7161c9d31dd75de4d8cf4ed2e34006ed6d1852f04a948e932 WHIRLPOOL 4f963b81dca21a2f3f5e047b5cfd1796d103c0648c4af0250ffe2274ed71011634dfc1e8387fe6dfa6589585a8fcb5accc9878c461978b9abd483b85f6ea3e68
62 DIST postgresql-9.5.5.tar.bz2 18525082 SHA256 02c65290be74de6604c3fed87c9fd3e6b32e949f0ab8105a75bd7ed5aa71f394 SHA512 727ab57796cd393ec3755e9aabf515ebbdc3152b4062c20e64511e866a7e7038ba5c5e2843f13f3a79e2263296451f0e93108346b6f638611fba2449394e338e WHIRLPOOL ec5262fd8cecea20fd12bcec8e6e015817ae8181d9e9ff6d8aca6ed43cadedac1bd5006c3d04262b99b9a79aa02c409920ab3392136f3ff3dc480fe1155cade8
63 DIST postgresql-9.5.6.tar.bz2 18598551 SHA256 bb9e5f6d34e20783e96e10c1d6c0c09c31749e802aaa46b793ce2522725ae12f SHA512 fabaeb2d4841ca2f2fd7b0f9c90368debc91f569ade5ad4dc9250c27d790a97ed58a670319f0fe59404fce7e986e8dafb1408edbe6fc149531bdb230b1b913fe WHIRLPOOL 257aa2d2a71b12b13da958563197b9bd0acc6c4a0d3b96787ad2d202414d074629f4b39c8291cae4770b2d867a4b331214f404eaef84a37278d3aa90147d14de
64 DIST postgresql-9.5.7.tar.bz2 18639775 SHA256 8b1e936f82109325decc0f5575e846b93fb4fd384e8c4bde83ff5e7f87fc6cad SHA512 0f879a8d7587739aa9a696d60f909f819d567c67dff7c730d5e856639ed78ebc35beeb3cdaf782573d7e62c7056560a934f64cf11ccac6e309f58bb82d1ca78f WHIRLPOOL d58fb5bc378a58efaf2be8d689bd6d511170c3de18e5300ed46be51e272654d52807fd9a783b6a3ec30a022a44577edb19d6627e5153b5e14259de5571ba15bb
65 +DIST postgresql-9.5.8.tar.bz2 18670910 SHA256 ade57068f134f36710fa953e1ef79185abd96572f8098741413132f79ed37202 SHA512 4a11f0a16df460391c8250122ca8bf1ab76e49672a8c003ed09718bb4ce2aa57757e7aaec6e41b53d0d1ada293172b974761606647fcc8b4fce8807490b6ef10 WHIRLPOOL 7688ddeea69449d2e2a518017d306f6c17a08becb258297cbf4bde9f3734c5ba2129a9660b448df458963a7cdc796bbb72f2798c20abd3d50d1be8d4f3f94ec1
66 DIST postgresql-9.6.1.tar.bz2 19260568 SHA256 e5101e0a49141fc12a7018c6dad594694d3a3325f5ab71e93e0e51bd94e51fcd SHA512 f27af67f9a96f6327150330bf091a803e10eabbac4e488cf5e4d72907e2eb1dbde7282fe0b89fd75711fd8bdcdb3688b5a9eac1e4d6871f4e8681c9c8b0e7c45 WHIRLPOOL 1ea7933817895ec4ddd531b60eead2c0c3324b90fe48224bd49748d11e76313bb7699670edaf5c8f41b8424026bed59d29aab69208c5ced5161196a4827c78f8
67 DIST postgresql-9.6.2.tar.bz2 19478040 SHA256 0187b5184be1c09034e74e44761505e52357248451b0c854dddec6c231fe50c9 SHA512 7c9d61a591408e29d7dc70d6b28ecdf06edf7f8fbf4e014e60a1e4f841fd5734c74a820094f6153e10ef633d48ea73f2a85194f6d2cd519a8f7087a261e9e02b WHIRLPOOL 0d3981d2990186967ad61c84a02cadf680015e4dc41ff6bb9bb0ed0936979abe6561f2a730ef000173ee8635a6859361b6ce174afbda837defb50300e1cfc909
68 DIST postgresql-9.6.3.tar.bz2 19534323 SHA256 1645b3736901f6d854e695a937389e68ff2066ce0cde9d73919d6ab7c995b9c6 SHA512 97141972e154e6b0e756ee6a4e20f26e82022a9fd4c56305314a3a5567a79ece638e4ac3d513b46138737ae6bd27a098f30013a94767db151181aac9c01290a1 WHIRLPOOL 774146faf5795796812e541d3c7a2ad9ce8125afdc64c0bfa599a733904f4efd3c73dfb907dbb66b6482b2d6efdbd9f2c0dcedffcc4e23bd6030e968a51db658
69 +DIST postgresql-9.6.4.tar.bz2 19566875 SHA256 2b3ab16d82e21cead54c08b95ce3ac480696944a68603b6c11b3205b7376ce13 SHA512 b0527efacce6efc09340b68c8c56483cd884676e01cb6bfb4f9ce63226a394bdb0bcf3d832f84e4dff5ceecf09ef4cf93e9fbd0ac453ec85efb11ac50a7dff39 WHIRLPOOL 6296114c2a6f690428754278d11fb93f2142c28bc36e0a17b4b075b60ee90bf708d73d68ff6e8118253ef22e54cd5e325094e3675eccb7f060e32af2572a65b0
70
71 diff --git a/dev-db/postgresql/files/postgresql-9.6.3-no-server.patch b/dev-db/postgresql/files/postgresql-9.6.3-no-server.patch
72 new file mode 100644
73 index 00000000000..db662d4630e
74 --- /dev/null
75 +++ b/dev-db/postgresql/files/postgresql-9.6.3-no-server.patch
76 @@ -0,0 +1,145 @@
77 +diff -Naruw a/contrib/Makefile b/contrib/Makefile
78 +--- a/contrib/Makefile 2017-05-08 17:15:12.000000000 -0400
79 ++++ b/contrib/Makefile 2017-07-13 20:20:26.926646151 -0400
80 +@@ -5,57 +5,9 @@
81 + include $(top_builddir)/src/Makefile.global
82 +
83 + SUBDIRS = \
84 +- adminpack \
85 +- auth_delay \
86 +- auto_explain \
87 +- bloom \
88 +- btree_gin \
89 +- btree_gist \
90 +- chkpass \
91 +- citext \
92 +- cube \
93 +- dblink \
94 +- dict_int \
95 +- dict_xsyn \
96 +- earthdistance \
97 +- file_fdw \
98 +- fuzzystrmatch \
99 +- hstore \
100 +- intagg \
101 +- intarray \
102 +- isn \
103 +- lo \
104 +- ltree \
105 + oid2name \
106 +- pageinspect \
107 +- passwordcheck \
108 +- pg_buffercache \
109 +- pg_freespacemap \
110 +- pg_prewarm \
111 +- pg_standby \
112 +- pg_stat_statements \
113 +- pg_trgm \
114 +- pgcrypto \
115 +- pgrowlocks \
116 +- pgstattuple \
117 +- pg_visibility \
118 +- postgres_fdw \
119 +- seg \
120 +- spi \
121 +- tablefunc \
122 +- tcn \
123 +- test_decoding \
124 +- tsm_system_rows \
125 +- tsm_system_time \
126 +- tsearch2 \
127 +- unaccent \
128 + vacuumlo
129 +
130 +-ifeq ($(with_openssl),yes)
131 +-SUBDIRS += sslinfo
132 +-else
133 +-ALWAYS_SUBDIRS += sslinfo
134 +-endif
135 +
136 + ifneq ($(with_uuid),no)
137 + SUBDIRS += uuid-ossp
138 +diff -Naruw a/src/backend/Makefile b/src/backend/Makefile
139 +--- a/src/backend/Makefile 2017-05-08 17:15:12.000000000 -0400
140 ++++ b/src/backend/Makefile 2017-07-13 20:18:08.590323095 -0400
141 +@@ -51,7 +51,7 @@
142 +
143 + ##########################################################################
144 +
145 +-all: submake-libpgport submake-schemapg postgres $(POSTGRES_IMP)
146 ++all: generated-headers
147 +
148 + ifneq ($(PORTNAME), cygwin)
149 + ifneq ($(PORTNAME), win32)
150 +@@ -218,23 +218,7 @@
151 +
152 + ##########################################################################
153 +
154 +-install: all installdirs install-bin
155 +-ifeq ($(PORTNAME), cygwin)
156 +-ifeq ($(MAKE_DLL), true)
157 +- $(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a'
158 +-endif
159 +-endif
160 +-ifeq ($(PORTNAME), win32)
161 +-ifeq ($(MAKE_DLL), true)
162 +- $(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a'
163 +-endif
164 +-endif
165 +- $(MAKE) -C catalog install-data
166 +- $(MAKE) -C tsearch install-data
167 +- $(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample '$(DESTDIR)$(datadir)/pg_hba.conf.sample'
168 +- $(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample '$(DESTDIR)$(datadir)/pg_ident.conf.sample'
169 +- $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample '$(DESTDIR)$(datadir)/postgresql.conf.sample'
170 +- $(INSTALL_DATA) $(srcdir)/access/transam/recovery.conf.sample '$(DESTDIR)$(datadir)/recovery.conf.sample'
171 ++install:
172 +
173 + install-bin: postgres $(POSTGRES_IMP) installdirs
174 + $(INSTALL_PROGRAM) postgres$(X) '$(DESTDIR)$(bindir)/postgres$(X)'
175 +diff -Naruw a/src/bin/Makefile b/src/bin/Makefile
176 +--- a/src/bin/Makefile 2017-05-08 17:15:12.000000000 -0400
177 ++++ b/src/bin/Makefile 2017-07-13 20:23:51.419471550 -0400
178 +@@ -14,19 +14,8 @@
179 + include $(top_builddir)/src/Makefile.global
180 +
181 + SUBDIRS = \
182 +- initdb \
183 +- pg_archivecleanup \
184 +- pg_basebackup \
185 + pg_config \
186 +- pg_controldata \
187 +- pg_ctl \
188 + pg_dump \
189 +- pg_resetxlog \
190 +- pg_rewind \
191 +- pg_test_fsync \
192 +- pg_test_timing \
193 +- pg_upgrade \
194 +- pg_xlogdump \
195 + pgbench \
196 + psql \
197 + scripts
198 +diff -Naruw a/src/Makefile b/src/Makefile
199 +--- a/src/Makefile 2017-05-08 17:15:12.000000000 -0400
200 ++++ b/src/Makefile 2017-07-13 20:25:57.539158282 -0400
201 +@@ -15,19 +15,12 @@
202 + SUBDIRS = \
203 + common \
204 + port \
205 +- timezone \
206 + backend \
207 +- backend/utils/mb/conversion_procs \
208 +- backend/snowball \
209 + include \
210 + interfaces \
211 +- backend/replication/libpqwalreceiver \
212 + fe_utils \
213 + bin \
214 +- pl \
215 +- makefiles \
216 +- test/regress \
217 +- test/perl
218 ++ makefiles
219 +
220 + # There are too many interdependencies between the subdirectories, so
221 + # don't attempt parallel make here.
222
223 diff --git a/dev-db/postgresql/postgresql-10_beta3.ebuild b/dev-db/postgresql/postgresql-10_beta3.ebuild
224 new file mode 100644
225 index 00000000000..0252237d80b
226 --- /dev/null
227 +++ b/dev-db/postgresql/postgresql-10_beta3.ebuild
228 @@ -0,0 +1,464 @@
229 +# Copyright 1999-2017 Gentoo Foundation
230 +# Distributed under the terms of the GNU General Public License v2
231 +
232 +EAPI="6"
233 +
234 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
235 +
236 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
237 + systemd user versionator
238 +
239 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
240 +
241 +SLOT=$(get_major_version)
242 +
243 +MY_PV=${PV/_/}
244 +S="${WORKDIR}/${PN}-${MY_PV}"
245 +
246 +SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
247 +
248 +LICENSE="POSTGRESQL GPL-2"
249 +DESCRIPTION="PostgreSQL RDBMS"
250 +HOMEPAGE="http://www.postgresql.org/"
251 +
252 +LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN
253 + zh_TW"
254 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp
255 + python +readline selinux +server systemd ssl static-libs tcl threads uuid
256 + xml zlib"
257 +
258 +for lingua in ${LINGUAS}; do
259 + IUSE+=" linguas_${lingua}"
260 +done
261 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
262 +
263 +wanted_languages() {
264 + local enable_langs
265 +
266 + for lingua in ${LINGUAS} ; do
267 + use linguas_${lingua} && enable_langs+="${lingua} "
268 + done
269 +
270 + echo -n ${enable_langs}
271 +}
272 +
273 +CDEPEND="
274 +>=app-eselect/eselect-postgresql-2.0
275 +sys-apps/less
276 +virtual/libintl
277 +kerberos? ( virtual/krb5 )
278 +ldap? ( net-nds/openldap )
279 +pam? ( virtual/pam )
280 +perl? ( >=dev-lang/perl-5.8:= )
281 +python? ( ${PYTHON_DEPS} )
282 +readline? ( sys-libs/readline:0= )
283 +server? ( systemd? ( sys-apps/systemd ) )
284 +ssl? (
285 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
286 + libressl? ( dev-libs/libressl:= )
287 +)
288 +tcl? ( >=dev-lang/tcl-8:0= )
289 +xml? ( dev-libs/libxml2 dev-libs/libxslt )
290 +zlib? ( sys-libs/zlib )
291 +"
292 +
293 +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
294 +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
295 +# the libc includes UUID functions.
296 +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
297 +BSD_LIBC=( elibc_{Free,Net,Open}BSD )
298 +
299 +nest_usedep() {
300 + local front back
301 + while [[ ${#} -gt 1 ]]; do
302 + front+="${1}? ( "
303 + back+=" )"
304 + shift
305 + done
306 + echo "${front}${1}${back}"
307 +}
308 +
309 +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
310 +CDEPEND+="
311 +uuid? (
312 + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
313 + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
314 +)"
315 +
316 +DEPEND="${CDEPEND}
317 +!!<sys-apps/sandbox-2.0
318 +sys-devel/bison
319 +sys-devel/flex
320 +nls? ( sys-devel/gettext )
321 +xml? ( virtual/pkgconfig )
322 +"
323 +
324 +RDEPEND="${CDEPEND}
325 +!dev-db/postgresql-docs:${SLOT}
326 +!dev-db/postgresql-base:${SLOT}
327 +!dev-db/postgresql-server:${SLOT}
328 +selinux? ( sec-policy/selinux-postgresql )
329 +"
330 +
331 +pkg_setup() {
332 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
333 +
334 + enewgroup postgres 70
335 + enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
336 +
337 + use python && python-single-r1_pkg_setup
338 +}
339 +
340 +src_prepare() {
341 + # Work around PPC{,64} compilation bug where bool is already defined
342 + sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
343 +
344 + # Set proper run directory
345 + sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
346 + -i src/include/pg_config_manual.h || die
347 +
348 + # Rely on $PATH being in the proper order so that the correct
349 + # install program is used for modules utilizing PGXS in both
350 + # hardened and non-hardened environments. (Bug #528786)
351 + sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
352 +
353 + use server || eapply "${FILESDIR}/${PN}-${SLOT}beta2-no-server.patch"
354 +
355 + if use pam ; then
356 + sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
357 + -i src/backend/libpq/auth.c || \
358 + die 'PGSQL_PAM_SERVICE rename failed.'
359 + fi
360 +
361 + eapply_user
362 +}
363 +
364 +src_configure() {
365 + case ${CHOST} in
366 + *-darwin*|*-solaris*)
367 + use nls && append-libs intl
368 + ;;
369 + esac
370 +
371 + export LDFLAGS_SL="${LDFLAGS}"
372 + export LDFLAGS_EX="${LDFLAGS}"
373 +
374 + local PO="${EPREFIX%/}"
375 +
376 + local i uuid_config=""
377 + if use uuid; then
378 + for i in ${UTIL_LINUX_LIBC[@]}; do
379 + use ${i} && uuid_config="--with-uuid=e2fs"
380 + done
381 + for i in ${BSD_LIBC[@]}; do
382 + use ${i} && uuid_config="--with-uuid=bsd"
383 + done
384 + [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
385 + fi
386 +
387 + econf \
388 + --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
389 + --datadir="${PO}/usr/share/postgresql-${SLOT}" \
390 + --docdir="${PO}/usr/share/doc/${PF}" \
391 + --includedir="${PO}/usr/include/postgresql-${SLOT}" \
392 + --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
393 + --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
394 + --with-system-tzdata="${PO}/usr/share/zoneinfo" \
395 + $(use_enable !alpha spinlocks) \
396 + $(use_enable !pg_legacytimestamp integer-datetimes) \
397 + $(use_enable threads thread-safety) \
398 + $(use_with kerberos gssapi) \
399 + $(use_with ldap) \
400 + $(use_with pam) \
401 + $(use_with perl) \
402 + $(use_with python) \
403 + $(use_with readline) \
404 + $(use_with ssl openssl) \
405 + $(usex server "$(use_with systemd)" '--without-systemd') \
406 + $(use_with tcl) \
407 + ${uuid_config} \
408 + $(use_with xml libxml) \
409 + $(use_with xml libxslt) \
410 + $(use_with zlib) \
411 + "$(use_enable nls nls "$(wanted_languages)")"
412 +}
413 +
414 +src_compile() {
415 + emake
416 + emake -C contrib
417 +}
418 +
419 +src_install() {
420 + emake DESTDIR="${D}" install
421 + emake DESTDIR="${D}" install -C contrib
422 +
423 + dodoc README HISTORY doc/{TODO,bug.template}
424 +
425 + # man pages are already built, but if we have the target make them,
426 + # they'll be generated from source before being installed so we
427 + # manually install man pages.
428 + # We use ${SLOT} instead of doman for postgresql.eselect
429 + insinto /usr/share/postgresql-${SLOT}/man/
430 + doins -r doc/src/sgml/man{1,3,7}
431 + if ! use server; then
432 + # Remove man pages for non-existent binaries
433 + serverman=(
434 + initdb
435 + pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby}
436 + pg_{test_{fsync,timing},upgrade,waldump}
437 + post{gres,master}
438 + )
439 + for m in ${serverman[@]} ; do
440 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
441 + done
442 + fi
443 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
444 +
445 + # Create slot specific man pages
446 + local bn f mansec slotted_name
447 + for mansec in 1 3 7 ; do
448 + local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
449 +
450 + mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
451 + pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
452 +
453 + for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
454 + bn=$(basename "${f}")
455 + slotted_name=${bn%.${mansec}}${SLOT}.${mansec}
456 + case ${bn} in
457 + TABLE.7|WITH.7)
458 + echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
459 + ;;
460 + *)
461 + echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
462 + ;;
463 + esac
464 + done
465 +
466 + popd > /dev/null
467 + done
468 +
469 + insinto /etc/postgresql-${SLOT}
470 + newins src/bin/psql/psqlrc.sample psqlrc
471 +
472 + use static-libs || find "${ED}" -name '*.a' -delete
473 +
474 + local f bn
475 + for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
476 + -mindepth 1 -maxdepth 1)
477 + do
478 + bn=$(basename "${f}")
479 + # Temporarily tack on tmp to workaround a file collision
480 + # issue. This is only necessary for 9.7 and earlier. 10 never
481 + # had this issue.
482 + dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
483 + "/usr/bin/${bn}${SLOT/.}"
484 + done
485 +
486 + if use doc ; then
487 + docinto html
488 + dodoc doc/src/sgml/html/*
489 + fi
490 +
491 + if use server; then
492 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
493 + "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
494 +
495 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
496 + "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
497 +
498 + if use systemd; then
499 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
500 + "${FILESDIR}/${PN}.service-9.6" | \
501 + systemd_newunit - ${PN}-${SLOT}.service
502 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
503 + fi
504 +
505 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
506 +
507 + if use prefix ; then
508 + keepdir /run/postgresql
509 + fperms 0775 /run/postgresql
510 + fi
511 + fi
512 +}
513 +
514 +pkg_postinst() {
515 + postgresql-config update
516 +
517 + elog "If you need a global psqlrc-file, you can place it in:"
518 + elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
519 +
520 + if use server ; then
521 + elog
522 + elog "Gentoo specific documentation:"
523 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
524 + elog
525 + elog "Official documentation:"
526 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
527 + elog
528 + elog "The default location of the Unix-domain socket is:"
529 + elog " ${EROOT%/}/run/postgresql/"
530 + elog
531 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
532 + elog "so that it contains your preferred locale in:"
533 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
534 + elog
535 + elog "Then, execute the following command to setup the initial database"
536 + elog "environment:"
537 + elog " emerge --config =${CATEGORY}/${PF}"
538 + fi
539 +}
540 +
541 +pkg_prerm() {
542 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
543 + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
544 + ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
545 +
546 + ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
547 + sleep 10
548 + eend 0
549 + fi
550 +}
551 +
552 +pkg_postrm() {
553 + postgresql-config update
554 +}
555 +
556 +pkg_config() {
557 + use server || die "USE flag 'server' not enabled. Nothing to configure."
558 +
559 + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
560 + && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
561 + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
562 + [[ -z "${DATA_DIR}" ]] \
563 + && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
564 +
565 + # environment.bz2 may not contain the same locale as the current system
566 + # locale. Unset and source from the current system locale.
567 + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
568 + unset LANG
569 + unset LC_CTYPE
570 + unset LC_NUMERIC
571 + unset LC_TIME
572 + unset LC_COLLATE
573 + unset LC_MONETARY
574 + unset LC_MESSAGES
575 + unset LC_ALL
576 + source "${EROOT%/}/etc/env.d/02locale"
577 + [ -n "${LANG}" ] && export LANG
578 + [ -n "${LC_CTYPE}" ] && export LC_CTYPE
579 + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
580 + [ -n "${LC_TIME}" ] && export LC_TIME
581 + [ -n "${LC_COLLATE}" ] && export LC_COLLATE
582 + [ -n "${LC_MONETARY}" ] && export LC_MONETARY
583 + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
584 + [ -n "${LC_ALL}" ] && export LC_ALL
585 + fi
586 +
587 + einfo "You can modify the paths and options passed to initdb by editing:"
588 + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
589 + einfo
590 + einfo "Information on options that can be passed to initdb are found at:"
591 + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
592 + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
593 + einfo
594 + einfo "PG_INITDB_OPTS is currently set to:"
595 + if [[ -z "${PG_INITDB_OPTS}" ]] ; then
596 + einfo " (none)"
597 + else
598 + einfo " ${PG_INITDB_OPTS}"
599 + fi
600 + einfo
601 + einfo "Configuration files will be installed to:"
602 + einfo " ${PGDATA}"
603 + einfo
604 + einfo "The database cluster will be created in:"
605 + einfo " ${DATA_DIR}"
606 + einfo
607 +
608 + ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
609 + sleep 5
610 + eend 0
611 +
612 + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
613 + eerror "The given directory, '${DATA_DIR}', is not empty."
614 + eerror "Modify DATA_DIR to point to an empty directory."
615 + die "${DATA_DIR} is not empty."
616 + fi
617 +
618 + einfo "Creating the data directory ..."
619 + if [[ ${EUID} == 0 ]] ; then
620 + mkdir -p "${DATA_DIR}"
621 + chown -Rf postgres:postgres "${DATA_DIR}"
622 + chmod 0700 "${DATA_DIR}"
623 + fi
624 +
625 + einfo "Initializing the database ..."
626 +
627 + if [[ ${EUID} == 0 ]] ; then
628 + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
629 + else
630 + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
631 + fi
632 +
633 + if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
634 + mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
635 + ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
636 + fi
637 +
638 + # unix_socket_directory has no effect in postgresql.conf as it's
639 + # overridden in the initscript
640 + sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
641 +
642 + cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
643 + # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
644 + # On the off-chance that you might need to work with UTF-8 encoded
645 + # characters in PL/Perl
646 + plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
647 + EOF
648 +
649 + einfo "The autovacuum function, which was in contrib, has been moved to the main"
650 + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
651 + einfo "by default. You can disable it in the cluster's:"
652 + einfo " ${PGDATA%/}/postgresql.conf"
653 + einfo
654 + if ! use systemd; then
655 + einfo "The PostgreSQL server, by default, will log events to:"
656 + einfo " ${DATA_DIR%/}/postmaster.log"
657 + einfo
658 + fi
659 + if use prefix ; then
660 + einfo "The location of the configuration files have moved to:"
661 + einfo " ${PGDATA}"
662 + einfo "To start the server:"
663 + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
664 + einfo "To stop:"
665 + einfo " pg_ctl stop -D ${DATA_DIR}"
666 + einfo
667 + einfo "Or move the configuration files back:"
668 + einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
669 + elif use systemd; then
670 + einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL"
671 + einfo "instead of 'pg_ctl'."
672 + else
673 + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
674 + einfo "instead of 'pg_ctl'."
675 + fi
676 +}
677 +
678 +src_test() {
679 + if use server && [[ ${UID} -ne 0 ]] ; then
680 + emake check
681 +
682 + einfo "If you think other tests besides the regression tests are necessary, please"
683 + einfo "submit a bug including a patch for this ebuild to enable them."
684 + else
685 + use server || \
686 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
687 + [[ ${UID} -eq 0 ]] || \
688 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
689 +
690 + ewarn 'Skipping.'
691 + fi
692 +}
693
694 diff --git a/dev-db/postgresql/postgresql-9.2.22.ebuild b/dev-db/postgresql/postgresql-9.2.22.ebuild
695 new file mode 100644
696 index 00000000000..b32870c3a84
697 --- /dev/null
698 +++ b/dev-db/postgresql/postgresql-9.2.22.ebuild
699 @@ -0,0 +1,445 @@
700 +# Copyright 1999-2017 Gentoo Foundation
701 +# Distributed under the terms of the GNU General Public License v2
702 +
703 +EAPI="6"
704 +
705 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
706 +
707 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
708 + systemd user versionator
709 +
710 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
711 +
712 +SLOT="$(get_version_component_range 1-2)"
713 +
714 +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
715 +
716 +LICENSE="POSTGRESQL GPL-2"
717 +DESCRIPTION="PostgreSQL RDBMS"
718 +HOMEPAGE="http://www.postgresql.org/"
719 +
720 +LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
721 + zh_CN zh_TW"
722 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
723 + +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
724 +
725 +for lingua in ${LINGUAS}; do
726 + IUSE+=" linguas_${lingua}"
727 +done
728 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
729 +
730 +wanted_languages() {
731 + local enable_langs
732 +
733 + for lingua in ${LINGUAS} ; do
734 + use linguas_${lingua} && enable_langs+="${lingua} "
735 + done
736 +
737 + echo -n ${enable_langs}
738 +}
739 +
740 +CDEPEND="
741 +>=app-eselect/eselect-postgresql-2.0
742 +sys-apps/less
743 +virtual/libintl
744 +kerberos? ( virtual/krb5 )
745 +ldap? ( net-nds/openldap )
746 +pam? ( virtual/pam )
747 +perl? ( >=dev-lang/perl-5.8:= )
748 +python? ( ${PYTHON_DEPS} )
749 +readline? ( sys-libs/readline:0= )
750 +ssl? (
751 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
752 + libressl? ( dev-libs/libressl:= )
753 +)
754 +tcl? ( >=dev-lang/tcl-8:0= )
755 +uuid? ( dev-libs/ossp-uuid )
756 +xml? ( dev-libs/libxml2 dev-libs/libxslt )
757 +zlib? ( sys-libs/zlib )
758 +"
759 +
760 +DEPEND="${CDEPEND}
761 +!!<sys-apps/sandbox-2.0
762 +sys-devel/bison
763 +sys-devel/flex
764 +nls? ( sys-devel/gettext )
765 +xml? ( virtual/pkgconfig )
766 +"
767 +
768 +RDEPEND="${CDEPEND}
769 +!dev-db/postgresql-docs:${SLOT}
770 +!dev-db/postgresql-base:${SLOT}
771 +!dev-db/postgresql-server:${SLOT}
772 +selinux? ( sec-policy/selinux-postgresql )
773 +"
774 +
775 +pkg_setup() {
776 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
777 +
778 + enewgroup postgres 70
779 + enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
780 +
781 + use python && python-single-r1_pkg_setup
782 +}
783 +
784 +src_prepare() {
785 + # Work around PPC{,64} compilation bug where bool is already defined
786 + sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
787 +
788 + # Set proper run directory
789 + sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
790 + -i src/include/pg_config_manual.h || die
791 +
792 + use server || eapply "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
793 +
794 + if use pam ; then
795 + sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
796 + -i src/backend/libpq/auth.c || \
797 + die 'PGSQL_PAM_SERVICE rename failed.'
798 + fi
799 +
800 + eapply_user
801 +}
802 +
803 +src_configure() {
804 + case ${CHOST} in
805 + *-darwin*|*-solaris*)
806 + use nls && append-libs intl
807 + ;;
808 + esac
809 +
810 + export LDFLAGS_SL="${LDFLAGS}"
811 + export LDFLAGS_EX="${LDFLAGS}"
812 +
813 + local PO="${EPREFIX%/}"
814 +
815 + econf \
816 + --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
817 + --datadir="${PO}/usr/share/postgresql-${SLOT}" \
818 + --docdir="${PO}/usr/share/doc/${PF}" \
819 + --includedir="${PO}/usr/include/postgresql-${SLOT}" \
820 + --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
821 + --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
822 + --with-system-tzdata="${PO}/usr/share/zoneinfo" \
823 + $(use_enable !pg_legacytimestamp integer-datetimes) \
824 + $(use_enable threads thread-safety) \
825 + $(use_with kerberos gssapi) \
826 + $(use_with kerberos krb5) \
827 + $(use_with ldap) \
828 + $(use_with pam) \
829 + $(use_with perl) \
830 + $(use_with python) \
831 + $(use_with readline) \
832 + $(use_with ssl openssl) \
833 + $(use_with tcl) \
834 + $(use_with uuid ossp-uuid) \
835 + $(use_with xml libxml) \
836 + $(use_with xml libxslt) \
837 + $(use_with zlib) \
838 + "$(use_enable nls nls "$(wanted_languages)")"
839 +}
840 +
841 +src_compile() {
842 + emake
843 + emake -C contrib
844 +}
845 +
846 +src_install() {
847 + emake DESTDIR="${D}" install
848 + emake DESTDIR="${D}" install -C contrib
849 +
850 + dodoc README HISTORY doc/{TODO,bug.template}
851 +
852 + # man pages are already built, but if we have the target make them,
853 + # they'll be generated from source before being installed so we
854 + # manually install man pages.
855 + # We use ${SLOT} instead of doman for postgresql.eselect
856 + insinto /usr/share/postgresql-${SLOT}/man/
857 + doins -r doc/src/sgml/man{1,3,7}
858 + if ! use server; then
859 + # Remove man pages for non-existent binaries
860 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
861 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
862 + done
863 + fi
864 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
865 +
866 + # Create slot specific man pages
867 + local bn f mansec slotted_name
868 + for mansec in 1 3 7 ; do
869 + local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
870 +
871 + mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
872 + pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
873 +
874 + for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
875 + bn=$(basename "${f}")
876 + slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
877 + case ${bn} in
878 + TABLE.7|WITH.7)
879 + echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
880 + ;;
881 + *)
882 + echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
883 + ;;
884 + esac
885 + done
886 +
887 + popd > /dev/null
888 + done
889 +
890 + insinto /etc/postgresql-${SLOT}
891 + newins src/bin/psql/psqlrc.sample psqlrc
892 +
893 + use static-libs || find "${ED}" -name '*.a' -delete
894 +
895 + local f bn
896 + for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
897 + -mindepth 1 -maxdepth 1)
898 + do
899 + bn=$(basename "${f}")
900 + # Temporarily tack on tmp to workaround a file collision
901 + # issue. This is only necessary for 9.7 and earlier. 10 never
902 + # had this issue.
903 + dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
904 + "/usr/bin/${bn}${SLOT/.}tmp"
905 + done
906 +
907 + if use doc ; then
908 + docinto html
909 + dodoc doc/src/sgml/html/*
910 +
911 + docinto sgml
912 + dodoc doc/src/sgml/*.{sgml,dsl}
913 + fi
914 +
915 + if use server; then
916 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
917 + "${FILESDIR}/${PN}.confd-9.2" | newconfd - ${PN}-${SLOT}
918 +
919 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
920 + "${FILESDIR}/${PN}.init-9.2" | newinitd - ${PN}-${SLOT}
921 +
922 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
923 + "${FILESDIR}/${PN}.service" | \
924 + systemd_newunit - ${PN}-${SLOT}.service
925 +
926 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
927 +
928 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
929 +
930 + if use prefix ; then
931 + keepdir /run/postgresql
932 + fperms 0775 /run/postgresql
933 + fi
934 + fi
935 +}
936 +
937 +pkg_preinst() {
938 + # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
939 + # /usr/bin/psql96). They may have been created by the
940 + # postgresql.eselect module, but they're handled within this ebuild
941 + # now. It's alright if we momentarily delete /usr/bin/psql as it
942 + # will be recreated by the eselect module in pkg_ppostinst(). This
943 + # is only necessary for 9.7 and earlier. 10 and later were never
944 + # handled in this manner.
945 + local canonicalise
946 + if type -p realpath > /dev/null; then
947 + canonicalise=realpath
948 + elif type -p readlink > /dev/null; then
949 + canonicalise='readlink -f'
950 + else
951 + # can't die, subshell
952 + die "No readlink nor realpath found, cannot canonicalise"
953 + fi
954 +
955 + local l
956 + # First remove any symlinks in /usr/bin that may have been created
957 + # by the old eselect
958 + for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
959 + if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
960 + rm "${l}" || ewarn "Couldn't remove ${l}"
961 + fi
962 + done
963 +
964 + # Then move the symlinks created by the ebuild to their proper place.
965 + for l in "${ED}"/usr/bin/*tmp ; do
966 + mv "${l}" "${l%tmp}" \
967 + || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
968 + done
969 +}
970 +
971 +pkg_postinst() {
972 + postgresql-config update
973 +
974 + elog "If you need a global psqlrc-file, you can place it in:"
975 + elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
976 +
977 + if use server ; then
978 + elog
979 + elog "Gentoo specific documentation:"
980 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
981 + elog
982 + elog "Official documentation:"
983 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
984 + elog
985 + elog "The default location of the Unix-domain socket is:"
986 + elog " ${EROOT%/}/run/postgresql/"
987 + elog
988 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
989 + elog "so that it contains your preferred locale in:"
990 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
991 + elog
992 + elog "Then, execute the following command to setup the initial database"
993 + elog "environment:"
994 + elog " emerge --config =${CATEGORY}/${PF}"
995 + fi
996 +}
997 +
998 +pkg_prerm() {
999 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
1000 + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
1001 + ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
1002 +
1003 + ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
1004 + sleep 10
1005 + eend 0
1006 + fi
1007 +}
1008 +
1009 +pkg_postrm() {
1010 + postgresql-config update
1011 +}
1012 +
1013 +pkg_config() {
1014 + use server || die "USE flag 'server' not enabled. Nothing to configure."
1015 +
1016 + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
1017 + && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1018 + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1019 + [[ -z "${DATA_DIR}" ]] \
1020 + && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
1021 +
1022 + # environment.bz2 may not contain the same locale as the current system
1023 + # locale. Unset and source from the current system locale.
1024 + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
1025 + unset LANG
1026 + unset LC_CTYPE
1027 + unset LC_NUMERIC
1028 + unset LC_TIME
1029 + unset LC_COLLATE
1030 + unset LC_MONETARY
1031 + unset LC_MESSAGES
1032 + unset LC_ALL
1033 + source "${EROOT%/}/etc/env.d/02locale"
1034 + [ -n "${LANG}" ] && export LANG
1035 + [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1036 + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1037 + [ -n "${LC_TIME}" ] && export LC_TIME
1038 + [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1039 + [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1040 + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1041 + [ -n "${LC_ALL}" ] && export LC_ALL
1042 + fi
1043 +
1044 + einfo "You can modify the paths and options passed to initdb by editing:"
1045 + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1046 + einfo
1047 + einfo "Information on options that can be passed to initdb are found at:"
1048 + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1049 + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1050 + einfo
1051 + einfo "PG_INITDB_OPTS is currently set to:"
1052 + if [[ -z "${PG_INITDB_OPTS}" ]] ; then
1053 + einfo " (none)"
1054 + else
1055 + einfo " ${PG_INITDB_OPTS}"
1056 + fi
1057 + einfo
1058 + einfo "Configuration files will be installed to:"
1059 + einfo " ${PGDATA}"
1060 + einfo
1061 + einfo "The database cluster will be created in:"
1062 + einfo " ${DATA_DIR}"
1063 + einfo
1064 +
1065 + ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
1066 + sleep 5
1067 + eend 0
1068 +
1069 + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
1070 + eerror "The given directory, '${DATA_DIR}', is not empty."
1071 + eerror "Modify DATA_DIR to point to an empty directory."
1072 + die "${DATA_DIR} is not empty."
1073 + fi
1074 +
1075 + einfo "Creating the data directory ..."
1076 + if [[ ${EUID} == 0 ]] ; then
1077 + mkdir -p "${DATA_DIR}"
1078 + chown -Rf postgres:postgres "${DATA_DIR}"
1079 + chmod 0700 "${DATA_DIR}"
1080 + fi
1081 +
1082 + einfo "Initializing the database ..."
1083 +
1084 + if [[ ${EUID} == 0 ]] ; then
1085 + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
1086 + else
1087 + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
1088 + fi
1089 +
1090 + if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
1091 + mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
1092 + ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
1093 + fi
1094 +
1095 + # unix_socket_directory has no effect in postgresql.conf as it's
1096 + # overridden in the initscript
1097 + sed '/^#unix_socket_directory/d' -i "${PGDATA%/}"/postgresql.conf
1098 +
1099 + cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
1100 + # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
1101 + # On the off-chance that you might need to work with UTF-8 encoded
1102 + # characters in PL/Perl
1103 + plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
1104 + EOF
1105 +
1106 + einfo "The autovacuum function, which was in contrib, has been moved to the main"
1107 + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
1108 + einfo "by default. You can disable it in the cluster's:"
1109 + einfo " ${PGDATA%/}/postgresql.conf"
1110 + einfo
1111 + einfo "The PostgreSQL server, by default, will log events to:"
1112 + einfo " ${DATA_DIR%/}/postmaster.log"
1113 + einfo
1114 + if use prefix ; then
1115 + einfo "The location of the configuration files have moved to:"
1116 + einfo " ${PGDATA}"
1117 + einfo "To start the server:"
1118 + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
1119 + einfo "To stop:"
1120 + einfo " pg_ctl stop -D ${DATA_DIR}"
1121 + einfo
1122 + einfo "Or move the configuration files back:"
1123 + einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
1124 + else
1125 + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
1126 + einfo "instead of 'pg_ctl'."
1127 + fi
1128 +}
1129 +
1130 +src_test() {
1131 + if use server && [[ ${UID} -ne 0 ]] ; then
1132 + emake check
1133 +
1134 + einfo "If you think other tests besides the regression tests are necessary, please"
1135 + einfo "submit a bug including a patch for this ebuild to enable them."
1136 + else
1137 + use server || \
1138 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
1139 + [[ ${UID} -eq 0 ]] || \
1140 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
1141 +
1142 + ewarn 'Skipping.'
1143 + fi
1144 +}
1145
1146 diff --git a/dev-db/postgresql/postgresql-9.3.18.ebuild b/dev-db/postgresql/postgresql-9.3.18.ebuild
1147 new file mode 100644
1148 index 00000000000..41dc55cea87
1149 --- /dev/null
1150 +++ b/dev-db/postgresql/postgresql-9.3.18.ebuild
1151 @@ -0,0 +1,450 @@
1152 +# Copyright 1999-2017 Gentoo Foundation
1153 +# Distributed under the terms of the GNU General Public License v2
1154 +
1155 +EAPI="6"
1156 +
1157 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
1158 +
1159 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
1160 + systemd user versionator
1161 +
1162 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
1163 +
1164 +SLOT="$(get_version_component_range 1-2)"
1165 +
1166 +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
1167 +
1168 +LICENSE="POSTGRESQL GPL-2"
1169 +DESCRIPTION="PostgreSQL RDBMS"
1170 +HOMEPAGE="http://www.postgresql.org/"
1171 +
1172 +LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
1173 + zh_CN zh_TW"
1174 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
1175 + +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
1176 +
1177 +for lingua in ${LINGUAS}; do
1178 + IUSE+=" linguas_${lingua}"
1179 +done
1180 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
1181 +
1182 +wanted_languages() {
1183 + local enable_langs
1184 +
1185 + for lingua in ${LINGUAS} ; do
1186 + use linguas_${lingua} && enable_langs+="${lingua} "
1187 + done
1188 +
1189 + echo -n ${enable_langs}
1190 +}
1191 +
1192 +CDEPEND="
1193 +>=app-eselect/eselect-postgresql-2.0
1194 +sys-apps/less
1195 +virtual/libintl
1196 +kerberos? ( virtual/krb5 )
1197 +ldap? ( net-nds/openldap )
1198 +pam? ( virtual/pam )
1199 +perl? ( >=dev-lang/perl-5.8:= )
1200 +python? ( ${PYTHON_DEPS} )
1201 +readline? ( sys-libs/readline:0= )
1202 +ssl? (
1203 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
1204 + libressl? ( dev-libs/libressl:= )
1205 +)
1206 +tcl? ( >=dev-lang/tcl-8:0= )
1207 +uuid? ( dev-libs/ossp-uuid )
1208 +xml? ( dev-libs/libxml2 dev-libs/libxslt )
1209 +zlib? ( sys-libs/zlib )
1210 +"
1211 +
1212 +DEPEND="${CDEPEND}
1213 +!!<sys-apps/sandbox-2.0
1214 +sys-devel/bison
1215 +sys-devel/flex
1216 +nls? ( sys-devel/gettext )
1217 +xml? ( virtual/pkgconfig )
1218 +"
1219 +
1220 +RDEPEND="${CDEPEND}
1221 +!dev-db/postgresql-docs:${SLOT}
1222 +!dev-db/postgresql-base:${SLOT}
1223 +!dev-db/postgresql-server:${SLOT}
1224 +selinux? ( sec-policy/selinux-postgresql )
1225 +"
1226 +
1227 +pkg_setup() {
1228 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
1229 +
1230 + enewgroup postgres 70
1231 + enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
1232 +
1233 + use python && python-single-r1_pkg_setup
1234 +}
1235 +
1236 +src_prepare() {
1237 + # Work around PPC{,64} compilation bug where bool is already defined
1238 + sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
1239 +
1240 + # Set proper run directory
1241 + sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
1242 + -i src/include/pg_config_manual.h || die
1243 +
1244 + # Rely on $PATH being in the proper order so that the correct
1245 + # install program is used for modules utilizing PGXS in both
1246 + # hardened and non-hardened environments. (Bug #528786)
1247 + sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
1248 +
1249 + use server || eapply "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
1250 +
1251 + if use pam ; then
1252 + sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
1253 + -i src/backend/libpq/auth.c || \
1254 + die 'PGSQL_PAM_SERVICE rename failed.'
1255 + fi
1256 +
1257 + eapply_user
1258 +}
1259 +
1260 +src_configure() {
1261 + case ${CHOST} in
1262 + *-darwin*|*-solaris*)
1263 + use nls && append-libs intl
1264 + ;;
1265 + esac
1266 +
1267 + export LDFLAGS_SL="${LDFLAGS}"
1268 + export LDFLAGS_EX="${LDFLAGS}"
1269 +
1270 + local PO="${EPREFIX%/}"
1271 +
1272 + econf \
1273 + --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
1274 + --datadir="${PO}/usr/share/postgresql-${SLOT}" \
1275 + --docdir="${PO}/usr/share/doc/${PF}" \
1276 + --includedir="${PO}/usr/include/postgresql-${SLOT}" \
1277 + --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
1278 + --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
1279 + --with-system-tzdata="${PO}/usr/share/zoneinfo" \
1280 + $(use_enable !pg_legacytimestamp integer-datetimes) \
1281 + $(use_enable threads thread-safety) \
1282 + $(use_with kerberos gssapi) \
1283 + $(use_with kerberos krb5) \
1284 + $(use_with ldap) \
1285 + $(use_with pam) \
1286 + $(use_with perl) \
1287 + $(use_with python) \
1288 + $(use_with readline) \
1289 + $(use_with ssl openssl) \
1290 + $(use_with tcl) \
1291 + $(use_with uuid ossp-uuid) \
1292 + $(use_with xml libxml) \
1293 + $(use_with xml libxslt) \
1294 + $(use_with zlib) \
1295 + "$(use_enable nls nls "$(wanted_languages)")"
1296 +}
1297 +
1298 +src_compile() {
1299 + emake
1300 + emake -C contrib
1301 +}
1302 +
1303 +src_install() {
1304 + emake DESTDIR="${D}" install
1305 + emake DESTDIR="${D}" install -C contrib
1306 +
1307 + dodoc README HISTORY doc/{TODO,bug.template}
1308 +
1309 + # man pages are already built, but if we have the target make them,
1310 + # they'll be generated from source before being installed so we
1311 + # manually install man pages.
1312 + # We use ${SLOT} instead of doman for postgresql.eselect
1313 + insinto /usr/share/postgresql-${SLOT}/man/
1314 + doins -r doc/src/sgml/man{1,3,7}
1315 + if ! use server; then
1316 + # Remove man pages for non-existent binaries
1317 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
1318 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
1319 + done
1320 + fi
1321 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
1322 +
1323 + # Create slot specific man pages
1324 + local bn f mansec slotted_name
1325 + for mansec in 1 3 7 ; do
1326 + local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
1327 +
1328 + mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
1329 + pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
1330 +
1331 + for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
1332 + bn=$(basename "${f}")
1333 + slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
1334 + case ${bn} in
1335 + TABLE.7|WITH.7)
1336 + echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
1337 + ;;
1338 + *)
1339 + echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
1340 + ;;
1341 + esac
1342 + done
1343 +
1344 + popd > /dev/null
1345 + done
1346 +
1347 + insinto /etc/postgresql-${SLOT}
1348 + newins src/bin/psql/psqlrc.sample psqlrc
1349 +
1350 + use static-libs || find "${ED}" -name '*.a' -delete
1351 +
1352 + local f bn
1353 + for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
1354 + -mindepth 1 -maxdepth 1)
1355 + do
1356 + bn=$(basename "${f}")
1357 + # Temporarily tack on tmp to workaround a file collision
1358 + # issue. This is only necessary for 9.7 and earlier. 10 never
1359 + # had this issue.
1360 + dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
1361 + "/usr/bin/${bn}${SLOT/.}tmp"
1362 + done
1363 +
1364 + if use doc ; then
1365 + docinto html
1366 + dodoc doc/src/sgml/html/*
1367 +
1368 + docinto sgml
1369 + dodoc doc/src/sgml/*.{sgml,dsl}
1370 + fi
1371 +
1372 + if use server; then
1373 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1374 + "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
1375 +
1376 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1377 + "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
1378 +
1379 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1380 + "${FILESDIR}/${PN}.service" | \
1381 + systemd_newunit - ${PN}-${SLOT}.service
1382 +
1383 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
1384 +
1385 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
1386 +
1387 + if use prefix ; then
1388 + keepdir /run/postgresql
1389 + fperms 0775 /run/postgresql
1390 + fi
1391 + fi
1392 +}
1393 +
1394 +pkg_preinst() {
1395 + # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
1396 + # /usr/bin/psql96). They may have been created by the
1397 + # postgresql.eselect module, but they're handled within this ebuild
1398 + # now. It's alright if we momentarily delete /usr/bin/psql as it
1399 + # will be recreated by the eselect module in pkg_ppostinst(). This
1400 + # is only necessary for 9.7 and earlier. 10 and later were never
1401 + # handled in this manner.
1402 + local canonicalise
1403 + if type -p realpath > /dev/null; then
1404 + canonicalise=realpath
1405 + elif type -p readlink > /dev/null; then
1406 + canonicalise='readlink -f'
1407 + else
1408 + # can't die, subshell
1409 + die "No readlink nor realpath found, cannot canonicalise"
1410 + fi
1411 +
1412 + local l
1413 + # First remove any symlinks in /usr/bin that may have been created
1414 + # by the old eselect
1415 + for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
1416 + if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
1417 + rm "${l}" || ewarn "Couldn't remove ${l}"
1418 + fi
1419 + done
1420 +
1421 + # Then move the symlinks created by the ebuild to their proper place.
1422 + for l in "${ED}"/usr/bin/*tmp ; do
1423 + mv "${l}" "${l%tmp}" \
1424 + || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
1425 + done
1426 +}
1427 +
1428 +pkg_postinst() {
1429 + postgresql-config update
1430 +
1431 + elog "If you need a global psqlrc-file, you can place it in:"
1432 + elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
1433 +
1434 + if use server ; then
1435 + elog
1436 + elog "Gentoo specific documentation:"
1437 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
1438 + elog
1439 + elog "Official documentation:"
1440 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
1441 + elog
1442 + elog "The default location of the Unix-domain socket is:"
1443 + elog " ${EROOT%/}/run/postgresql/"
1444 + elog
1445 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1446 + elog "so that it contains your preferred locale in:"
1447 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1448 + elog
1449 + elog "Then, execute the following command to setup the initial database"
1450 + elog "environment:"
1451 + elog " emerge --config =${CATEGORY}/${PF}"
1452 + fi
1453 +}
1454 +
1455 +pkg_prerm() {
1456 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
1457 + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
1458 + ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
1459 +
1460 + ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
1461 + sleep 10
1462 + eend 0
1463 + fi
1464 +}
1465 +
1466 +pkg_postrm() {
1467 + postgresql-config update
1468 +}
1469 +
1470 +pkg_config() {
1471 + use server || die "USE flag 'server' not enabled. Nothing to configure."
1472 +
1473 + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
1474 + && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1475 + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1476 + [[ -z "${DATA_DIR}" ]] \
1477 + && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
1478 +
1479 + # environment.bz2 may not contain the same locale as the current system
1480 + # locale. Unset and source from the current system locale.
1481 + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
1482 + unset LANG
1483 + unset LC_CTYPE
1484 + unset LC_NUMERIC
1485 + unset LC_TIME
1486 + unset LC_COLLATE
1487 + unset LC_MONETARY
1488 + unset LC_MESSAGES
1489 + unset LC_ALL
1490 + source "${EROOT%/}/etc/env.d/02locale"
1491 + [ -n "${LANG}" ] && export LANG
1492 + [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1493 + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1494 + [ -n "${LC_TIME}" ] && export LC_TIME
1495 + [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1496 + [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1497 + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1498 + [ -n "${LC_ALL}" ] && export LC_ALL
1499 + fi
1500 +
1501 + einfo "You can modify the paths and options passed to initdb by editing:"
1502 + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1503 + einfo
1504 + einfo "Information on options that can be passed to initdb are found at:"
1505 + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1506 + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1507 + einfo
1508 + einfo "PG_INITDB_OPTS is currently set to:"
1509 + if [[ -z "${PG_INITDB_OPTS}" ]] ; then
1510 + einfo " (none)"
1511 + else
1512 + einfo " ${PG_INITDB_OPTS}"
1513 + fi
1514 + einfo
1515 + einfo "Configuration files will be installed to:"
1516 + einfo " ${PGDATA}"
1517 + einfo
1518 + einfo "The database cluster will be created in:"
1519 + einfo " ${DATA_DIR}"
1520 + einfo
1521 +
1522 + ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
1523 + sleep 5
1524 + eend 0
1525 +
1526 + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
1527 + eerror "The given directory, '${DATA_DIR}', is not empty."
1528 + eerror "Modify DATA_DIR to point to an empty directory."
1529 + die "${DATA_DIR} is not empty."
1530 + fi
1531 +
1532 + einfo "Creating the data directory ..."
1533 + if [[ ${EUID} == 0 ]] ; then
1534 + mkdir -p "${DATA_DIR}"
1535 + chown -Rf postgres:postgres "${DATA_DIR}"
1536 + chmod 0700 "${DATA_DIR}"
1537 + fi
1538 +
1539 + einfo "Initializing the database ..."
1540 +
1541 + if [[ ${EUID} == 0 ]] ; then
1542 + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
1543 + else
1544 + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
1545 + fi
1546 +
1547 + if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
1548 + mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
1549 + ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
1550 + fi
1551 +
1552 + # unix_socket_directory has no effect in postgresql.conf as it's
1553 + # overridden in the initscript
1554 + sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
1555 +
1556 + cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
1557 + # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
1558 + # On the off-chance that you might need to work with UTF-8 encoded
1559 + # characters in PL/Perl
1560 + plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
1561 + EOF
1562 +
1563 + einfo "The autovacuum function, which was in contrib, has been moved to the main"
1564 + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
1565 + einfo "by default. You can disable it in the cluster's:"
1566 + einfo " ${PGDATA%/}/postgresql.conf"
1567 + einfo
1568 + einfo "The PostgreSQL server, by default, will log events to:"
1569 + einfo " ${DATA_DIR%/}/postmaster.log"
1570 + einfo
1571 + if use prefix ; then
1572 + einfo "The location of the configuration files have moved to:"
1573 + einfo " ${PGDATA}"
1574 + einfo "To start the server:"
1575 + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
1576 + einfo "To stop:"
1577 + einfo " pg_ctl stop -D ${DATA_DIR}"
1578 + einfo
1579 + einfo "Or move the configuration files back:"
1580 + einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
1581 + else
1582 + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
1583 + einfo "instead of 'pg_ctl'."
1584 + fi
1585 +}
1586 +
1587 +src_test() {
1588 + if use server && [[ ${UID} -ne 0 ]] ; then
1589 + emake check
1590 +
1591 + einfo "If you think other tests besides the regression tests are necessary, please"
1592 + einfo "submit a bug including a patch for this ebuild to enable them."
1593 + else
1594 + use server || \
1595 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
1596 + [[ ${UID} -eq 0 ]] || \
1597 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
1598 +
1599 + ewarn 'Skipping.'
1600 + fi
1601 +}
1602
1603 diff --git a/dev-db/postgresql/postgresql-9.4.13.ebuild b/dev-db/postgresql/postgresql-9.4.13.ebuild
1604 new file mode 100644
1605 index 00000000000..a5ce342394d
1606 --- /dev/null
1607 +++ b/dev-db/postgresql/postgresql-9.4.13.ebuild
1608 @@ -0,0 +1,482 @@
1609 +# Copyright 1999-2017 Gentoo Foundation
1610 +# Distributed under the terms of the GNU General Public License v2
1611 +
1612 +EAPI="6"
1613 +
1614 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
1615 +
1616 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
1617 + systemd user versionator
1618 +
1619 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
1620 +
1621 +SLOT="$(get_version_component_range 1-2)"
1622 +
1623 +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
1624 +
1625 +LICENSE="POSTGRESQL GPL-2"
1626 +DESCRIPTION="PostgreSQL RDBMS"
1627 +HOMEPAGE="http://www.postgresql.org/"
1628 +
1629 +LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
1630 + zh_CN zh_TW"
1631 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
1632 + +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
1633 +
1634 +for lingua in ${LINGUAS}; do
1635 + IUSE+=" linguas_${lingua}"
1636 +done
1637 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
1638 +
1639 +wanted_languages() {
1640 + local enable_langs
1641 +
1642 + for lingua in ${LINGUAS} ; do
1643 + use linguas_${lingua} && enable_langs+="${lingua} "
1644 + done
1645 +
1646 + echo -n ${enable_langs}
1647 +}
1648 +
1649 +CDEPEND="
1650 +>=app-eselect/eselect-postgresql-2.0
1651 +sys-apps/less
1652 +virtual/libintl
1653 +kerberos? ( virtual/krb5 )
1654 +ldap? ( net-nds/openldap )
1655 +pam? ( virtual/pam )
1656 +perl? ( >=dev-lang/perl-5.8:= )
1657 +python? ( ${PYTHON_DEPS} )
1658 +readline? ( sys-libs/readline:0= )
1659 +ssl? (
1660 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
1661 + libressl? ( dev-libs/libressl:= )
1662 +)
1663 +tcl? ( >=dev-lang/tcl-8:0= )
1664 +xml? ( dev-libs/libxml2 dev-libs/libxslt )
1665 +zlib? ( sys-libs/zlib )
1666 +"
1667 +
1668 +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
1669 +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
1670 +# the libc includes UUID functions.
1671 +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
1672 +BSD_LIBC=( elibc_{Free,Net,Open}BSD )
1673 +
1674 +nest_usedep() {
1675 + local front back
1676 + while [[ ${#} -gt 1 ]]; do
1677 + front+="${1}? ( "
1678 + back+=" )"
1679 + shift
1680 + done
1681 + echo "${front}${1}${back}"
1682 +}
1683 +
1684 +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
1685 +CDEPEND+="
1686 +uuid? (
1687 + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
1688 + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
1689 +)"
1690 +
1691 +DEPEND="${CDEPEND}
1692 +!!<sys-apps/sandbox-2.0
1693 +sys-devel/bison
1694 +sys-devel/flex
1695 +nls? ( sys-devel/gettext )
1696 +xml? ( virtual/pkgconfig )
1697 +"
1698 +
1699 +RDEPEND="${CDEPEND}
1700 +!dev-db/postgresql-docs:${SLOT}
1701 +!dev-db/postgresql-base:${SLOT}
1702 +!dev-db/postgresql-server:${SLOT}
1703 +selinux? ( sec-policy/selinux-postgresql )
1704 +"
1705 +
1706 +pkg_setup() {
1707 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
1708 +
1709 + enewgroup postgres 70
1710 + enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
1711 +
1712 + use python && python-single-r1_pkg_setup
1713 +}
1714 +
1715 +src_prepare() {
1716 + # Work around PPC{,64} compilation bug where bool is already defined
1717 + sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
1718 +
1719 + # Set proper run directory
1720 + sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
1721 + -i src/include/pg_config_manual.h || die
1722 +
1723 + # Rely on $PATH being in the proper order so that the correct
1724 + # install program is used for modules utilizing PGXS in both
1725 + # hardened and non-hardened environments. (Bug #528786)
1726 + sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
1727 +
1728 + use server || eapply "${FILESDIR}/${PN}-9.4.10-no-server.patch"
1729 +
1730 + if use pam ; then
1731 + sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
1732 + -i src/backend/libpq/auth.c || \
1733 + die 'PGSQL_PAM_SERVICE rename failed.'
1734 + fi
1735 +
1736 + eapply_user
1737 +}
1738 +
1739 +src_configure() {
1740 + case ${CHOST} in
1741 + *-darwin*|*-solaris*)
1742 + use nls && append-libs intl
1743 + ;;
1744 + esac
1745 +
1746 + export LDFLAGS_SL="${LDFLAGS}"
1747 + export LDFLAGS_EX="${LDFLAGS}"
1748 +
1749 + local PO="${EPREFIX%/}"
1750 +
1751 + local i uuid_config=""
1752 + if use uuid; then
1753 + for i in ${UTIL_LINUX_LIBC[@]}; do
1754 + use ${i} && uuid_config="--with-uuid=e2fs"
1755 + done
1756 + for i in ${BSD_LIBC[@]}; do
1757 + use ${i} && uuid_config="--with-uuid=bsd"
1758 + done
1759 + [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
1760 + fi
1761 +
1762 + econf \
1763 + --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
1764 + --datadir="${PO}/usr/share/postgresql-${SLOT}" \
1765 + --docdir="${PO}/usr/share/doc/${PF}" \
1766 + --includedir="${PO}/usr/include/postgresql-${SLOT}" \
1767 + --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
1768 + --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
1769 + --with-system-tzdata="${PO}/usr/share/zoneinfo" \
1770 + $(use_enable !pg_legacytimestamp integer-datetimes) \
1771 + $(use_enable threads thread-safety) \
1772 + $(use_with kerberos gssapi) \
1773 + $(use_with ldap) \
1774 + $(use_with pam) \
1775 + $(use_with perl) \
1776 + $(use_with python) \
1777 + $(use_with readline) \
1778 + $(use_with ssl openssl) \
1779 + $(use_with tcl) \
1780 + ${uuid_config} \
1781 + $(use_with xml libxml) \
1782 + $(use_with xml libxslt) \
1783 + $(use_with zlib) \
1784 + "$(use_enable nls nls "$(wanted_languages)")"
1785 +}
1786 +
1787 +src_compile() {
1788 + emake
1789 + emake -C contrib
1790 +}
1791 +
1792 +src_install() {
1793 + emake DESTDIR="${D}" install
1794 + emake DESTDIR="${D}" install -C contrib
1795 +
1796 + dodoc README HISTORY doc/{TODO,bug.template}
1797 +
1798 + # man pages are already built, but if we have the target make them,
1799 + # they'll be generated from source before being installed so we
1800 + # manually install man pages.
1801 + # We use ${SLOT} instead of doman for postgresql.eselect
1802 + insinto /usr/share/postgresql-${SLOT}/man/
1803 + doins -r doc/src/sgml/man{1,3,7}
1804 + if ! use server; then
1805 + # Remove man pages for non-existent binaries
1806 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
1807 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
1808 + done
1809 + fi
1810 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
1811 +
1812 + # Create slot specific man pages
1813 + local bn f mansec slotted_name
1814 + for mansec in 1 3 7 ; do
1815 + local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
1816 +
1817 + mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
1818 + pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
1819 +
1820 + for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
1821 + bn=$(basename "${f}")
1822 + slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
1823 + case ${bn} in
1824 + TABLE.7|WITH.7)
1825 + echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
1826 + ;;
1827 + *)
1828 + echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
1829 + ;;
1830 + esac
1831 + done
1832 +
1833 + popd > /dev/null
1834 + done
1835 +
1836 + insinto /etc/postgresql-${SLOT}
1837 + newins src/bin/psql/psqlrc.sample psqlrc
1838 +
1839 + use static-libs || find "${ED}" -name '*.a' -delete
1840 +
1841 + local f bn
1842 + for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
1843 + -mindepth 1 -maxdepth 1)
1844 + do
1845 + bn=$(basename "${f}")
1846 + # Temporarily tack on tmp to workaround a file collision
1847 + # issue. This is only necessary for 9.7 and earlier. 10 never
1848 + # had this issue.
1849 + dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
1850 + "/usr/bin/${bn}${SLOT/.}tmp"
1851 + done
1852 +
1853 + if use doc ; then
1854 + docinto html
1855 + dodoc doc/src/sgml/html/*
1856 +
1857 + docinto sgml
1858 + dodoc doc/src/sgml/*.{sgml,dsl}
1859 + fi
1860 +
1861 + if use server; then
1862 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1863 + "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
1864 +
1865 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1866 + "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
1867 +
1868 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1869 + "${FILESDIR}/${PN}.service" | \
1870 + systemd_newunit - ${PN}-${SLOT}.service
1871 +
1872 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
1873 +
1874 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
1875 +
1876 + if use prefix ; then
1877 + keepdir /run/postgresql
1878 + fperms 0775 /run/postgresql
1879 + fi
1880 + fi
1881 +}
1882 +
1883 +pkg_preinst() {
1884 + # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
1885 + # /usr/bin/psql96). They may have been created by the
1886 + # postgresql.eselect module, but they're handled within this ebuild
1887 + # now. It's alright if we momentarily delete /usr/bin/psql as it
1888 + # will be recreated by the eselect module in pkg_ppostinst(). This
1889 + # is only necessary for 9.7 and earlier. 10 and later were never
1890 + # handled in this manner.
1891 + local canonicalise
1892 + if type -p realpath > /dev/null; then
1893 + canonicalise=realpath
1894 + elif type -p readlink > /dev/null; then
1895 + canonicalise='readlink -f'
1896 + else
1897 + # can't die, subshell
1898 + die "No readlink nor realpath found, cannot canonicalise"
1899 + fi
1900 +
1901 + local l
1902 + # First remove any symlinks in /usr/bin that may have been created
1903 + # by the old eselect
1904 + for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
1905 + if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
1906 + rm "${l}" || ewarn "Couldn't remove ${l}"
1907 + fi
1908 + done
1909 +
1910 + # Then move the symlinks created by the ebuild to their proper place.
1911 + for l in "${ED}"/usr/bin/*tmp ; do
1912 + mv "${l}" "${l%tmp}" \
1913 + || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
1914 + done
1915 +}
1916 +
1917 +pkg_postinst() {
1918 + postgresql-config update
1919 +
1920 + elog "If you need a global psqlrc-file, you can place it in:"
1921 + elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
1922 +
1923 + if use server ; then
1924 + elog
1925 + elog "Gentoo specific documentation:"
1926 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
1927 + elog
1928 + elog "Official documentation:"
1929 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
1930 + elog
1931 + elog "The default location of the Unix-domain socket is:"
1932 + elog " ${EROOT%/}/run/postgresql/"
1933 + elog
1934 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1935 + elog "so that it contains your preferred locale in:"
1936 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1937 + elog
1938 + elog "Then, execute the following command to setup the initial database"
1939 + elog "environment:"
1940 + elog " emerge --config =${CATEGORY}/${PF}"
1941 + fi
1942 +}
1943 +
1944 +pkg_prerm() {
1945 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
1946 + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
1947 + ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
1948 +
1949 + ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
1950 + sleep 10
1951 + eend 0
1952 + fi
1953 +}
1954 +
1955 +pkg_postrm() {
1956 + postgresql-config update
1957 +}
1958 +
1959 +pkg_config() {
1960 + use server || die "USE flag 'server' not enabled. Nothing to configure."
1961 +
1962 + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
1963 + && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1964 + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1965 + [[ -z "${DATA_DIR}" ]] \
1966 + && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
1967 +
1968 + # environment.bz2 may not contain the same locale as the current system
1969 + # locale. Unset and source from the current system locale.
1970 + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
1971 + unset LANG
1972 + unset LC_CTYPE
1973 + unset LC_NUMERIC
1974 + unset LC_TIME
1975 + unset LC_COLLATE
1976 + unset LC_MONETARY
1977 + unset LC_MESSAGES
1978 + unset LC_ALL
1979 + source "${EROOT%/}/etc/env.d/02locale"
1980 + [ -n "${LANG}" ] && export LANG
1981 + [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1982 + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1983 + [ -n "${LC_TIME}" ] && export LC_TIME
1984 + [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1985 + [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1986 + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1987 + [ -n "${LC_ALL}" ] && export LC_ALL
1988 + fi
1989 +
1990 + einfo "You can modify the paths and options passed to initdb by editing:"
1991 + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1992 + einfo
1993 + einfo "Information on options that can be passed to initdb are found at:"
1994 + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1995 + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1996 + einfo
1997 + einfo "PG_INITDB_OPTS is currently set to:"
1998 + if [[ -z "${PG_INITDB_OPTS}" ]] ; then
1999 + einfo " (none)"
2000 + else
2001 + einfo " ${PG_INITDB_OPTS}"
2002 + fi
2003 + einfo
2004 + einfo "Configuration files will be installed to:"
2005 + einfo " ${PGDATA}"
2006 + einfo
2007 + einfo "The database cluster will be created in:"
2008 + einfo " ${DATA_DIR}"
2009 + einfo
2010 +
2011 + ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
2012 + sleep 5
2013 + eend 0
2014 +
2015 + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
2016 + eerror "The given directory, '${DATA_DIR}', is not empty."
2017 + eerror "Modify DATA_DIR to point to an empty directory."
2018 + die "${DATA_DIR} is not empty."
2019 + fi
2020 +
2021 + einfo "Creating the data directory ..."
2022 + if [[ ${EUID} == 0 ]] ; then
2023 + mkdir -p "${DATA_DIR}"
2024 + chown -Rf postgres:postgres "${DATA_DIR}"
2025 + chmod 0700 "${DATA_DIR}"
2026 + fi
2027 +
2028 + einfo "Initializing the database ..."
2029 +
2030 + if [[ ${EUID} == 0 ]] ; then
2031 + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
2032 + else
2033 + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
2034 + fi
2035 +
2036 + if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
2037 + mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
2038 + ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
2039 + fi
2040 +
2041 + # unix_socket_directory has no effect in postgresql.conf as it's
2042 + # overridden in the initscript
2043 + sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
2044 +
2045 + cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
2046 + # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
2047 + # On the off-chance that you might need to work with UTF-8 encoded
2048 + # characters in PL/Perl
2049 + plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
2050 + EOF
2051 +
2052 + einfo "The autovacuum function, which was in contrib, has been moved to the main"
2053 + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
2054 + einfo "by default. You can disable it in the cluster's:"
2055 + einfo " ${PGDATA%/}/postgresql.conf"
2056 + einfo
2057 + einfo "The PostgreSQL server, by default, will log events to:"
2058 + einfo " ${DATA_DIR%/}/postmaster.log"
2059 + einfo
2060 + if use prefix ; then
2061 + einfo "The location of the configuration files have moved to:"
2062 + einfo " ${PGDATA}"
2063 + einfo "To start the server:"
2064 + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
2065 + einfo "To stop:"
2066 + einfo " pg_ctl stop -D ${DATA_DIR}"
2067 + einfo
2068 + einfo "Or move the configuration files back:"
2069 + einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
2070 + else
2071 + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
2072 + einfo "instead of 'pg_ctl'."
2073 + fi
2074 +}
2075 +
2076 +src_test() {
2077 + if use server && [[ ${UID} -ne 0 ]] ; then
2078 + emake check
2079 +
2080 + einfo "If you think other tests besides the regression tests are necessary, please"
2081 + einfo "submit a bug including a patch for this ebuild to enable them."
2082 + else
2083 + use server || \
2084 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
2085 + [[ ${UID} -eq 0 ]] || \
2086 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
2087 +
2088 + ewarn 'Skipping.'
2089 + fi
2090 +}
2091
2092 diff --git a/dev-db/postgresql/postgresql-9.5.8.ebuild b/dev-db/postgresql/postgresql-9.5.8.ebuild
2093 new file mode 100644
2094 index 00000000000..5db745095a8
2095 --- /dev/null
2096 +++ b/dev-db/postgresql/postgresql-9.5.8.ebuild
2097 @@ -0,0 +1,488 @@
2098 +# Copyright 1999-2017 Gentoo Foundation
2099 +# Distributed under the terms of the GNU General Public License v2
2100 +
2101 +EAPI="6"
2102 +
2103 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
2104 +
2105 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
2106 + systemd user versionator
2107 +
2108 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
2109 +
2110 +SLOT="$(get_version_component_range 1-2)"
2111 +
2112 +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
2113 +
2114 +LICENSE="POSTGRESQL GPL-2"
2115 +DESCRIPTION="PostgreSQL RDBMS"
2116 +HOMEPAGE="http://www.postgresql.org/"
2117 +
2118 +LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
2119 + zh_CN zh_TW"
2120 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
2121 + +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
2122 +
2123 +for lingua in ${LINGUAS}; do
2124 + IUSE+=" linguas_${lingua}"
2125 +done
2126 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
2127 +
2128 +wanted_languages() {
2129 + local enable_langs
2130 +
2131 + for lingua in ${LINGUAS} ; do
2132 + use linguas_${lingua} && enable_langs+="${lingua} "
2133 + done
2134 +
2135 + echo -n ${enable_langs}
2136 +}
2137 +
2138 +CDEPEND="
2139 +>=app-eselect/eselect-postgresql-2.0
2140 +sys-apps/less
2141 +virtual/libintl
2142 +kerberos? ( virtual/krb5 )
2143 +ldap? ( net-nds/openldap )
2144 +pam? ( virtual/pam )
2145 +perl? ( >=dev-lang/perl-5.8:= )
2146 +python? ( ${PYTHON_DEPS} )
2147 +readline? ( sys-libs/readline:0= )
2148 +ssl? (
2149 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
2150 + libressl? ( dev-libs/libressl:= )
2151 +)
2152 +tcl? ( >=dev-lang/tcl-8:0= )
2153 +xml? ( dev-libs/libxml2 dev-libs/libxslt )
2154 +zlib? ( sys-libs/zlib )
2155 +"
2156 +
2157 +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
2158 +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
2159 +# the libc includes UUID functions.
2160 +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
2161 +BSD_LIBC=( elibc_{Free,Net,Open}BSD )
2162 +
2163 +nest_usedep() {
2164 + local front back
2165 + while [[ ${#} -gt 1 ]]; do
2166 + front+="${1}? ( "
2167 + back+=" )"
2168 + shift
2169 + done
2170 + echo "${front}${1}${back}"
2171 +}
2172 +
2173 +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
2174 +CDEPEND+="
2175 +uuid? (
2176 + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
2177 + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
2178 +)"
2179 +
2180 +DEPEND="${CDEPEND}
2181 +!!<sys-apps/sandbox-2.0
2182 +sys-devel/bison
2183 +sys-devel/flex
2184 +nls? ( sys-devel/gettext )
2185 +xml? ( virtual/pkgconfig )
2186 +"
2187 +
2188 +RDEPEND="${CDEPEND}
2189 +!dev-db/postgresql-docs:${SLOT}
2190 +!dev-db/postgresql-base:${SLOT}
2191 +!dev-db/postgresql-server:${SLOT}
2192 +selinux? ( sec-policy/selinux-postgresql )
2193 +"
2194 +
2195 +pkg_setup() {
2196 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
2197 +
2198 + enewgroup postgres 70
2199 + enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
2200 +
2201 + use python && python-single-r1_pkg_setup
2202 +}
2203 +
2204 +src_prepare() {
2205 + # Work around PPC{,64} compilation bug where bool is already defined
2206 + sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
2207 +
2208 + # Set proper run directory
2209 + sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
2210 + -i src/include/pg_config_manual.h || die
2211 +
2212 + # Rely on $PATH being in the proper order so that the correct
2213 + # install program is used for modules utilizing PGXS in both
2214 + # hardened and non-hardened environments. (Bug #528786)
2215 + sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
2216 +
2217 + use server || eapply "${FILESDIR}/${PN}-9.5.5-no-server.patch"
2218 +
2219 + if use pam ; then
2220 + sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
2221 + -i src/backend/libpq/auth.c || \
2222 + die 'PGSQL_PAM_SERVICE rename failed.'
2223 + fi
2224 +
2225 + eapply_user
2226 +}
2227 +
2228 +src_configure() {
2229 + case ${CHOST} in
2230 + *-darwin*|*-solaris*)
2231 + use nls && append-libs intl
2232 + ;;
2233 + esac
2234 +
2235 + export LDFLAGS_SL="${LDFLAGS}"
2236 + export LDFLAGS_EX="${LDFLAGS}"
2237 +
2238 + local PO="${EPREFIX%/}"
2239 +
2240 + local i uuid_config=""
2241 + if use uuid; then
2242 + for i in ${UTIL_LINUX_LIBC[@]}; do
2243 + use ${i} && uuid_config="--with-uuid=e2fs"
2244 + done
2245 + for i in ${BSD_LIBC[@]}; do
2246 + use ${i} && uuid_config="--with-uuid=bsd"
2247 + done
2248 + [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
2249 + fi
2250 +
2251 + econf \
2252 + --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
2253 + --datadir="${PO}/usr/share/postgresql-${SLOT}" \
2254 + --docdir="${PO}/usr/share/doc/${PF}" \
2255 + --includedir="${PO}/usr/include/postgresql-${SLOT}" \
2256 + --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
2257 + --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
2258 + --with-system-tzdata="${PO}/usr/share/zoneinfo" \
2259 + $(use_enable !alpha spinlocks) \
2260 + $(use_enable !pg_legacytimestamp integer-datetimes) \
2261 + $(use_enable threads thread-safety) \
2262 + $(use_with kerberos gssapi) \
2263 + $(use_with ldap) \
2264 + $(use_with pam) \
2265 + $(use_with perl) \
2266 + $(use_with python) \
2267 + $(use_with readline) \
2268 + $(use_with ssl openssl) \
2269 + $(use_with tcl) \
2270 + ${uuid_config} \
2271 + $(use_with xml libxml) \
2272 + $(use_with xml libxslt) \
2273 + $(use_with zlib) \
2274 + "$(use_enable nls nls "$(wanted_languages)")"
2275 +}
2276 +
2277 +src_compile() {
2278 + emake
2279 + emake -C contrib
2280 +}
2281 +
2282 +src_install() {
2283 + emake DESTDIR="${D}" install
2284 + emake DESTDIR="${D}" install -C contrib
2285 +
2286 + dodoc README HISTORY doc/{TODO,bug.template}
2287 +
2288 + # man pages are already built, but if we have the target make them,
2289 + # they'll be generated from source before being installed so we
2290 + # manually install man pages.
2291 + # We use ${SLOT} instead of doman for postgresql.eselect
2292 + insinto /usr/share/postgresql-${SLOT}/man/
2293 + doins -r doc/src/sgml/man{1,3,7}
2294 + if ! use server; then
2295 + # Remove man pages for non-existent binaries
2296 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
2297 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
2298 + done
2299 + fi
2300 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
2301 +
2302 + # Create slot specific man pages
2303 + local bn f mansec slotted_name
2304 + for mansec in 1 3 7 ; do
2305 + local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
2306 +
2307 + mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
2308 + pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
2309 +
2310 + for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
2311 + bn=$(basename "${f}")
2312 + slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
2313 + case ${bn} in
2314 + TABLE.7|WITH.7)
2315 + echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
2316 + ;;
2317 + *)
2318 + echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
2319 + ;;
2320 + esac
2321 + done
2322 +
2323 + popd > /dev/null
2324 + done
2325 +
2326 + insinto /etc/postgresql-${SLOT}
2327 + newins src/bin/psql/psqlrc.sample psqlrc
2328 +
2329 + use static-libs || find "${ED}" -name '*.a' -delete
2330 +
2331 + local f bn
2332 + for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
2333 + -mindepth 1 -maxdepth 1)
2334 + do
2335 + bn=$(basename "${f}")
2336 + # Temporarily tack on tmp to workaround a file collision
2337 + # issue. This is only necessary for 9.7 and earlier. 10 never
2338 + # had this issue.
2339 + dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
2340 + "/usr/bin/${bn}${SLOT/.}tmp"
2341 + done
2342 +
2343 + if use doc ; then
2344 + docinto html
2345 + dodoc doc/src/sgml/html/*
2346 +
2347 + docinto sgml
2348 + dodoc doc/src/sgml/*.{sgml,dsl}
2349 + fi
2350 +
2351 + if use server; then
2352 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
2353 + "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
2354 +
2355 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
2356 + "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
2357 +
2358 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
2359 + "${FILESDIR}/${PN}.service" | \
2360 + systemd_newunit - ${PN}-${SLOT}.service
2361 +
2362 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
2363 +
2364 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
2365 +
2366 + if use prefix ; then
2367 + keepdir /run/postgresql
2368 + fperms 0775 /run/postgresql
2369 + fi
2370 + fi
2371 +}
2372 +
2373 +pkg_preinst() {
2374 + # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
2375 + # /usr/bin/psql96). They may have been created by the
2376 + # postgresql.eselect module, but they're handled within this ebuild
2377 + # now. It's alright if we momentarily delete /usr/bin/psql as it
2378 + # will be recreated by the eselect module in pkg_ppostinst(). This
2379 + # is only necessary for 9.7 and earlier. 10 and later were never
2380 + # handled in this manner.
2381 + local canonicalise
2382 + if type -p realpath > /dev/null; then
2383 + canonicalise=realpath
2384 + elif type -p readlink > /dev/null; then
2385 + canonicalise='readlink -f'
2386 + else
2387 + # can't die, subshell
2388 + die "No readlink nor realpath found, cannot canonicalise"
2389 + fi
2390 +
2391 + local l
2392 + # First remove any symlinks in /usr/bin that may have been created
2393 + # by the old eselect
2394 + for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
2395 + if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
2396 + rm "${l}" || ewarn "Couldn't remove ${l}"
2397 + fi
2398 + done
2399 +
2400 + # Then move the symlinks created by the ebuild to their proper place.
2401 + for l in "${ED}"/usr/bin/*tmp ; do
2402 + mv "${l}" "${l%tmp}" \
2403 + || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
2404 + done
2405 +}
2406 +
2407 +pkg_postinst() {
2408 + postgresql-config update
2409 +
2410 + if use alpha && use server ; then
2411 + ewarn "PostgreSQL 9.5+ no longer has native spinlock support on Alpha platforms."
2412 + ewarn "As a result, performance will be extremely degraded."
2413 + fi
2414 +
2415 + elog "If you need a global psqlrc-file, you can place it in:"
2416 + elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
2417 +
2418 + if use server ; then
2419 + elog
2420 + elog "Gentoo specific documentation:"
2421 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
2422 + elog
2423 + elog "Official documentation:"
2424 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
2425 + elog
2426 + elog "The default location of the Unix-domain socket is:"
2427 + elog " ${EROOT%/}/run/postgresql/"
2428 + elog
2429 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
2430 + elog "so that it contains your preferred locale in:"
2431 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2432 + elog
2433 + elog "Then, execute the following command to setup the initial database"
2434 + elog "environment:"
2435 + elog " emerge --config =${CATEGORY}/${PF}"
2436 + fi
2437 +}
2438 +
2439 +pkg_prerm() {
2440 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
2441 + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
2442 + ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
2443 +
2444 + ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
2445 + sleep 10
2446 + eend 0
2447 + fi
2448 +}
2449 +
2450 +pkg_postrm() {
2451 + postgresql-config update
2452 +}
2453 +
2454 +pkg_config() {
2455 + use server || die "USE flag 'server' not enabled. Nothing to configure."
2456 +
2457 + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
2458 + && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2459 + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
2460 + [[ -z "${DATA_DIR}" ]] \
2461 + && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
2462 +
2463 + # environment.bz2 may not contain the same locale as the current system
2464 + # locale. Unset and source from the current system locale.
2465 + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
2466 + unset LANG
2467 + unset LC_CTYPE
2468 + unset LC_NUMERIC
2469 + unset LC_TIME
2470 + unset LC_COLLATE
2471 + unset LC_MONETARY
2472 + unset LC_MESSAGES
2473 + unset LC_ALL
2474 + source "${EROOT%/}/etc/env.d/02locale"
2475 + [ -n "${LANG}" ] && export LANG
2476 + [ -n "${LC_CTYPE}" ] && export LC_CTYPE
2477 + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
2478 + [ -n "${LC_TIME}" ] && export LC_TIME
2479 + [ -n "${LC_COLLATE}" ] && export LC_COLLATE
2480 + [ -n "${LC_MONETARY}" ] && export LC_MONETARY
2481 + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
2482 + [ -n "${LC_ALL}" ] && export LC_ALL
2483 + fi
2484 +
2485 + einfo "You can modify the paths and options passed to initdb by editing:"
2486 + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2487 + einfo
2488 + einfo "Information on options that can be passed to initdb are found at:"
2489 + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
2490 + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
2491 + einfo
2492 + einfo "PG_INITDB_OPTS is currently set to:"
2493 + if [[ -z "${PG_INITDB_OPTS}" ]] ; then
2494 + einfo " (none)"
2495 + else
2496 + einfo " ${PG_INITDB_OPTS}"
2497 + fi
2498 + einfo
2499 + einfo "Configuration files will be installed to:"
2500 + einfo " ${PGDATA}"
2501 + einfo
2502 + einfo "The database cluster will be created in:"
2503 + einfo " ${DATA_DIR}"
2504 + einfo
2505 +
2506 + ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
2507 + sleep 5
2508 + eend 0
2509 +
2510 + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
2511 + eerror "The given directory, '${DATA_DIR}', is not empty."
2512 + eerror "Modify DATA_DIR to point to an empty directory."
2513 + die "${DATA_DIR} is not empty."
2514 + fi
2515 +
2516 + einfo "Creating the data directory ..."
2517 + if [[ ${EUID} == 0 ]] ; then
2518 + mkdir -p "${DATA_DIR}"
2519 + chown -Rf postgres:postgres "${DATA_DIR}"
2520 + chmod 0700 "${DATA_DIR}"
2521 + fi
2522 +
2523 + einfo "Initializing the database ..."
2524 +
2525 + if [[ ${EUID} == 0 ]] ; then
2526 + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
2527 + else
2528 + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
2529 + fi
2530 +
2531 + if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
2532 + mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
2533 + ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
2534 + fi
2535 +
2536 + # unix_socket_directory has no effect in postgresql.conf as it's
2537 + # overridden in the initscript
2538 + sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
2539 +
2540 + cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
2541 + # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
2542 + # On the off-chance that you might need to work with UTF-8 encoded
2543 + # characters in PL/Perl
2544 + plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
2545 + EOF
2546 +
2547 + einfo "The autovacuum function, which was in contrib, has been moved to the main"
2548 + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
2549 + einfo "by default. You can disable it in the cluster's:"
2550 + einfo " ${PGDATA%/}/postgresql.conf"
2551 + einfo
2552 + einfo "The PostgreSQL server, by default, will log events to:"
2553 + einfo " ${DATA_DIR%/}/postmaster.log"
2554 + einfo
2555 + if use prefix ; then
2556 + einfo "The location of the configuration files have moved to:"
2557 + einfo " ${PGDATA}"
2558 + einfo "To start the server:"
2559 + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
2560 + einfo "To stop:"
2561 + einfo " pg_ctl stop -D ${DATA_DIR}"
2562 + einfo
2563 + einfo "Or move the configuration files back:"
2564 + einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
2565 + else
2566 + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
2567 + einfo "instead of 'pg_ctl'."
2568 + fi
2569 +}
2570 +
2571 +src_test() {
2572 + if use server && [[ ${UID} -ne 0 ]] ; then
2573 + emake check
2574 +
2575 + einfo "If you think other tests besides the regression tests are necessary, please"
2576 + einfo "submit a bug including a patch for this ebuild to enable them."
2577 + else
2578 + use server || \
2579 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
2580 + [[ ${UID} -eq 0 ]] || \
2581 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
2582 +
2583 + ewarn 'Skipping.'
2584 + fi
2585 +}
2586
2587 diff --git a/dev-db/postgresql/postgresql-9.6.4.ebuild b/dev-db/postgresql/postgresql-9.6.4.ebuild
2588 new file mode 100644
2589 index 00000000000..66369e14a21
2590 --- /dev/null
2591 +++ b/dev-db/postgresql/postgresql-9.6.4.ebuild
2592 @@ -0,0 +1,495 @@
2593 +# Copyright 1999-2017 Gentoo Foundation
2594 +# Distributed under the terms of the GNU General Public License v2
2595 +
2596 +EAPI="6"
2597 +
2598 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
2599 +
2600 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
2601 + systemd user versionator
2602 +
2603 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
2604 +
2605 +SLOT="$(get_version_component_range 1-2)"
2606 +
2607 +MY_PV=${PV/_/}
2608 +S="${WORKDIR}/${PN}-${MY_PV}"
2609 +
2610 +SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
2611 +
2612 +LICENSE="POSTGRESQL GPL-2"
2613 +DESCRIPTION="PostgreSQL RDBMS"
2614 +HOMEPAGE="http://www.postgresql.org/"
2615 +
2616 +LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
2617 + zh_CN zh_TW"
2618 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
2619 + +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
2620 +
2621 +for lingua in ${LINGUAS}; do
2622 + IUSE+=" linguas_${lingua}"
2623 +done
2624 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
2625 +
2626 +wanted_languages() {
2627 + local enable_langs
2628 +
2629 + for lingua in ${LINGUAS} ; do
2630 + use linguas_${lingua} && enable_langs+="${lingua} "
2631 + done
2632 +
2633 + echo -n ${enable_langs}
2634 +}
2635 +
2636 +CDEPEND="
2637 +>=app-eselect/eselect-postgresql-2.0
2638 +sys-apps/less
2639 +virtual/libintl
2640 +kerberos? ( virtual/krb5 )
2641 +ldap? ( net-nds/openldap )
2642 +pam? ( virtual/pam )
2643 +perl? ( >=dev-lang/perl-5.8:= )
2644 +python? ( ${PYTHON_DEPS} )
2645 +readline? ( sys-libs/readline:0= )
2646 +ssl? (
2647 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
2648 + libressl? ( dev-libs/libressl:= )
2649 +)
2650 +server? ( systemd? ( sys-apps/systemd ) )
2651 +tcl? ( >=dev-lang/tcl-8:0= )
2652 +xml? ( dev-libs/libxml2 dev-libs/libxslt )
2653 +zlib? ( sys-libs/zlib )
2654 +"
2655 +
2656 +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
2657 +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
2658 +# the libc includes UUID functions.
2659 +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
2660 +BSD_LIBC=( elibc_{Free,Net,Open}BSD )
2661 +
2662 +nest_usedep() {
2663 + local front back
2664 + while [[ ${#} -gt 1 ]]; do
2665 + front+="${1}? ( "
2666 + back+=" )"
2667 + shift
2668 + done
2669 + echo "${front}${1}${back}"
2670 +}
2671 +
2672 +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
2673 +CDEPEND+="
2674 +uuid? (
2675 + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
2676 + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
2677 +)"
2678 +
2679 +DEPEND="${CDEPEND}
2680 +!!<sys-apps/sandbox-2.0
2681 +sys-devel/bison
2682 +sys-devel/flex
2683 +nls? ( sys-devel/gettext )
2684 +xml? ( virtual/pkgconfig )
2685 +"
2686 +
2687 +RDEPEND="${CDEPEND}
2688 +!dev-db/postgresql-docs:${SLOT}
2689 +!dev-db/postgresql-base:${SLOT}
2690 +!dev-db/postgresql-server:${SLOT}
2691 +selinux? ( sec-policy/selinux-postgresql )
2692 +"
2693 +
2694 +pkg_setup() {
2695 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
2696 +
2697 + enewgroup postgres 70
2698 + enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
2699 +
2700 + use python && python-single-r1_pkg_setup
2701 +}
2702 +
2703 +src_prepare() {
2704 + # Work around PPC{,64} compilation bug where bool is already defined
2705 + sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
2706 +
2707 + # Set proper run directory
2708 + sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
2709 + -i src/include/pg_config_manual.h || die
2710 +
2711 + # Rely on $PATH being in the proper order so that the correct
2712 + # install program is used for modules utilizing PGXS in both
2713 + # hardened and non-hardened environments. (Bug #528786)
2714 + sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
2715 +
2716 + use server || eapply "${FILESDIR}/${PN}-${SLOT}.3-no-server.patch"
2717 +
2718 + if use pam ; then
2719 + sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
2720 + -i src/backend/libpq/auth.c || \
2721 + die 'PGSQL_PAM_SERVICE rename failed.'
2722 + fi
2723 +
2724 + eapply_user
2725 +}
2726 +
2727 +src_configure() {
2728 + case ${CHOST} in
2729 + *-darwin*|*-solaris*)
2730 + use nls && append-libs intl
2731 + ;;
2732 + esac
2733 +
2734 + export LDFLAGS_SL="${LDFLAGS}"
2735 + export LDFLAGS_EX="${LDFLAGS}"
2736 +
2737 + local PO="${EPREFIX%/}"
2738 +
2739 + local i uuid_config=""
2740 + if use uuid; then
2741 + for i in ${UTIL_LINUX_LIBC[@]}; do
2742 + use ${i} && uuid_config="--with-uuid=e2fs"
2743 + done
2744 + for i in ${BSD_LIBC[@]}; do
2745 + use ${i} && uuid_config="--with-uuid=bsd"
2746 + done
2747 + [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
2748 + fi
2749 +
2750 + econf \
2751 + --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
2752 + --datadir="${PO}/usr/share/postgresql-${SLOT}" \
2753 + --docdir="${PO}/usr/share/doc/${PF}" \
2754 + --includedir="${PO}/usr/include/postgresql-${SLOT}" \
2755 + --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
2756 + --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
2757 + --with-system-tzdata="${PO}/usr/share/zoneinfo" \
2758 + $(use_enable !alpha spinlocks) \
2759 + $(use_enable !pg_legacytimestamp integer-datetimes) \
2760 + $(use_enable threads thread-safety) \
2761 + $(use_with kerberos gssapi) \
2762 + $(use_with ldap) \
2763 + $(use_with pam) \
2764 + $(use_with perl) \
2765 + $(use_with python) \
2766 + $(use_with readline) \
2767 + $(use_with ssl openssl) \
2768 + $(usex server "$(use_with systemd)" '--without-systemd') \
2769 + $(use_with tcl) \
2770 + ${uuid_config} \
2771 + $(use_with xml libxml) \
2772 + $(use_with xml libxslt) \
2773 + $(use_with zlib) \
2774 + "$(use_enable nls nls "$(wanted_languages)")"
2775 +}
2776 +
2777 +src_compile() {
2778 + emake
2779 + emake -C contrib
2780 +}
2781 +
2782 +src_install() {
2783 + emake DESTDIR="${D}" install
2784 + emake DESTDIR="${D}" install -C contrib
2785 +
2786 + dodoc README HISTORY doc/{TODO,bug.template}
2787 +
2788 + # man pages are already built, but if we have the target make them,
2789 + # they'll be generated from source before being installed so we
2790 + # manually install man pages.
2791 + # We use ${SLOT} instead of doman for postgresql.eselect
2792 + insinto /usr/share/postgresql-${SLOT}/man/
2793 + doins -r doc/src/sgml/man{1,3,7}
2794 + if ! use server; then
2795 + # Remove man pages for non-existent binaries
2796 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
2797 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
2798 + done
2799 + fi
2800 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
2801 +
2802 + # Create slot specific man pages
2803 + local bn f mansec slotted_name
2804 + for mansec in 1 3 7 ; do
2805 + local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
2806 +
2807 + mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
2808 + pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
2809 +
2810 + for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
2811 + bn=$(basename "${f}")
2812 + slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
2813 + case ${bn} in
2814 + TABLE.7|WITH.7)
2815 + echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
2816 + ;;
2817 + *)
2818 + echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
2819 + ;;
2820 + esac
2821 + done
2822 +
2823 + popd > /dev/null
2824 + done
2825 +
2826 + insinto /etc/postgresql-${SLOT}
2827 + newins src/bin/psql/psqlrc.sample psqlrc
2828 +
2829 + use static-libs || find "${ED}" -name '*.a' -delete
2830 +
2831 + local f bn
2832 + for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
2833 + -mindepth 1 -maxdepth 1)
2834 + do
2835 + bn=$(basename "${f}")
2836 + # Temporarily tack on tmp to workaround a file collision
2837 + # issue. This is only necessary for 9.7 and earlier. 10 never
2838 + # had this issue.
2839 + dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
2840 + "/usr/bin/${bn}${SLOT/.}tmp"
2841 + done
2842 +
2843 + if use doc ; then
2844 + docinto html
2845 + dodoc doc/src/sgml/html/*
2846 +
2847 + docinto sgml
2848 + dodoc doc/src/sgml/*.{sgml,dsl}
2849 + fi
2850 +
2851 + if use server; then
2852 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
2853 + "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
2854 +
2855 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
2856 + "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
2857 +
2858 + if use systemd; then
2859 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
2860 + "${FILESDIR}/${PN}.service-9.6" | \
2861 + systemd_newunit - ${PN}-${SLOT}.service
2862 + fi
2863 +
2864 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
2865 +
2866 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
2867 +
2868 + if use prefix ; then
2869 + keepdir /run/postgresql
2870 + fperms 0775 /run/postgresql
2871 + fi
2872 + fi
2873 +}
2874 +
2875 +pkg_preinst() {
2876 + # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
2877 + # /usr/bin/psql96). They may have been created by the
2878 + # postgresql.eselect module, but they're handled within this ebuild
2879 + # now. It's alright if we momentarily delete /usr/bin/psql as it
2880 + # will be recreated by the eselect module in pkg_ppostinst(). This
2881 + # is only necessary for 9.7 and earlier. 10 and later were never
2882 + # handled in this manner.
2883 + local canonicalise
2884 + if type -p realpath > /dev/null; then
2885 + canonicalise=realpath
2886 + elif type -p readlink > /dev/null; then
2887 + canonicalise='readlink -f'
2888 + else
2889 + # can't die, subshell
2890 + die "No readlink nor realpath found, cannot canonicalise"
2891 + fi
2892 +
2893 + local l
2894 + # First remove any symlinks in /usr/bin that may have been created
2895 + # by the old eselect
2896 + for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
2897 + if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
2898 + rm "${l}" || ewarn "Couldn't remove ${l}"
2899 + fi
2900 + done
2901 +
2902 + # Then move the symlinks created by the ebuild to their proper place.
2903 + for l in "${ED}"/usr/bin/*tmp ; do
2904 + mv "${l}" "${l%tmp}" \
2905 + || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
2906 + done
2907 +}
2908 +
2909 +pkg_postinst() {
2910 + postgresql-config update
2911 +
2912 + elog "If you need a global psqlrc-file, you can place it in:"
2913 + elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
2914 +
2915 + if use server ; then
2916 + elog
2917 + elog "Gentoo specific documentation:"
2918 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
2919 + elog
2920 + elog "Official documentation:"
2921 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
2922 + elog
2923 + elog "The default location of the Unix-domain socket is:"
2924 + elog " ${EROOT%/}/run/postgresql/"
2925 + elog
2926 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
2927 + elog "so that it contains your preferred locale in:"
2928 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2929 + elog
2930 + elog "Then, execute the following command to setup the initial database"
2931 + elog "environment:"
2932 + elog " emerge --config =${CATEGORY}/${PF}"
2933 + fi
2934 +}
2935 +
2936 +pkg_prerm() {
2937 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
2938 + ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
2939 + ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
2940 +
2941 + ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
2942 + sleep 10
2943 + eend 0
2944 + fi
2945 +}
2946 +
2947 +pkg_postrm() {
2948 + postgresql-config update
2949 +}
2950 +
2951 +pkg_config() {
2952 + use server || die "USE flag 'server' not enabled. Nothing to configure."
2953 +
2954 + [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
2955 + && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2956 + [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
2957 + [[ -z "${DATA_DIR}" ]] \
2958 + && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
2959 +
2960 + # environment.bz2 may not contain the same locale as the current system
2961 + # locale. Unset and source from the current system locale.
2962 + if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
2963 + unset LANG
2964 + unset LC_CTYPE
2965 + unset LC_NUMERIC
2966 + unset LC_TIME
2967 + unset LC_COLLATE
2968 + unset LC_MONETARY
2969 + unset LC_MESSAGES
2970 + unset LC_ALL
2971 + source "${EROOT%/}/etc/env.d/02locale"
2972 + [ -n "${LANG}" ] && export LANG
2973 + [ -n "${LC_CTYPE}" ] && export LC_CTYPE
2974 + [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
2975 + [ -n "${LC_TIME}" ] && export LC_TIME
2976 + [ -n "${LC_COLLATE}" ] && export LC_COLLATE
2977 + [ -n "${LC_MONETARY}" ] && export LC_MONETARY
2978 + [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
2979 + [ -n "${LC_ALL}" ] && export LC_ALL
2980 + fi
2981 +
2982 + einfo "You can modify the paths and options passed to initdb by editing:"
2983 + einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2984 + einfo
2985 + einfo "Information on options that can be passed to initdb are found at:"
2986 + einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
2987 + einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
2988 + einfo
2989 + einfo "PG_INITDB_OPTS is currently set to:"
2990 + if [[ -z "${PG_INITDB_OPTS}" ]] ; then
2991 + einfo " (none)"
2992 + else
2993 + einfo " ${PG_INITDB_OPTS}"
2994 + fi
2995 + einfo
2996 + einfo "Configuration files will be installed to:"
2997 + einfo " ${PGDATA}"
2998 + einfo
2999 + einfo "The database cluster will be created in:"
3000 + einfo " ${DATA_DIR}"
3001 + einfo
3002 +
3003 + ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
3004 + sleep 5
3005 + eend 0
3006 +
3007 + if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
3008 + eerror "The given directory, '${DATA_DIR}', is not empty."
3009 + eerror "Modify DATA_DIR to point to an empty directory."
3010 + die "${DATA_DIR} is not empty."
3011 + fi
3012 +
3013 + einfo "Creating the data directory ..."
3014 + if [[ ${EUID} == 0 ]] ; then
3015 + mkdir -p "${DATA_DIR}"
3016 + chown -Rf postgres:postgres "${DATA_DIR}"
3017 + chmod 0700 "${DATA_DIR}"
3018 + fi
3019 +
3020 + einfo "Initializing the database ..."
3021 +
3022 + if [[ ${EUID} == 0 ]] ; then
3023 + su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
3024 + else
3025 + "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
3026 + fi
3027 +
3028 + if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
3029 + mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
3030 + ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
3031 + fi
3032 +
3033 + # unix_socket_directory has no effect in postgresql.conf as it's
3034 + # overridden in the initscript
3035 + sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
3036 +
3037 + cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
3038 + # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
3039 + # On the off-chance that you might need to work with UTF-8 encoded
3040 + # characters in PL/Perl
3041 + plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
3042 + EOF
3043 +
3044 + einfo "The autovacuum function, which was in contrib, has been moved to the main"
3045 + einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
3046 + einfo "by default. You can disable it in the cluster's:"
3047 + einfo " ${PGDATA%/}/postgresql.conf"
3048 + einfo
3049 + if ! use systemd; then
3050 + einfo "The PostgreSQL server, by default, will log events to:"
3051 + einfo " ${DATA_DIR%/}/postmaster.log"
3052 + einfo
3053 + fi
3054 + if use prefix ; then
3055 + einfo "The location of the configuration files have moved to:"
3056 + einfo " ${PGDATA}"
3057 + einfo "To start the server:"
3058 + einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
3059 + einfo "To stop:"
3060 + einfo " pg_ctl stop -D ${DATA_DIR}"
3061 + einfo
3062 + einfo "Or move the configuration files back:"
3063 + einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
3064 + elif use systemd; then
3065 + einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL"
3066 + einfo "instead of 'pg_ctl'."
3067 + else
3068 + einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
3069 + einfo "instead of 'pg_ctl'."
3070 + fi
3071 +}
3072 +
3073 +src_test() {
3074 + if use server && [[ ${UID} -ne 0 ]] ; then
3075 + emake check
3076 +
3077 + einfo "If you think other tests besides the regression tests are necessary, please"
3078 + einfo "submit a bug including a patch for this ebuild to enable them."
3079 + else
3080 + use server || \
3081 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
3082 + [[ ${UID} -eq 0 ]] || \
3083 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
3084 +
3085 + ewarn 'Skipping.'
3086 + fi
3087 +}