From 501053e2de2a1f7a1ba87cd899a978a7316b3e48 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 4 Feb 2020 17:20:49 +0100 Subject: update to 1.7.0 with libbson and libmongoc 1.16.1 with libmongocrypt 1.0.1 fix build with system libraries using patch from https://github.com/mongodb/mongo-php-driver/pull/1095 --- 1095.patch | 44 ++++++++++ PHPINFO | 14 +-- REFLECTION | 239 ++++++++++++++++++++++++++++++++++++++++++++++---- php-pecl-mongodb.spec | 51 +++++++---- 4 files changed, 311 insertions(+), 37 deletions(-) create mode 100644 1095.patch diff --git a/1095.patch b/1095.patch new file mode 100644 index 0000000..2f82487 --- /dev/null +++ b/1095.patch @@ -0,0 +1,44 @@ +From 71a86ccd0c6338a18aced544cd798593d7ad93ea Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 4 Feb 2020 16:47:47 +0100 +Subject: [PATCH] Fix build with system libraries + +--- + config.m4 | 10 +++++----- + php_phongo.c | 2 +- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/config.m4 b/config.m4 +index 39e0627b..e00ceb44 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -257,11 +257,11 @@ if test "$PHP_MONGODB" != "no"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for libmongocrypt) + +- if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmongocrypt-1.0; then +- if $PKG_CONFIG libmongocrypt-1.0 --atleast-version 1.0.1; then +- PHP_MONGODB_MONGOCRYPT_CFLAGS=`$PKG_CONFIG libmongocrypt-1.0 --cflags` +- PHP_MONGODB_MONGOCRYPT_LIBS=`$PKG_CONFIG libmongocrypt-1.0 --libs` +- PHP_MONGODB_MONGOCRYPT_VERSION=`$PKG_CONFIG libmongocrypt-1.0 --modversion` ++ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmongocrypt; then ++ if $PKG_CONFIG libmongocrypt --atleast-version 1.0.1; then ++ PHP_MONGODB_MONGOCRYPT_CFLAGS=`$PKG_CONFIG libmongocrypt --cflags` ++ PHP_MONGODB_MONGOCRYPT_LIBS=`$PKG_CONFIG libmongocrypt --libs` ++ PHP_MONGODB_MONGOCRYPT_VERSION=`$PKG_CONFIG libmongocrypt --modversion` + AC_MSG_RESULT(version $PHP_MONGODB_MONGOCRYPT_VERSION found) + + PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_MONGOCRYPT_CFLAGS" +diff --git a/php_phongo.c b/php_phongo.c +index ef3600b8..83f5dfd4 100644 +--- a/php_phongo.c ++++ b/php_phongo.c +@@ -3924,7 +3924,7 @@ PHP_MINFO_FUNCTION(mongodb) + #ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION + #ifdef HAVE_SYSTEM_LIBMONGOCRYPT + php_info_print_table_row(2, "libmongocrypt headers version", MONGOCRYPT_VERSION); +- php_info_print_table_row(2, "libmongocrypt library version", mongocrypt_version()); ++ php_info_print_table_row(2, "libmongocrypt library version", mongocrypt_version(NULL)); + #else + php_info_print_table_row(2, "libmongocrypt bundled version", MONGOCRYPT_VERSION); + #endif diff --git a/PHPINFO b/PHPINFO index bc38217..d6106b3 100644 --- a/PHPINFO +++ b/PHPINFO @@ -2,12 +2,12 @@ mongodb MongoDB support => enabled -MongoDB extension version => 1.6.1 +MongoDB extension version => 1.7.0 MongoDB extension stability => stable -libbson headers version => 1.15.2 -libbson library version => 1.15.2 -libmongoc headers version => 1.15.2 -libmongoc library version => 1.15.2 +libbson headers version => 1.16.1 +libbson library version => 1.16.1 +libmongoc headers version => 1.16.1 +libmongoc library version => 1.16.1 libmongoc SSL => enabled libmongoc SSL library => OpenSSL libmongoc crypto => enabled @@ -18,6 +18,10 @@ libmongoc ICU => enabled libmongoc compression => enabled libmongoc compression snappy => enabled libmongoc compression zlib => enabled +libmongocrypt headers version => 1.0.1 +libmongocrypt library version => 1.0.1 +libmongocrypt crypto => enabled +libmongocrypt crypto library => libcrypto Directive => Local Value => Master Value mongodb.debug => no value => no value diff --git a/REFLECTION b/REFLECTION index ce233f2..ab42c66 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #182 mongodb version 1.6.1 ] { +Extension [ extension #106 mongodb version 1.7.0 ] { - Dependencies { Dependency [ date (Required) ] @@ -14,7 +14,7 @@ Extension [ extension #182 mongodb version 1.6.1 ] { } - Constants [2] { - Constant [ string MONGODB_VERSION ] { 1.6.1 } + Constant [ string MONGODB_VERSION ] { 1.7.0 } Constant [ string MONGODB_STABILITY ] { stable } } @@ -70,7 +70,7 @@ Extension [ extension #182 mongodb version 1.6.1 ] { } } - - Classes [60] { + - Classes [62] { Interface [ interface MongoDB\BSON\Type ] { - Constants [0] { @@ -395,13 +395,14 @@ Extension [ extension #182 mongodb version 1.6.1 ] { Class [ final class MongoDB\BSON\Binary implements MongoDB\BSON\BinaryInterface, JsonSerializable, MongoDB\BSON\Type, Serializable ] { - - Constants [7] { + - Constants [8] { Constant [ public int TYPE_GENERIC ] { 0 } Constant [ public int TYPE_FUNCTION ] { 1 } Constant [ public int TYPE_OLD_BINARY ] { 2 } Constant [ public int TYPE_OLD_UUID ] { 3 } Constant [ public int TYPE_UUID ] { 4 } Constant [ public int TYPE_MD5 ] { 5 } + Constant [ public int TYPE_ENCRYPTED ] { 6 } Constant [ public int TYPE_USER_DEFINED ] { 128 } } @@ -1263,6 +1264,60 @@ Extension [ extension #182 mongodb version 1.6.1 ] { } } + Class [ final class MongoDB\Driver\ClientEncryption ] { + + - Constants [2] { + Constant [ public string AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC ] { AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic } + Constant [ public string AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM ] { AEAD_AES_256_CBC_HMAC_SHA_512-Random } + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [5] { + Method [ final public method createDataKey ] { + + - Parameters [2] { + Parameter #0 [ $kmsProvider ] + Parameter #1 [ array or NULL $options ] + } + } + + Method [ final public method encrypt ] { + + - Parameters [2] { + Parameter #0 [ $value ] + Parameter #1 [ array or NULL $options ] + } + } + + Method [ final public method decrypt ] { + + - Parameters [1] { + Parameter #0 [ MongoDB\BSON\BinaryInterface $keyVaultClient ] + } + } + + Method [ final private method __construct ] { + + - Parameters [0] { + } + } + + Method [ final public method __wakeup ] { + + - Parameters [0] { + } + } + } + } + Class [ final class MongoDB\Driver\Command ] { - Constants [0] { @@ -1353,7 +1408,7 @@ Extension [ extension #182 mongodb version 1.6.1 ] { } } - Class [ final class MongoDB\Driver\CursorId ] { + Class [ final class MongoDB\Driver\CursorId implements Serializable ] { - Constants [0] { } @@ -1367,13 +1422,26 @@ Extension [ extension #182 mongodb version 1.6.1 ] { - Properties [0] { } - - Methods [3] { + - Methods [5] { Method [ final public method __toString ] { - Parameters [0] { } } + Method [ final public method serialize ] { + + - Parameters [0] { + } + } + + Method [ final public method unserialize ] { + + - Parameters [1] { + Parameter #0 [ $serialized ] + } + } + Method [ final private method __construct ] { - Parameters [0] { @@ -1402,7 +1470,7 @@ Extension [ extension #182 mongodb version 1.6.1 ] { - Properties [0] { } - - Methods [14] { + - Methods [15] { Method [ final public method __construct ] { - Parameters [3] { @@ -1412,6 +1480,13 @@ Extension [ extension #182 mongodb version 1.6.1 ] { } } + Method [ final public method createClientEncryption ] { + + - Parameters [1] { + Parameter #0 [ array $options ] + } + } + Method [ final public method executeCommand ] { - Parameters [3] { @@ -1543,7 +1618,7 @@ Extension [ extension #182 mongodb version 1.6.1 ] { } } - Class [ final class MongoDB\Driver\ReadConcern implements MongoDB\BSON\Serializable, MongoDB\BSON\Type ] { + Class [ final class MongoDB\Driver\ReadConcern implements MongoDB\BSON\Serializable, MongoDB\BSON\Type, Serializable ] { - Constants [4] { Constant [ public string LOCAL ] { local } @@ -1567,7 +1642,7 @@ Extension [ extension #182 mongodb version 1.6.1 ] { - Properties [0] { } - - Methods [4] { + - Methods [6] { Method [ final public method __construct ] { - Parameters [1] { @@ -1592,12 +1667,25 @@ Extension [ extension #182 mongodb version 1.6.1 ] { - Parameters [0] { } } + + Method [ final public method serialize ] { + + - Parameters [0] { + } + } + + Method [ final public method unserialize ] { + + - Parameters [1] { + Parameter #0 [ $serialized ] + } + } } } - Class [ final class MongoDB\Driver\ReadPreference implements MongoDB\BSON\Serializable, MongoDB\BSON\Type ] { + Class [ final class MongoDB\Driver\ReadPreference implements MongoDB\BSON\Serializable, MongoDB\BSON\Type, Serializable ] { - - Constants [7] { + - Constants [12] { Constant [ public int RP_PRIMARY ] { 1 } Constant [ public int RP_PRIMARY_PREFERRED ] { 5 } Constant [ public int RP_SECONDARY ] { 2 } @@ -1605,6 +1693,11 @@ Extension [ extension #182 mongodb version 1.6.1 ] { Constant [ public int RP_NEAREST ] { 10 } Constant [ public int NO_MAX_STALENESS ] { -1 } Constant [ public int SMALLEST_MAX_STALENESS_SECONDS ] { 90 } + Constant [ public string PRIMARY ] { primary } + Constant [ public string PRIMARY_PREFERRED ] { primaryPreferred } + Constant [ public string SECONDARY ] { secondary } + Constant [ public string SECONDARY_PREFERRED ] { secondaryPreferred } + Constant [ public string NEAREST ] { nearest } } - Static properties [0] { @@ -1622,7 +1715,7 @@ Extension [ extension #182 mongodb version 1.6.1 ] { - Properties [0] { } - - Methods [5] { + - Methods [8] { Method [ final public method __construct ] { - Parameters [3] { @@ -1644,6 +1737,12 @@ Extension [ extension #182 mongodb version 1.6.1 ] { } } + Method [ final public method getModeString ] { + + - Parameters [0] { + } + } + Method [ final public method getTagSets ] { - Parameters [0] { @@ -1655,6 +1754,19 @@ Extension [ extension #182 mongodb version 1.6.1 ] { - Parameters [0] { } } + + Method [ final public method serialize ] { + + - Parameters [0] { + } + } + + Method [ final public method unserialize ] { + + - Parameters [1] { + Parameter #0 [ $serialized ] + } + } } } @@ -1818,7 +1930,12 @@ Extension [ extension #182 mongodb version 1.6.1 ] { Class [ final class MongoDB\Driver\Session ] { - - Constants [0] { + - Constants [5] { + Constant [ public string TRANSACTION_NONE ] { none } + Constant [ public string TRANSACTION_STARTING ] { starting } + Constant [ public string TRANSACTION_IN_PROGRESS ] { in_progress } + Constant [ public string TRANSACTION_COMMITTED ] { committed } + Constant [ public string TRANSACTION_ABORTED ] { aborted } } - Static properties [0] { @@ -1830,7 +1947,7 @@ Extension [ extension #182 mongodb version 1.6.1 ] { - Properties [0] { } - - Methods [13] { + - Methods [15] { Method [ final public method abortTransaction ] { - Parameters [0] { @@ -1887,6 +2004,18 @@ Extension [ extension #182 mongodb version 1.6.1 ] { } } + Method [ final public method getTransactionOptions ] { + + - Parameters [0] { + } + } + + Method [ final public method getTransactionState ] { + + - Parameters [0] { + } + } + Method [ final public method isInTransaction ] { - Parameters [0] { @@ -1914,7 +2043,7 @@ Extension [ extension #182 mongodb version 1.6.1 ] { } } - Class [ final class MongoDB\Driver\WriteConcern implements MongoDB\BSON\Serializable, MongoDB\BSON\Type ] { + Class [ final class MongoDB\Driver\WriteConcern implements MongoDB\BSON\Serializable, MongoDB\BSON\Type, Serializable ] { - Constants [1] { Constant [ public string MAJORITY ] { majority } @@ -1935,7 +2064,7 @@ Extension [ extension #182 mongodb version 1.6.1 ] { - Properties [0] { } - - Methods [6] { + - Methods [8] { Method [ final public method __construct ] { - Parameters [3] { @@ -1974,6 +2103,19 @@ Extension [ extension #182 mongodb version 1.6.1 ] { - Parameters [0] { } } + + Method [ final public method serialize ] { + + - Parameters [0] { + } + } + + Method [ final public method unserialize ] { + + - Parameters [1] { + Parameter #0 [ $serialized ] + } + } } } @@ -2748,6 +2890,71 @@ Extension [ extension #182 mongodb version 1.6.1 ] { } } + Class [ class MongoDB\Driver\Exception\EncryptionException extends MongoDB\Driver\Exception\RuntimeException implements MongoDB\Driver\Exception\Exception, Throwable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [5] { + Property [ protected $message ] + Property [ protected $code ] + Property [ protected $file ] + Property [ protected $line ] + Property [ protected $errorLabels ] + } + + - Methods [11] { + Method [ final public method hasErrorLabel ] { + + - Parameters [1] { + Parameter #0 [ $label ] + } + } + + Method [ public method __construct ] { + + - Parameters [3] { + Parameter #0 [ $message ] + Parameter #1 [ $code ] + Parameter #2 [ $previous ] + } + } + + Method [ public method __wakeup ] { + } + + Method [ final public method getMessage ] { + } + + Method [ final public method getCode ] { + } + + Method [ final public method getFile ] { + } + + Method [ final public method getLine ] { + } + + Method [ final public method getTrace ] { + } + + Method [ final public method getPrevious ] { + } + + Method [ final public method getTraceAsString ] { + } + + Method [ public method __toString ] { + } + } + } + Class [ final class MongoDB\Driver\Exception\ExecutionTimeoutException extends MongoDB\Driver\Exception\ServerException implements Throwable, MongoDB\Driver\Exception\Exception ] { - Constants [0] { diff --git a/php-pecl-mongodb.spec b/php-pecl-mongodb.spec index 16a8feb..caddfeb 100644 --- a/php-pecl-mongodb.spec +++ b/php-pecl-mongodb.spec @@ -1,6 +1,6 @@ # remirepo spec file for php-pecl-mongodb # -# Copyright (c) 2015-2019 Remi Collet +# Copyright (c) 2015-2020 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -30,34 +30,42 @@ %global with_tests 0%{?_with_tests:1} # F30 for fedora repo, F28 for remi -%if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 +%if 0%{?fedora} >= 29 || 0%{?rhel} >= 8 %global with_syslib 1 -%global libver 1.15.2 -%global libbuildver %(pkg-config --silence-errors --modversion libmongoc-1.0 2>/dev/null || echo %{libver}) +%global libmongo 1.16.1 +%global libmongover %(pkg-config --silence-errors --modversion libmongoc-1.0 2>/dev/null || echo %{libmongoc}) +%global libcrypt 1.0.1 +%global libcryptver %(pkg-config --silence-errors --modversion libmongocrypt 2>/dev/null || echo %{libcrypt}) %else %global with_syslib 0 -%global libver 1.15.2 +%global libmongo 1.16.1 +%global libcrypt 1.0.1 %endif Summary: MongoDB driver for PHP Name: %{?sub_prefix}php-pecl-%{pecl_name} -%global upstream_version 1.6.1 +%global upstream_version 1.7.0 #global upstream_prever RC1 #global upstream_lower ~rc1 Version: %{upstream_version}%{?upstream_lower} Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: ASL 2.0 -URL: http://pecl.php.net/package/%{pecl_name} -Source0: http://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz +URL: https://pecl.php.net/package/%{pecl_name} +Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz + +Patch0: https://patch-diff.githubusercontent.com/raw/mongodb/mongo-php-driver/pull/1095.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel > 5.6 BuildRequires: %{?scl_prefix}php-pear BuildRequires: %{?scl_prefix}php-json %if %{with_syslib} -BuildRequires: pkgconfig(libbson-1.0) >= %{libver} -BuildRequires: pkgconfig(libmongoc-1.0) >= %{libver} -Requires: mongo-c-driver-libs%{?_isa} >= %{libbuildver} +BuildRequires: pkgconfig(libbson-1.0) >= %{libmongo} +BuildRequires: pkgconfig(libmongoc-1.0) >= %{libmongo} +BuildRequires: pkgconfig(libmongocrypt) >= %{libcrypt} +Requires: libbson%{?_isa} >= %{libmongover} +Requires: mongo-c-driver-libs%{?_isa} >= %{libmongover} +Requires: libmongocrypt%{?_isa} >= %{libcryptver} %else BuildRequires: cyrus-sasl-devel BuildRequires: openssl-devel @@ -65,8 +73,9 @@ BuildRequires: snappy-devel BuildRequires: zlib-devel # We require 50 to ensure use of libicu-last (same version than PHP) BuildRequires: libicu-devel >= 50 -Provides: bundled(libbson) = %{libver} -Provides: bundled(mongo-c-driver) = %{libver} +Provides: bundled(libbson) = %{libmongo} +Provides: bundled(mongo-c-driver) = %{libmongo} +Provides: bundled(libmongocrypt) = %{libcrypt} %endif %if %{with_tests} BuildRequires: mongodb-server @@ -138,6 +147,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -p1 -b .pr1095 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_MONGODB_VERSION /{s/.* "//;s/".*$//;p}' phongo_version.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then @@ -170,18 +181,19 @@ peclbuild() { %if %{with_syslib} # Ensure we use system library # Need to be removed only after phpize because of m4_include - rm -r src/libmongoc + rm -r src/libmongoc* %configure \ --with-php-config=%{_bindir}/${1}-config \ - --with-libbson \ - --with-libmongoc \ + --with-mongodb-system-libs \ + --with-mongodb-client-side-encryption \ --enable-mongodb %else %configure \ --with-php-config=%{_bindir}/${1}-config \ --enable-mongodb-crypto-system-profile \ + --with-mongodb-client-side-encryption \ --with-mongodb-sasl=cyrus \ --with-mongodb-icu=yes \ --with-mongodb-ssl=openssl \ @@ -328,6 +340,13 @@ exit $ret %changelog +* Tue Feb 4 2020 Remi Collet - 1.7.0-1 +- update to 1.7.0 +- with libbson and libmongoc 1.16.1 +- with libmongocrypt 1.0.1 +- fix build with system libraries using patch from + https://github.com/mongodb/mongo-php-driver/pull/1095 + * Fri Dec 6 2019 Remi Collet - 1.6.1-1 - update to 1.6.1 -- cgit