summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mongo-json.patch16
-rw-r--r--mongo.ini11
-rw-r--r--php-pecl-mongo-dev.spec106
3 files changed, 109 insertions, 24 deletions
diff --git a/mongo-json.patch b/mongo-json.patch
new file mode 100644
index 0000000..fe43a1f
--- /dev/null
+++ b/mongo-json.patch
@@ -0,0 +1,16 @@
+--- config.m4.old 2014-02-26 14:17:31.000000000 +0100
++++ config.m4 2014-02-26 14:22:36.000000000 +0100
+@@ -148,4 +148,13 @@
+ -L$MONGO_SASL_DIR/$PHP_LIBDIR
+ ])
+ PHP_SUBST(MONGO_SHARED_LIBADD)
++
++fi
++
++AC_MSG_CHECKING(for JSON)
++if test -f "$phpincludedir/ext/json/php_json.h"; then
++ AC_DEFINE(HAVE_JSON, 1, [JSON support])
++ AC_MSG_RESULT(Yes)
++else
++ AC_MSG_RESULT(Missing json or jsonc extension)
+ fi
diff --git a/mongo.ini b/mongo.ini
index 1bb81f3..84516a3 100644
--- a/mongo.ini
+++ b/mongo.ini
@@ -6,9 +6,6 @@ extension=mongo.so
; If empty strings ("") should be allowed as key names.
;mongo.allow_empty_keys = 0
-; If persistent connections are allowed.
-;mongo.allow_persistent = 1
-
; The number of bytes-per-chunk.
; This number must be at least 100 less than 4 megabytes (max: 4194204)
;mongo.chunk_size = 262144
@@ -24,7 +21,7 @@ extension=mongo.so
; For replicaset connections: The minimum interval with which the driver
; will send "isMaster" requests to the MongoDB server.
-;mongo.is_master_interval = 60
+;mongo.is_master_interval = 15
; Return a BSON_LONG as an instance of MongoInt64
; (instead of a primitive type).
@@ -36,9 +33,3 @@ mongo.native_long = true
; For replicaset connections: The minimum interval with which the driver
; will send "ping" requests to the MongoDB server.
;mongo.ping_interval = 5
-
-; If an exception should be thrown for non-UTF8 strings.
-; This option will be eliminated and exceptions always thrown for non-UTF8
-; strings starting with version 1.1.0.
-mongo.utf8 = 1
-
diff --git a/php-pecl-mongo-dev.spec b/php-pecl-mongo-dev.spec
index 610f54f..9bd70d6 100644
--- a/php-pecl-mongo-dev.spec
+++ b/php-pecl-mongo-dev.spec
@@ -4,26 +4,58 @@
%global pecl_name mongo
%global with_zts 0%{?__ztsphp:1}
+%global prever alpha1
+%global gh_commit f758e60874df3cda3a08dced0f51351535f8c672
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner mongodb
+%global gh_project mongo-php-driver
+%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
+
+%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7
+%global with_sasl 1
+%else
+%global with_sasl 0
+%endif
Summary: PHP MongoDB database driver
Name: php-pecl-mongo
-Version: 1.4.5
-Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+Version: 1.5.0
+Release: 0.1.%{prever}%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
License: ASL 2.0
Group: Development/Languages
URL: http://pecl.php.net/package/%{pecl_name}
-Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+# Pull sources from github to get tests
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}%{?prever}.tar.gz
Source1: %{pecl_name}.ini
+# https://jira.mongodb.org/browse/PHP-995
+Patch0: %{pecl_name}-json.patch
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: php-devel >= 5.2.6
BuildRequires: php-pear
+BuildRequires: php-json
+%if %{with_sasl}
+# https://jira.mongodb.org/browse/PHP-996
+BuildRequires: cyrus-sasl-devel >= 2.1.26
+%endif
+%if %{with_tests}
+BuildRequires: mongodb
+BuildRequires: mongodb-server
+%endif
Requires(post): %{__pecl}
Requires(postun): %{__pecl}
Requires: php(zend-abi) = %{php_zend_api}
Requires: php(api) = %{php_core_api}
+%if "%{php_version}" < "5.4"
+# php 5.3.3 in EL-6 don't use arched virtual provides
+# so only requires real packages instead
+Requires: php-common%{?_isa}
+%else
+Requires: php-json%{?_isa}
+%endif
Provides: php-%{pecl_name} = %{version}
Provides: php-%{pecl_name}%{?_isa} = %{version}
@@ -55,18 +87,14 @@ MongoDB database in PHP.
%prep
%setup -c -q
-mv %{pecl_name}-%{version} NTS
-cd NTS
+mv %{gh_project}-%{gh_commit} NTS
+cp %{SOURCE1} .
+mv NTS/package.xml .
-extver=$(sed -n '/#define PHP_MONGO_VERSION/{s/.* "//;s/".*$//;p}' php_mongo.h)
-if test "x${extver}" != "x%{version}%{?pre}"; then
- : Error: Upstream version is ${extver}, expecting %{version}.
- exit 1
-fi
+cd NTS
+%patch0 -p0
cd ..
-cp %{SOURCE1} .
-
%if %{with_zts}
cp -pr NTS ZTS
%endif
@@ -75,13 +103,21 @@ cp -pr NTS ZTS
%build
cd NTS
%{_bindir}/phpize
-%configure --with-php-config=%{_bindir}/php-config
+%configure \
+%if %{with_sasl}
+ --with-mongo-sasl \
+%endif
+ --with-php-config=%{_bindir}/php-config
make %{?_smp_mflags}
%if %{with_zts}
cd ../ZTS
%{_bindir}/zts-phpize
-%configure --with-php-config=%{_bindir}/zts-php-config
+%configure \
+%if %{with_sasl}
+ --with-mongo-sasl \
+%endif
+ --with-php-config=%{_bindir}/zts-php-config
make %{?_smp_mflags}
%endif
@@ -124,12 +160,45 @@ fi
%check
: Minimal load test for NTS extension
%{__php} -n \
+ -d extension=json.so \
-d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
-i | grep "MongoDB Support => enabled"
+%if %{with_tests}
+cd NTS
+
+: Create the configuration file
+mkdir data
+sed -e "/DBDIR/s:/data:$PWD/data:" \
+ tests/utils/cfg.inc.template \
+ >tests/utils/cfg.inc
+
+: Launch the test servers
+MONGO_SERVER_STANDALONE=yes \
+MONGO_SERVER_STANDALONE_AUTH=yes \
+MONGO_SERVER_REPLICASET=yes \
+MONGO_SERVER_REPLICASET_AUTH=yes \
+make servers
+
+: Upstream test suite NTS extension
+ret=0
+TEST_PHP_EXECUTABLE=/usr/bin/php \
+TEST_PHP_ARGS="-n -d extension=json.so -d extension=$PWD/modules/mongo.so" \
+NO_INTERACTION=1 \
+REPORT_EXIT_STATUS=1 \
+/usr/bin/php -n run-tests.php || ret=1
+
+: Clanups
+make stop-servers
+rm -rf data
+
+[ $ret -eq 0 ] || exit $ret
+%endif
+
%if %{with_zts}
: Minimal load test for ZTS extension
%{__ztsphp} -n \
+ -d extension=json.so \
-d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
-i | grep "MongoDB Support => enabled"
%endif
@@ -149,6 +218,15 @@ fi
%changelog
+* Wed Feb 26 2014 Remi Collet <remi@fedoraproject.org> - 1.5.0-0.1.alpha1
+- Update to 1.5.0alpha1
+- use sources from github for tests
+- cleanup mongo.ini
+- enable SASL support (Fedora >= 19, RHEL-7)
+ https://jira.mongodb.org/browse/PHP-996
+- add patch for JSON detection
+ https://jira.mongodb.org/browse/PHP-995
+
* Tue Nov 05 2013 Remi Collet <remi@fedoraproject.org> - 1.4.5-1
- Update to 1.4.5
- install doc in pecl doc_dir