Subject: [alpine-aports] [PATCH] community/mongodb: upgrade to 3.6.1

From: Marc Vertes <[email-masked]>
Date: Tue, 2 Jan 2018 11:20:46 +0000

---
 community/mongodb/APKBUILD                         | 55 ++++++----------------
 community/mongodb/backtrace.patch                  | 14 ------
 community/mongodb/boost160.patch                   | 11 -----
 community/mongodb/boost162.patch                   | 15 ------
 community/mongodb/fix-asio-strerror_r.patch        | 28 -----------
 ...stacksize.patch => fix-default-stacksize.patch} |  0
 ...tive-class.patch => fix-elf-native-class.patch} |  0
 community/mongodb/fix-libressl.patch               | 22 ---------
 community/mongodb/fix-resolv.patch                 | 17 +++++++
 community/mongodb/fix-std-string.patch             | 41 ----------------
 .../{fix-log.patch => fix-strerror_r.patch}        |  6 +--
 community/mongodb/wiredtiger-strtouq.patch         | 11 -----
 12 files changed, 35 insertions(+), 185 deletions(-)
 delete mode 100644 community/mongodb/backtrace.patch
 delete mode 100644 community/mongodb/boost160.patch
 delete mode 100644 community/mongodb/boost162.patch
 delete mode 100644 community/mongodb/fix-asio-strerror_r.patch
 rename community/mongodb/{set-default-stacksize.patch => fix-default-stacksize.patch} (100%)
 rename community/mongodb/{40-fix-elf-native-class.patch => fix-elf-native-class.patch} (100%)
 delete mode 100644 community/mongodb/fix-libressl.patch
 create mode 100644 community/mongodb/fix-resolv.patch
 delete mode 100644 community/mongodb/fix-std-string.patch
 rename community/mongodb/{fix-log.patch => fix-strerror_r.patch} (70%)
 delete mode 100644 community/mongodb/wiredtiger-strtouq.patch

diff --git a/community/mongodb/APKBUILD b/community/mongodb/APKBUILD
index 630d2ca01d..32144c1d15 100644
--- a/community/mongodb/APKBUILD
+++ b/community/mongodb/APKBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Filipp Andronov <[email-masked]>
-# Contributor: Marc Vertes <[email-masked]>
+# Contributor: Marc Vertes <[email-masked]>
 pkgname=mongodb
-pkgver=3.4.10
+pkgver=3.6.1
 pkgrel=0
 pkgdesc='A high-performance, open source, schema-free document-oriented database'
 url='http://www.mongodb.org'
@@ -10,21 +10,16 @@ license='AGPL3'
 pkgusers="mongodb"
 pkggroups="mongodb"
 depends=
-makedepends="scons paxmark libressl-dev pcre-dev snappy-dev boost-dev asio-dev
-	libpcap-dev wiredtiger-dev zlib-dev cyrus-sasl-dev yaml-cpp-dev"
+makedepends="scons py-setuptools py-cheetah py2-typing py-yaml paxmark
+	libressl-dev pcre-dev snappy-dev boost-dev asio-dev libpcap-dev
+	wiredtiger-dev zlib-dev cyrus-sasl-dev yaml-cpp-dev"
 install="$pkgname.pre-install"
 source="http://downloads.mongodb.org/src/mongodb-src-r${pkgver}.tar.gz
-	40-fix-elf-native-class.patch
-	backtrace.patch
-	fix-asio-strerror_r.patch
-	fix-libressl.patch
-	fix-log.patch
+	fix-default-stacksize.patch
+	fix-elf-native-class.patch
 	fix-processinfo_linux.patch
-	fix-std-string.patch
-	set-default-stacksize.patch
-	wiredtiger-strtouq.patch
-	boost160.patch
-	boost162.patch
+	fix-resolv.patch
+	fix-strerror_r.patch
 
         mongodb.confd
         mongodb.initd
@@ -32,21 +27,7 @@ source="http://downloads.mongodb.org/src/mongodb-src-r${pkgver}.tar.gz
         mongos.confd
         mongos.initd
 	"
