1 |
commit: 7cb835b1e4e2e4bd5e279c16ece133a0225dedc6 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat May 14 21:27:09 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 14 21:27:09 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7cb835b1 |
7 |
|
8 |
dev-db/mongodb: fix build with Boost 1.79; fix automagic SSL usage |
9 |
|
10 |
Bug: https://bugs.gentoo.org/843290 |
11 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
12 |
|
13 |
.../mongodb/files/mongodb-5.0.2-boost-1.79.patch | 71 ++++++++ |
14 |
dev-db/mongodb/mongodb-5.0.5-r2.ebuild | 188 +++++++++++++++++++++ |
15 |
2 files changed, 259 insertions(+) |
16 |
|
17 |
diff --git a/dev-db/mongodb/files/mongodb-5.0.2-boost-1.79.patch b/dev-db/mongodb/files/mongodb-5.0.2-boost-1.79.patch |
18 |
new file mode 100644 |
19 |
index 000000000000..39c76bacf426 |
20 |
--- /dev/null |
21 |
+++ b/dev-db/mongodb/files/mongodb-5.0.2-boost-1.79.patch |
22 |
@@ -0,0 +1,71 @@ |
23 |
+https://bugs.gentoo.org/844235 |
24 |
+--- a/src/mongo/db/auth/security_key_test.cpp |
25 |
++++ b/src/mongo/db/auth/security_key_test.cpp |
26 |
+@@ -30,6 +30,7 @@ |
27 |
+ #include "mongo/platform/basic.h" |
28 |
+ |
29 |
+ #include <boost/filesystem.hpp> |
30 |
++#include <boost/filesystem/fstream.hpp> |
31 |
+ |
32 |
+ #include "mongo/base/string_data.h" |
33 |
+ #include "mongo/db/auth/authorization_manager.h" |
34 |
+--- a/src/mongo/db/storage/storage_repair_observer.cpp |
35 |
++++ b/src/mongo/db/storage/storage_repair_observer.cpp |
36 |
+@@ -41,6 +41,7 @@ |
37 |
+ #include <sys/types.h> |
38 |
+ #endif |
39 |
+ |
40 |
++#include <boost/filesystem/fstream.hpp> |
41 |
+ #include <boost/filesystem/path.hpp> |
42 |
+ |
43 |
+ #include "mongo/db/dbhelpers.h" |
44 |
+--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp |
45 |
++++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp |
46 |
+@@ -34,6 +34,7 @@ |
47 |
+ #include "mongo/db/storage/kv/kv_engine_test_harness.h" |
48 |
+ |
49 |
+ #include <boost/filesystem.hpp> |
50 |
++#include <boost/filesystem/fstream.hpp> |
51 |
+ #include <boost/filesystem/path.hpp> |
52 |
+ #include <memory> |
53 |
+ |
54 |
+--- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp |
55 |
++++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp |
56 |
+@@ -36,6 +36,7 @@ |
57 |
+ #include <limits> |
58 |
+ |
59 |
+ #include <boost/filesystem.hpp> |
60 |
++#include <boost/filesystem/fstream.hpp> |
61 |
+ #include <boost/filesystem/path.hpp> |
62 |
+ |
63 |
+ #include "mongo/base/simple_string_data_comparator.h" |
64 |
+--- a/src/mongo/shell/shell_utils_extended.cpp |
65 |
++++ b/src/mongo/shell/shell_utils_extended.cpp |
66 |
+@@ -37,6 +37,7 @@ |
67 |
+ #endif |
68 |
+ |
69 |
+ #include <boost/filesystem.hpp> |
70 |
++#include <boost/filesystem/fstream.hpp> |
71 |
+ #include <fmt/format.h> |
72 |
+ #include <fstream> |
73 |
+ |
74 |
+--- a/src/mongo/util/stacktrace_threads.cpp |
75 |
++++ b/src/mongo/util/stacktrace_threads.cpp |
76 |
+@@ -36,6 +36,7 @@ |
77 |
+ #include <array> |
78 |
+ #include <atomic> |
79 |
+ #include <boost/filesystem.hpp> |
80 |
++#include <boost/filesystem/fstream.hpp> |
81 |
+ #include <cstdint> |
82 |
+ #include <cstdlib> |
83 |
+ #include <dirent.h> |
84 |
+--- a/src/mongo/util/processinfo_linux.cpp |
85 |
++++ b/src/mongo/util/processinfo_linux.cpp |
86 |
+@@ -36,6 +36,7 @@ |
87 |
+ #include <iostream> |
88 |
+ #include <malloc.h> |
89 |
+ #include <pcrecpp.h> |
90 |
++#include <fstream> |
91 |
+ #include <sched.h> |
92 |
+ #include <stdio.h> |
93 |
+ #include <sys/mman.h> |
94 |
|
95 |
diff --git a/dev-db/mongodb/mongodb-5.0.5-r2.ebuild b/dev-db/mongodb/mongodb-5.0.5-r2.ebuild |
96 |
new file mode 100644 |
97 |
index 000000000000..9e993f26b1d4 |
98 |
--- /dev/null |
99 |
+++ b/dev-db/mongodb/mongodb-5.0.5-r2.ebuild |
100 |
@@ -0,0 +1,188 @@ |
101 |
+# Copyright 1999-2022 Gentoo Authors |
102 |
+# Distributed under the terms of the GNU General Public License v2 |
103 |
+ |
104 |
+EAPI=7 |
105 |
+ |
106 |
+PYTHON_COMPAT=( python3_{8..10} ) |
107 |
+ |
108 |
+SCONS_MIN_VERSION="3.3.1" |
109 |
+CHECKREQS_DISK_BUILD="2400M" |
110 |
+CHECKREQS_DISK_USR="512M" |
111 |
+CHECKREQS_MEMORY="1024M" |
112 |
+ |
113 |
+inherit check-reqs flag-o-matic multiprocessing pax-utils python-any-r1 scons-utils systemd toolchain-funcs |
114 |
+ |
115 |
+MY_P=${PN}-src-r${PV/_rc/-rc} |
116 |
+ |
117 |
+DESCRIPTION="A high-performance, open source, schema-free document-oriented database" |
118 |
+HOMEPAGE="https://www.mongodb.com" |
119 |
+SRC_URI="https://fastdl.mongodb.org/src/${MY_P}.tar.gz" |
120 |
+ |
121 |
+LICENSE="Apache-2.0 SSPL-1" |
122 |
+SLOT="0" |
123 |
+KEYWORDS="~amd64 ~arm64 -riscv" |
124 |
+CPU_FLAGS="cpu_flags_x86_avx" |
125 |
+IUSE="debug kerberos lto mongosh ssl +tools ${CPU_FLAGS}" |
126 |
+ |
127 |
+# https://github.com/mongodb/mongo/wiki/Test-The-Mongodb-Server |
128 |
+# resmoke needs python packages not yet present in Gentoo |
129 |
+RESTRICT="test" |
130 |
+ |
131 |
+RDEPEND="acct-group/mongodb |
132 |
+ acct-user/mongodb |
133 |
+ >=app-arch/snappy-1.1.3:= |
134 |
+ >=dev-cpp/yaml-cpp-0.6.2:= |
135 |
+ >=dev-libs/boost-1.70:=[threads(+),nls] |
136 |
+ >=dev-libs/libpcre-8.42[cxx] |
137 |
+ app-arch/zstd:= |
138 |
+ dev-libs/snowball-stemmer:= |
139 |
+ net-libs/libpcap |
140 |
+ >=sys-libs/zlib-1.2.11:= |
141 |
+ kerberos? ( dev-libs/cyrus-sasl[kerberos] ) |
142 |
+ ssl? ( |
143 |
+ >=dev-libs/openssl-1.0.1g:0= |
144 |
+ )" |
145 |
+DEPEND="${RDEPEND} |
146 |
+ ${PYTHON_DEPS} |
147 |
+ $(python_gen_any_dep ' |
148 |
+ >=dev-util/scons-3.1.1[${PYTHON_USEDEP}] |
149 |
+ dev-python/cheetah3[${PYTHON_USEDEP}] |
150 |
+ dev-python/psutil[${PYTHON_USEDEP}] |
151 |
+ dev-python/pyyaml[${PYTHON_USEDEP}] |
152 |
+ ') |
153 |
+ sys-libs/ncurses:0= |
154 |
+ sys-libs/readline:0= |
155 |
+ debug? ( dev-util/valgrind )" |
156 |
+PDEPEND=" |
157 |
+ mongosh? ( app-admin/mongosh-bin ) |
158 |
+ tools? ( >=app-admin/mongo-tools-100 ) |
159 |
+" |
160 |
+ |
161 |
+PATCHES=( |
162 |
+ "${FILESDIR}/${PN}-4.4.1-boost.patch" |
163 |
+ "${FILESDIR}/${PN}-4.4.1-gcc11.patch" |
164 |
+ "${FILESDIR}/${PN}-5.0.2-fix-scons.patch" |
165 |
+ "${FILESDIR}/${PN}-5.0.2-no-compass.patch" |
166 |
+ "${FILESDIR}/${PN}-5.0.2-skip-no-exceptions.patch" |
167 |
+ "${FILESDIR}/${PN}-5.0.2-skip-reqs-check.patch" |
168 |
+ "${FILESDIR}/${PN}-5.0.2-boost-1.79.patch" |
169 |
+) |
170 |
+ |
171 |
+S="${WORKDIR}/${MY_P}" |
172 |
+ |
173 |
+python_check_deps() { |
174 |
+ has_version ">=dev-util/scons-2.5.0[${PYTHON_USEDEP}]" && |
175 |
+ has_version "dev-python/cheetah3[${PYTHON_USEDEP}]" && |
176 |
+ has_version "dev-python/psutil[${PYTHON_USEDEP}]" && |
177 |
+ has_version "dev-python/pyyaml[${PYTHON_USEDEP}]" |
178 |
+} |
179 |
+ |
180 |
+pkg_pretend() { |
181 |
+ # Bug 809692 |
182 |
+ if use amd64 && ! use cpu_flags_x86_avx; then |
183 |
+ eerror "MongoDB 5.0 requires use of the AVX instruction set" |
184 |
+ eerror "https://docs.mongodb.com/v5.0/administration/production-notes/" |
185 |
+ die "MongoDB requires AVX" |
186 |
+ fi |
187 |
+ |
188 |
+ if [[ -n ${REPLACING_VERSIONS} ]]; then |
189 |
+ if ver_test "$REPLACING_VERSIONS" -lt 4.4; then |
190 |
+ ewarn "To upgrade from a version earlier than the 4.4-series, you must" |
191 |
+ ewarn "successively upgrade major releases until you have upgraded" |
192 |
+ ewarn "to 4.4-series. Then upgrade to 5.0 series." |
193 |
+ else |
194 |
+ ewarn "Be sure to set featureCompatibilityVersion to 4.4 before upgrading." |
195 |
+ fi |
196 |
+ fi |
197 |
+} |
198 |
+ |
199 |
+src_prepare() { |
200 |
+ default |
201 |
+ |
202 |
+ # remove bundled libs |
203 |
+ rm -r src/third_party/{boost,pcre-*,snappy-*,yaml-cpp,zlib-*} || die |
204 |
+ |
205 |
+ # remove compass |
206 |
+ rm -r src/mongo/installer/compass || die |
207 |
+} |
208 |
+ |
209 |
+src_configure() { |
210 |
+ # https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source |
211 |
+ # --use-system-icu fails tests |
212 |
+ # --use-system-tcmalloc is strongly NOT recommended: |
213 |
+ scons_opts=( |
214 |
+ AR="$(tc-getAR)" |
215 |
+ CC="$(tc-getCC)" |
216 |
+ CXX="$(tc-getCXX)" |
217 |
+ |
218 |
+ --disable-warnings-as-errors |
219 |
+ --jobs="$(makeopts_jobs)" |
220 |
+ --use-system-boost |
221 |
+ --use-system-pcre |
222 |
+ --use-system-snappy |
223 |
+ --use-system-stemmer |
224 |
+ --use-system-yaml |
225 |
+ --use-system-zlib |
226 |
+ --use-system-zstd |
227 |
+ ) |
228 |
+ |
229 |
+ use arm64 && scons_opts+=( --use-hardware-crc32=off ) # Bug 701300 |
230 |
+ use debug && scons_opts+=( --dbg=on ) |
231 |
+ use kerberos && scons_opts+=( --use-sasl-client ) |
232 |
+ use lto && scons_opts+=( --lto=on ) |
233 |
+ |
234 |
+ scons_opts+=( --ssl=$(usex ssl on off) ) |
235 |
+ |
236 |
+ # Needed to avoid forcing FORTIFY_SOURCE |
237 |
+ # Gentoo's toolchain applies these anyway |
238 |
+ scons_opts+=( --runtime-hardening=off ) |
239 |
+ |
240 |
+ # respect mongoDB upstream's basic recommendations |
241 |
+ # see bug #536688 and #526114 |
242 |
+ if ! use debug; then |
243 |
+ filter-flags '-m*' |
244 |
+ filter-flags '-O?' |
245 |
+ fi |
246 |
+ |
247 |
+ default |
248 |
+} |
249 |
+ |
250 |
+src_compile() { |
251 |
+ PREFIX="${EPREFIX}/usr" ./buildscripts/scons.py "${scons_opts[@]}" install-core || die |
252 |
+} |
253 |
+ |
254 |
+src_install() { |
255 |
+ dobin build/install/bin/{mongo,mongod,mongos} |
256 |
+ |
257 |
+ doman debian/mongo*.1 |
258 |
+ dodoc README docs/building.md |
259 |
+ |
260 |
+ newinitd "${FILESDIR}/${PN}.initd-r3" ${PN} |
261 |
+ newconfd "${FILESDIR}/${PN}.confd-r3" ${PN} |
262 |
+ newinitd "${FILESDIR}/mongos.initd-r3" mongos |
263 |
+ newconfd "${FILESDIR}/mongos.confd-r3" mongos |
264 |
+ |
265 |
+ insinto /etc |
266 |
+ newins "${FILESDIR}/${PN}.conf-r3" ${PN}.conf |
267 |
+ newins "${FILESDIR}/mongos.conf-r2" mongos.conf |
268 |
+ |
269 |
+ systemd_newunit "${FILESDIR}/${PN}.service-r1" "${PN}.service" |
270 |
+ |
271 |
+ insinto /etc/logrotate.d/ |
272 |
+ newins "${FILESDIR}/${PN}.logrotate" ${PN} |
273 |
+ |
274 |
+ # see bug #526114 |
275 |
+ pax-mark emr "${ED}"/usr/bin/{mongo,mongod,mongos} |
276 |
+ |
277 |
+ local x |
278 |
+ for x in /var/{lib,log}/${PN}; do |
279 |
+ diropts -m0750 -o mongodb -g mongodb |
280 |
+ keepdir "${x}" |
281 |
+ done |
282 |
+} |
283 |
+ |
284 |
+pkg_postinst() { |
285 |
+ ewarn "Make sure to read the release notes and follow the upgrade process:" |
286 |
+ ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/" |
287 |
+ ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/#upgrade-procedures" |
288 |
+} |