summaryrefslogtreecommitdiffstats
path: root/php-gitter.spec
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-05-15 15:29:26 +0200
committerRemi Collet <remi@remirepo.net>2017-05-15 15:29:26 +0200
commit910a0f1c467e41557c6c88b10399129ba242778e (patch)
tree7abb2a316b8d353528cfa8aa8fb078fb9e17daea /php-gitter.spec
parentfe02d1bc0dde123e6be55f5c7808251a32ff3669 (diff)
sync with FedoraHEADmaster
Diffstat (limited to 'php-gitter.spec')
-rw-r--r--php-gitter.spec112
1 files changed, 66 insertions, 46 deletions
diff --git a/php-gitter.spec b/php-gitter.spec
index 604087e..984b575 100644
--- a/php-gitter.spec
+++ b/php-gitter.spec
@@ -1,8 +1,8 @@
# remirepo spec file for php-gitter, from Fedora:
#
-# RPM spec file for php-gitter
+# Fedora spec file for php-gitter
#
-# Copyright (c) 2014-2015 Shawn Iwinski <shawn.iwinski@gmail.com>
+# Copyright (c) 2014-2017 Shawn Iwinski <shawn.iwinski@gmail.com>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -19,9 +19,16 @@
%global composer_project gitter
# "php": ">=5.3.0"
-%global php_min_ver 5.3.0
-# "symfony/*": ">=2.2"
-%global symfony_min_ver 2.2
+%global php_min_ver 5.3.0
+# "symfony/process": ">=2.2"
+# "symfony/filesystem": ">=2.2"
+# NOTE: Min version not 2.2 because autoloader required
+%global symfony_min_ver 2.7.1
+%global symfony_max_ver 3.0
+# "mockery/mockery": "0.9.1"
+%global mockery_min_ver 0.9.1
+%global mockery_max_ver 1.0
+
# Build using "--without tests" to disable tests
%global with_tests 0%{!?_without_tests:1}
@@ -30,7 +37,7 @@
Name: php-%{composer_project}
Version: %{github_version}
-Release: 5%{?github_release}%{?dist}
+Release: 8%{?github_release}%{?dist}
Summary: Object oriented interaction with Git repositories
Group: Development/Libraries
@@ -42,37 +49,45 @@ Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{githu
# https://github.com/klaussilveira/gitter/pull/47
Patch0: %{name}-pr47.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# Tests
%if %{with_tests}
BuildRequires: git
## composer.json
-BuildRequires: %{_bindir}/phpunit
-BuildRequires: php(language) >= %{php_min_ver}
+BuildRequires: php(language) >= %{php_min_ver}
+%if 0
+BuildRequires: php-deepend-Mockery < %{mockery_max_ver}
+BuildRequires: php-deepend-Mockery >= %{mockery_min_ver}
+%else
+BuildRequires: php-composer(mockery/mockery) < %{mockery_max_ver}
+BuildRequires: php-composer(mockery/mockery) >= %{mockery_min_ver}
+%endif
+BuildRequires: php-composer(phpunit/phpunit)
+BuildRequires: php-composer(symfony/filesystem) < %{symfony_max_ver}
BuildRequires: php-composer(symfony/filesystem) >= %{symfony_min_ver}
-BuildRequires: php-composer(symfony/process) >= %{symfony_min_ver}
-BuildRequires: php-deepend-Mockery
+BuildRequires: php-composer(symfony/process) < %{symfony_max_ver}
+BuildRequires: php-composer(symfony/process) >= %{symfony_min_ver}
## phpcompatinfo (computed from version 0.3.0)
BuildRequires: php-date
BuildRequires: php-pcre
BuildRequires: php-reflection
BuildRequires: php-spl
## Autoloader
-BuildRequires: php-composer(symfony/class-loader)
+BuildRequires: php-composer(fedora/autoloader)
%endif
Requires: git
# composer.json
-Requires: php(language) >= %{php_min_ver}
+Requires: php(language) >= %{php_min_ver}
Requires: php-composer(symfony/process) >= %{symfony_min_ver}
+Requires: php-composer(symfony/process) < %{symfony_max_ver}
# phpcompatinfo (computed from version 0.3.0)
Requires: php-date
Requires: php-pcre
Requires: php-reflection
Requires: php-spl
# Autoloader
-Requires: php-composer(symfony/class-loader)
+Requires: php-composer(fedora/autoloader)
# Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming
Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release}
@@ -88,6 +103,8 @@ Most commands are sent to the system's git command, parsed and then interpreted
by Gitter. Everything is transparent to you, so you don't have to worry about a
thing.
+Autoloader: %{phpdir}/Gitter/autoload.php
+
%prep
%setup -qn %{github_name}-%{github_commit}
@@ -96,65 +113,63 @@ thing.
: https://github.com/klaussilveira/gitter/pull/47
%patch0 -p1
+
+%build
+
: Create autoloader
cat <<'AUTOLOAD' | tee lib/Gitter/autoload.php
<?php
/**
* Autoloader for %{name} and its' dependencies
- *
- * Created by %{name}-%{version}-%{release}
- *
- * @return \Symfony\Component\ClassLoader\ClassLoader
+ * (created by %{name}-%{version}-%{release}).
*/
+require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
-if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
- if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
- require_once '%{phpdir}/Symfony/Component/ClassLoader/ClassLoader.php';
- }
-
- $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
- $fedoraClassLoader->register();
-}
-
-$fedoraClassLoader->addPrefix('Gitter\\', dirname(__DIR__));
-
-// Not all dependency autoloaders exist or are in every dist yet so fallback
-// to using include path for dependencies for now
-$fedoraClassLoader->setUseIncludePath(true);
+\Fedora\Autoloader\Autoload::addPsr4('Gitter\\', __DIR__);
-return $fedoraClassLoader;
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{phpdir}/Symfony/Component/Process/autoload.php',
+));
AUTOLOAD
-%build
-# Empty build section, nothing required
-
-
%install
-rm -rf %{buildroot}
mkdir -p %{buildroot}/%{phpdir}
cp -rp lib/* %{buildroot}/%{phpdir}/
%check
%if %{with_tests}
+: Create tests bootstrap
+cat <<'BOOTSTRAP' | tee bootstrap.php
+<?php
+require_once '%{buildroot}%{phpdir}/Gitter/autoload.php';
+
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{phpdir}/Mockery/autoload.php',
+ '%{phpdir}/Symfony/Component/Filesystem/autoload.php',
+));
+BOOTSTRAP
+
: Always run all tests
sed '/stopOnFailure/d' phpunit.xml.dist > phpunit.xml
-: Run tests
-%{_bindir}/phpunit --verbose \
- --bootstrap %{buildroot}/%{phpdir}/Gitter/autoload.php
+: Upstream tests
+RETURN_CODE=0
+PHPUNIT=$(which phpunit)
+for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do
+ if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
+ $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php \
+ || RETURN_CODE=1
+ fi
+done
+exit $RETURN_CODE
%else
: Tests skipped
%endif
-%clean
-rm -rf %{buildroot}
-
-
%files
-%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *.md
@@ -163,6 +178,11 @@ rm -rf %{buildroot}
%changelog
+* Sun May 14 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.3.0-8
+- Switch autoloader to php-composer(fedora/autoloader)
+- Add max versions to build dependencies
+- Test with SCLs if available
+
* Sat Jul 11 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.3.0-5
- Use full require paths in autoloader