-#
-# 1. Force 64bits because of 40-fix-elf-native-class.patch
-# 2. Use system allocator as tc-malloc doesn't build
-# 2. Use as much system libs as possible, boost doesn't compile foe example
-#
-# TODO: proper elf-netive-class fix
-# TODO: check if there are more libs could be replaced by system counterparts (see libpcap does't use, for example)
-# TODO: proper fix for heap usage
-# Right now code patched to always return 0 for heap usage statistics. That is necessary because musl malloc info
-# isn't compatible with glibc and breaks build. It is _possible_ to patch code to return 0
-# because on 64bit platform statistics is broken and returns wrong numbers, see SERVER-9168 mongo bug.
-#
-# There is a way to return propper value when tc-malloc used, but it doesn't compile for libmusl. Work is in progress,
-# contribution strongly welcome :D
-#
+
 _builddir="$srcdir"/$pkgname-src-r$pkgver
 _buildopts="
 		--allocator=system \
@@ -102,18 +83,12 @@ package() {
 	install -Dm644 "$srcdir/mongos.confd" "$pkgdir/etc/conf.d/mongos"
 }
 
-sha512sums="6293dde40a8433477ba3b1cf77abbdb32b28ce58279cc616b488647c8ab71b5ab3eab2146058c4a74b9e00f0938f1415020e2f26ea01f2b29dd78a1a38d58c3a  mongodb-src-r3.4.10.tar.gz
-56db8f43afc94713ac65b174189e2dd903b5e1eff0b65f1bdac159e52ad4de6606c449865d73bd47bffad6a8fc339777e2b11395596e9a476867d94a219c7925  40-fix-elf-native-class.patch
-7d097f497cb910c9cb81086cd8c222e43456d1a6de4adfe3e97a4d99add454279350fdeb7305dab84b3deca04afd824036d4065ee0fb8cdd8c03e96d98ee86af  backtrace.patch
-f829b1ad542db3ee776d444243b8b47ab4e48a7386d9b199d7b1adafd31556cf173a5683b78ee735d6a69999ad9af5ad152fde955bbe8865f7910718991ce97c  fix-asio-strerror_r.patch
-8f2832f10e47b1a9f413ab44eb2b75dbb7bc47282d3ba721f35d4a93bc4fcf18b88c5f1c2f0ccf28539bbf81ee4c5715c5b71506fa680d22cde0630f9b3e2d22  fix-libressl.patch
-9e109a9131e8466496e94f7046e13fd40ec750c8de703e31d65cf3f6e80830e67e1438debaefc0e1150fe2bb08dbb42cf95890c51e9d98f354cfbb396500b5d4  fix-log.patch
+sha512sums="ad02fac423186da725493bf82a417cf5f68b08afe91c67f007b46324dfde3d6b4c51ed8eb1a314da73563be498b844f79be66a4f5d1fb83095df6c5458bd6d1f  mongodb-src-r3.6.1.tar.gz
+1492137b0e3456d90a79617c1cd5ead5c71b1cfaae9ee41c75d56cd25f404ec73a690f95ce0d8c064c0a14206daca8070aa769b7cdfa904a338a425b52c293fa  fix-default-stacksize.patch
+56db8f43afc94713ac65b174189e2dd903b5e1eff0b65f1bdac159e52ad4de6606c449865d73bd47bffad6a8fc339777e2b11395596e9a476867d94a219c7925  fix-elf-native-class.patch
 026d20fa1a0f1e27150b833664300250386d7e0d73c0778f81f70242e93e8a16e5607716693bbcdd1efb328fa84c7284e2c6c7e1ac92259b97a9d402975cf709  fix-processinfo_linux.patch
