|
|
418d1b5 |
# remirepo/fedora spec file for php-mongodb
|
|
|
418d1b5 |
#
|
|
|
418d1b5 |
# Copyright (c) 2015-2016 Remi Collet
|
|
|
418d1b5 |
# License: CC-BY-SA
|
|
|
418d1b5 |
# http://creativecommons.org/licenses/by-sa/4.0/
|
|
|
418d1b5 |
#
|
|
|
418d1b5 |
# Please, preserve the changelog entries
|
|
|
418d1b5 |
#
|
|
|
4e9ca0e |
%global gh_commit faf8a1d86b5c10684ef91fa6c81475b0c7f95240
|
|
|
418d1b5 |
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
|
|
|
418d1b5 |
%global gh_owner mongodb
|
|
|
418d1b5 |
#global gh_date 20151102
|
|
|
418d1b5 |
%global gh_project mongo-php-library
|
|
|
4e1d26b |
# Upstream only support 64bits, see https://jira.mongodb.org/browse/CDRIVER-1186
|
|
|
4e1d26b |
# Server only available on LE arch (ExcludeArch: ppc ppc64 %{sparc} s390 s390x)
|
|
|
418d1b5 |
%global with_tests 0%{!?_without_tests:1}
|
|
|
418d1b5 |
%global psr0 MongoDB
|
|
|
418d1b5 |
#global prever beta2
|
|
|
418d1b5 |
|
|
|
418d1b5 |
Name: php-%{gh_owner}
|
|
|
4e9ca0e |
Version: 1.0.2
|
|
|
418d1b5 |
%if 0%{?gh_date}
|
|
|
418d1b5 |
Release: 0.2.%{gh_date}git%{gh_short}%{?dist}
|
|
|
418d1b5 |
%else
|
|
|
4e1d26b |
Release: 2%{?dist}
|
|
|
418d1b5 |
%endif
|
|
|
418d1b5 |
Summary: MongoDB driver library
|
|
|
418d1b5 |
|
|
|
418d1b5 |
Group: Development/Libraries
|
|
|
418d1b5 |
License: ASL 2.0
|
|
|
418d1b5 |
URL: https://github.com/%{gh_owner}/%{gh_project}
|
|
|
418d1b5 |
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}%{?prever}-%{?gh_short}.tar.gz
|
|
|
418d1b5 |
|
|
|
418d1b5 |
# Autoloader
|
|
|
418d1b5 |
Source1: %{name}-autoload.php
|
|
|
418d1b5 |
|
|
|
418d1b5 |
BuildArch: noarch
|
|
|
418d1b5 |
%if %{with_tests}
|
|
|
418d1b5 |
BuildRequires: php(language) >= 5.4
|
|
|
418d1b5 |
BuildRequires: php-reflection
|
|
|
418d1b5 |
BuildRequires: php-spl
|
|
|
418d1b5 |
BuildRequires: php-pecl(mongodb)
|
|
|
418d1b5 |
BuildRequires: php-composer(phpunit/phpunit)
|
|
|
418d1b5 |
BuildRequires: mongodb-server >= 2.4
|
|
|
418d1b5 |
# For autoloader
|
|
|
418d1b5 |
BuildRequires: php-composer(symfony/class-loader)
|
|
|
418d1b5 |
%endif
|
|
|
418d1b5 |
|
|
|
418d1b5 |
# From composer.json, "require": {
|
|
|
418d1b5 |
# "php": ">=5.4"
|
|
|
418d1b5 |
# "ext-mongodb": "^1.1.0"
|
|
|
418d1b5 |
Requires: php(language) >= 5.4
|
|
|
418d1b5 |
Requires: php-pecl(mongodb) >= 1.1.0
|
|
|
418d1b5 |
# From phpcompatinfo report for 1.0.0alpha1
|
|
|
418d1b5 |
Requires: php-reflection
|
|
|
418d1b5 |
Requires: php-spl
|
|
|
418d1b5 |
# For autoloader
|
|
|
418d1b5 |
Requires: php-composer(symfony/class-loader)
|
|
|
418d1b5 |
|
|
|
418d1b5 |
# Composer
|
|
|
418d1b5 |
Provides: php-composer(%{gh_owner}/%{gh_owner}) = %{version}%{?prever}
|
|
|
418d1b5 |
|
|
|
418d1b5 |
|
|
|
418d1b5 |
%description
|
|
|
418d1b5 |
This library provides a high-level abstraction around the lower-level drivers
|
|
|
418d1b5 |
for PHP and HHVM (i.e. the mongodb extension).
|
|
|
418d1b5 |
|
|
|
418d1b5 |
While the extension provides a limited API for executing commands, queries,
|
|
|
418d1b5 |
and write operations, this library implements an API similar to that of the
|
|
|
418d1b5 |
legacy PHP driver. It contains abstractions for client, database, and
|
|
|
418d1b5 |
collection objects, and provides methods for CRUD operations and common
|
|
|
418d1b5 |
commands (e.g. index and collection management).
|
|
|
418d1b5 |
|
|
|
418d1b5 |
Autoloader: %{_datadir}/php/%{psr0}/autoload.php
|
|
|
418d1b5 |
|
|
|
418d1b5 |
|
|
|
418d1b5 |
%prep
|
|
|
418d1b5 |
%setup -q -n %{gh_project}-%{gh_commit}
|
|
|
418d1b5 |
|
|
|
418d1b5 |
cp %{SOURCE1} src/autoload.php
|
|
|
418d1b5 |
|
|
|
418d1b5 |
|
|
|
418d1b5 |
%build
|
|
|
418d1b5 |
# Nothing
|
|
|
418d1b5 |
|
|
|
418d1b5 |
|
|
|
418d1b5 |
%install
|
|
|
418d1b5 |
mkdir -p %{buildroot}%{_datadir}/php
|
|
|
418d1b5 |
cp -pr src %{buildroot}%{_datadir}/php/%{psr0}
|
|
|
418d1b5 |
|
|
|
418d1b5 |
|
|
|
418d1b5 |
%check
|
|
|
418d1b5 |
%if %{with_tests}
|
|
|
418d1b5 |
: Run a server
|
|
|
418d1b5 |
mkdir dbtest
|
|
|
418d1b5 |
|
|
|
418d1b5 |
: Choose a port to allow parallel build
|
|
|
418d1b5 |
port=$(php -r 'echo (27010+PHP_INT_SIZE);')
|
|
|
418d1b5 |
|
|
|
418d1b5 |
mongod \
|
|
|
418d1b5 |
--journal \
|
|
|
418d1b5 |
--logpath $PWD/server.log \
|
|
|
418d1b5 |
--pidfilepath $PWD/server.pid \
|
|
|
418d1b5 |
--dbpath $PWD/dbtest \
|
|
|
418d1b5 |
--port $port \
|
|
|
418d1b5 |
--fork
|
|
|
418d1b5 |
|
|
|
418d1b5 |
sed -e "s/27017/$port/" phpunit.xml.dist >phpunit.xml
|
|
|
418d1b5 |
cat << 'EOF' | tee tests/bootstrap.php
|
|
|
418d1b5 |
|
|
|
418d1b5 |
// Library
|
|
|
418d1b5 |
require_once '%{buildroot}%{_datadir}/php/%{psr0}/autoload.php';
|
|
|
418d1b5 |
|
|
|
418d1b5 |
// Test suite
|
|
|
418d1b5 |
require_once '%{_datadir}/php/Symfony/Component/ClassLoader/Psr4ClassLoader.php';
|
|
|
418d1b5 |
$Loader = new \Symfony\Component\ClassLoader\Psr4ClassLoader();
|
|
|
418d1b5 |
$Loader->addPrefix("MongoDB\\Tests\\", __DIR__);
|
|
|
418d1b5 |
$Loader->register();
|
|
|
418d1b5 |
EOF
|
|
|
418d1b5 |
|
|
|
418d1b5 |
: Run the test suite
|
|
|
4e9ca0e |
RET=0
|
|
|
418d1b5 |
%{_bindir}/phpunit --verbose || RET=1
|
|
|
418d1b5 |
|
|
|
418d1b5 |
: Cleanup
|
|
|
418d1b5 |
[ -s server.pid ] && kill $(cat server.pid)
|
|
|
418d1b5 |
|
|
|
418d1b5 |
exit $RET
|
|
|
418d1b5 |
%else
|
|
|
418d1b5 |
: Test suite disabled
|
|
|
418d1b5 |
%endif
|
|
|
418d1b5 |
|
|
|
418d1b5 |
|
|
|
418d1b5 |
%files
|
|
|
418d1b5 |
%{!?_licensedir:%global license %%doc}
|
|
|
418d1b5 |
%license LICENSE
|
|
|
418d1b5 |
%doc composer.json
|
|
|
418d1b5 |
%doc README.md
|
|
|
418d1b5 |
%doc RELEASE-*
|
|
|
418d1b5 |
%doc docs
|
|
|
418d1b5 |
%doc examples
|
|
|
418d1b5 |
%{_datadir}/php/%{psr0}
|
|
|
418d1b5 |
|
|
|
418d1b5 |
|
|
|
418d1b5 |
%changelog
|
|
|
4e1d26b |
* Thu Jul 28 2016 Remi Collet <remi@fedoraproject.org> - 1.0.2-2
|
|
|
4e1d26b |
- only run upstream test suite when build --with tests
|
|
|
4e1d26b |
|
|
|
4e9ca0e |
* Thu Mar 31 2016 Remi Collet <remi@fedoraproject.org> - 1.0.2-1
|
|
|
4e9ca0e |
- update to 1.0.2
|
|
|
4e9ca0e |
|
|
|
418d1b5 |
* Sat Mar 5 2016 Remi Collet <remi@fedoraproject.org> - 1.0.1-1
|
|
|
418d1b5 |
- update to 1.0.1
|
|
|
418d1b5 |
|
|
|
418d1b5 |
* Fri Jan 22 2016 Remi Collet <remi@fedoraproject.org> - 1.0.0-1
|
|
|
418d1b5 |
- update to 1.0.0
|
|
|
418d1b5 |
|
|
|
418d1b5 |
* Mon Jan 4 2016 Remi Collet <remi@fedoraproject.org> - 1.0.0-0.4.beta2
|
|
|
418d1b5 |
- update to 1.0.0beta2
|
|
|
418d1b5 |
- raise dependency on pecl/mongodb ^1.1.1
|
|
|
418d1b5 |
- run test suite with both PHP 5 and 7 when available
|
|
|
418d1b5 |
|
|
|
418d1b5 |
* Tue Nov 3 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-0.3.beta1
|
|
|
418d1b5 |
- update to 1.0.0beta1
|
|
|
418d1b5 |
|
|
|
418d1b5 |
* Mon Nov 2 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-0.2.20151102gita3c0b97
|
|
|
418d1b5 |
- git snapshot
|
|
|
418d1b5 |
|
|
|
418d1b5 |
* Sat Oct 31 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-0.1.alpha1
|
|
|
418d1b5 |
- initial package
|