-a6c237f03fd09d960058eb92eab41e8dd7298e628a60656732d6751af90712d7359613b2c7241f7d893e675235631a9eef14495fbff8a52d25e792d62c3f6d30  fix-std-string.patch
-1492137b0e3456d90a79617c1cd5ead5c71b1cfaae9ee41c75d56cd25f404ec73a690f95ce0d8c064c0a14206daca8070aa769b7cdfa904a338a425b52c293fa  set-default-stacksize.patch
-bbb323d428d59584703e8692bf4df7fe0d37c0324c23822bade2edd1ca78759191f778230b7107502a9d2f7f22afc84d4ea350139fc1d751ceb2fff219b9ddf8  wiredtiger-strtouq.patch
-385c82875174caae433a3b381eb10f98a6fed0c8943788ddefff1de80a898e480bdbbf094a7783285cf2ae11ce3fc6878e57d58183d05be2f0837b206aaa4da6  boost160.patch
-79edfd1a6eaba597b31a82e54722dccab288d8b8840a53f79140b5fca221b5acd9fbc770d99e46ea9fa0da502cdf18dd35d982c95a4aa341806c3d8b61fc732f  boost162.patch
+aac12cffc452f1dc365c65944a015476c2011b0975144879d28938c690fe6e77b6bd672e040b4c04c02cb002224e24d6f13adb083324f424ef4cdb79a3a71f6b  fix-resolv.patch
+94078abfa74583afef6b5c1f0b334b257cfe87b0db7c13309a9c63d915913d5237c776dbb52f6a23e9409ec390d29e2f7225e9b8c8c5efcbc35b015c613f600c  fix-strerror_r.patch
 9bcd870742c31bf25f34188ddc3c414de1103e9860dea9f54eee276b89bc2cf1226abab1749c5cda6a6fb0880e541373754e5e83d63cc7189d4b9c274fd555c3  mongodb.confd
 74009794d566dd9d70ec93ffd95c830ee4696165574ecf87398165637fb40799b38d182ef54c50fd0772d589be94ade7f7a49247f3d31c1f012cb4e44cc9f5df  mongodb.initd
 8c089b1a11f494e4148fb4646265964c925bf937633a65e395ee1361d42facf837871dd493a9a2e0f480ae0e0829dbd3ed60794c5334e2716332e131fc5c2c51  mongodb.logrotate
diff --git a/community/mongodb/backtrace.patch b/community/mongodb/backtrace.patch
deleted file mode 100644
index f110c7484d..0000000000
--- a/community/mongodb/backtrace.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff --git a/SConstruct b/SConstruct
-index 64c8387..3db1f3e 100644
---- a/SConstruct
-+++ b/SConstruct
-@@ -2292,7 +2292,8 @@ def doConfigure(myenv):
-     if (conf.CheckCXXHeader( "execinfo.h" ) and
-         conf.CheckDeclaration('backtrace', includes='#include <execinfo.h>') and
-         conf.CheckDeclaration('backtrace_symbols', includes='#include <execinfo.h>') and
--        conf.CheckDeclaration('backtrace_symbols_fd', includes='#include <execinfo.h>')):
-+        conf.CheckDeclaration('backtrace_symbols_fd', includes='#include <execinfo.h>') and
-+        conf.CheckFunc('backtrace')):
- 
-         conf.env.SetConfigHeaderDefine("MONGO_CONFIG_HAVE_EXECINFO_BACKTRACE")
- 
diff --git a/community/mongodb/boost160.patch b/community/mongodb/boost160.patch
deleted file mode 100644
index 3567c65f82..0000000000
--- a/community/mongodb/boost160.patch
+++ /dev/null
@@ -1,11 +0,0 @@
-diff -uprb mongodb-src-r3.2.0.orig/SConstruct mongodb-src-r3.2.0/SConstruct
---- mongodb-src-r3.2.0.orig/SConstruct	2015-12-02 21:01:34.000000000 +0200
-+++ mongodb-src-r3.2.0/SConstruct	2015-12-22 11:18:23.613216445 +0200
-@@ -2245,6 +2245,7 @@ def doConfigure(myenv):
-             # permit more than four parameters.
-             "BOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD",
-             "BOOST_SYSTEM_NO_DEPRECATED",
-+            "BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE",
-         ]
-     )
- 
diff --git a/community/mongodb/boost162.patch b/community/mongodb/boost162.patch
deleted file mode 100644
index 30a3bdff45..0000000000
--- a/community/mongodb/boost162.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Derived from http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/databases/mongodb/patches/patch-src_mongo_db_fts_unicode_string.cpp v1.1
-
-* Fix build with boost 1.62.0
-
---- a/src/mongo/db/fts/unicode/string.cpp	2016-09-26 12:10:04.000000000 +0000
-+++ b/src/mongo/db/fts/unicode/string.cpp
-@@ -274,7 +274,7 @@ bool String::substrMatch(const std::stri
- 
-     // Case sensitive and diacritic sensitive.
-     return boost::algorithm::boyer_moore_search(
--               haystack.begin(), haystack.end(), needle.begin(), needle.end()) != haystack.end();
-+               haystack.begin(), haystack.end(), needle.begin(), needle.end()) != std::make_pair(haystack.end(), haystack.end());
- }
- 
- }  // namespace unicode
diff --git a/community/mongodb/fix-asio-strerror_r.patch b/community/mongodb/fix-asio-strerror_r.patch
deleted file mode 100644
index f2fe5cb1eb..0000000000
--- a/community/mongodb/fix-asio-strerror_r.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-https://github.com/chriskohlhoff/asio/issues/94
-
-diff --git a/src/third_party/asio-asio-1-11-0/asio/include/asio/impl/error_code.ipp b/src/third_party/asio-asio-1-11-0/asio/include/asio/impl/error_code.ipp
-index 4e7badb..0eeae88 100644
---- a/src/third_party/asio-asio-1-11-0/asio/include/asio/impl/error_code.ipp
-+++ b/src/third_party/asio-asio-1-11-0/asio/include/asio/impl/error_code.ipp
-@@ -97,17 +97,14 @@ public:
- #if defined(__sun) || defined(__QNX__) || defined(__SYMBIAN32__)
-     using namespace std;
-     return strerror(value);
--#elif defined(__MACH__) && defined(__APPLE__) \
--  || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) \
--  || defined(_AIX) || defined(__hpux) || defined(__osf__) \
--  || defined(__ANDROID__)
-+#elif defined(__GLIBC__) && defined(_GNU_SOURCE)
-+    char buf[256] = "";
-+    return strerror_r(value, buf, sizeof(buf));
-+#else
-     char buf[256] = "";
-     using namespace std;
-     strerror_r(value, buf, sizeof(buf));
-     return buf;
--#else
--    char buf[256] = "";
--    return strerror_r(value, buf, sizeof(buf));
- #endif
- #endif // defined(ASIO_WINDOWS)
-   }
diff --git a/community/mongodb/set-default-stacksize.patch b/community/mongodb/fix-default-stacksize.patch
similarity index 100%
rename from community/mongodb/set-default-stacksize.patch
rename to community/mongodb/fix-default-stacksize.patch
diff --git a/community/mongodb/40-fix-elf-native-class.patch b/community/mongodb/fix-elf-native-class.patch
similarity index 100%
rename from community/mongodb/40-fix-elf-native-class.patch
rename to community/mongodb/fix-elf-native-class.patch
diff --git a/community/mongodb/fix-libressl.patch b/community/mongodb/fix-libressl.patch
deleted file mode 100644
index 1113589655..0000000000
--- a/community/mongodb/fix-libressl.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- mongodb-src-r3.4.7/src/mongo/crypto/sha1_block_openssl.cpp.orig
-+++ mongodb-src-r3.4.7/src/mongo/crypto/sha1_block_openssl.cpp
-@@ -42,7 +42,7 @@
- #include <openssl/evp.h>
- #include <openssl/hmac.h>
- #include <openssl/sha.h>
--#if OPENSSL_VERSION_NUMBER < 0x10100000L
-+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- namespace {
- // Copies of OpenSSL after 1.1.0 define new EVP digest routines. We must
- // polyfill used definitions to interact with older OpenSSL versions.
---- mongodb-src-r3.4.7/src/mongo/util/net/ssl_manager.cpp.orig
-+++ mongodb-src-r3.4.7/src/mongo/util/net/ssl_manager.cpp
-@@ -150,7 +150,7 @@
- #endif // MONGO_CONFIG_NEEDS_ASN1_ANY_DEFINITIONS
- // clang-format on
- 
--#if OPENSSL_VERSION_NUMBER < 0x10100000L
-+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- // Copies of OpenSSL after 1.1.0 define new functions for interaction with
- // X509 structure. We must polyfill used definitions to interact with older
- // OpenSSL versions.
diff --git a/community/mongodb/fix-resolv.patch b/community/mongodb/fix-resolv.patch
new file mode 100644
index 0000000000..09bda7b643
--- /dev/null
+++ b/community/mongodb/fix-resolv.patch
@@ -0,0 +1,17 @@
+--- mongodb-src-r3.6.1/src/mongo/util/dns_query_posix-impl.h.orig
++++ mongodb-src-r3.6.1/src/mongo/util/dns_query_posix-impl.h
+@@ -38,6 +38,14 @@
+ #include <resolv.h>
+ // clang-format on
+ 
++// Support deprecated resolver, as in musl libc
++#ifndef res_ninit
++#define res_nclose(arg)
++#define res_ninit(arg)    res_init()
++#define res_nsearch(sta, nam, clas, typ, ans, alen)  res_search(nam, clas, typ, ans, alen)
++#endif
++
++
+ #include <stdio.h>
+ 
+ #include <iostream>
diff --git a/community/mongodb/fix-std-string.patch b/community/mongodb/fix-std-string.patch
deleted file mode 100644
index cf1953070e..0000000000
--- a/community/mongodb/fix-std-string.patch
+++ /dev/null
@@ -1,41 +0,0 @@
---- mongodb-src-r3.4.7/src/mongo/db/dbwebserver.cpp.orig
-+++ mongodb-src-r3.4.7/src/mongo/db/dbwebserver.cpp
-@@ -67,6 +67,7 @@
- using std::map;
- using std::stringstream;
- using std::vector;
-+using std::string;
- 
- using namespace html;
- 
---- mongodb-src-r3.4.7/src/mongo/db/repl/master_slave.cpp.orig
-+++ mongodb-src-r3.4.7/src/mongo/db/repl/master_slave.cpp
-@@ -78,6 +78,7 @@
- using std::max;
- using std::min;
- using std::set;
-+using std::string;
- using std::stringstream;
- using std::unique_ptr;
- using std::vector;
---- mongodb-src-r3.4.7/src/mongo/db/matcher/expression_leaf.cpp.orig
-+++ mongodb-src-r3.4.7/src/mongo/db/matcher/expression_leaf.cpp
-@@ -46,6 +46,8 @@
- 
- namespace mongo {
- 
-+using std::string;
-+
- Status LeafMatchExpression::setPath(StringData path) {
-     _path = path;
-     return _elementPath.init(_path);
---- mongodb-src-r3.4.7/src/mongo/shell/bench.cpp.orig
-+++ mongodb-src-r3.4.7/src/mongo/shell/bench.cpp
-@@ -78,6 +78,7 @@
- using std::unique_ptr;
- using std::cout;
- using std::map;
-+using std::string;
- 
- const std::map<OpType, std::string> opTypeName{{OpType::NONE, "none"},
-                                                {OpType::NOP, "nop"},
diff --git a/community/mongodb/fix-log.patch b/community/mongodb/fix-strerror_r.patch
similarity index 70%
rename from community/mongodb/fix-log.patch
rename to community/mongodb/fix-strerror_r.patch
index e7bc8bef5d..3dd19b3821 100644
--- a/community/mongodb/fix-log.patch
+++ b/community/mongodb/fix-strerror_r.patch
@@ -1,6 +1,6 @@
---- a/src/mongo/util/log.cpp
-+++ b/src/mongo/util/log.cpp
-@@ -101,9 +101,7 @@
+--- mongodb-src-r3.6.1/src/mongo/util/errno_util.cpp.orig
++++ mongodb-src-r3.6.1/src/mongo/util/errno_util.cpp
+@@ -58,9 +58,7 @@
      char buf[kBuflen];
      char* msg{nullptr};
  
diff --git a/community/mongodb/wiredtiger-strtouq.patch b/community/mongodb/wiredtiger-strtouq.patch
deleted file mode 100644
index db66bcdec2..0000000000
--- a/community/mongodb/wiredtiger-strtouq.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- mongodb-src-r3.2.3/src/third_party/wiredtiger/build_linux/wiredtiger_config.h.orig
-+++ mongodb-src-r3.2.3/src/third_party/wiredtiger/build_linux/wiredtiger_config.h
-@@ -101,7 +101,7 @@
- #define HAVE_STRING_H 1
- 
- /* Define to 1 if you have the `strtouq' function. */
--#define HAVE_STRTOUQ 1
-+/* #undef HAVE_STRTOUQ 1 */
- 
- /* Define to 1 if you have the `sync_file_range' function. */
- /* #undef HAVE_SYNC_FILE_RANGE */
-- 
2.15.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---