From 910a0f1c467e41557c6c88b10399129ba242778e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 15 May 2017 15:29:26 +0200 Subject: sync with Fedora --- .gitignore | 7 ++++ composer.json | 31 ++++++++++++++++ php-gitter.spec | 112 +++++++++++++++++++++++++++++++++----------------------- 3 files changed, 104 insertions(+), 46 deletions(-) create mode 100644 .gitignore create mode 100644 composer.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..f9a77d3 --- /dev/null +++ b/composer.json @@ -0,0 +1,31 @@ +{ + "name": "klaussilveira/gitter", + "description": "Gitter allows you to interact in an object oriented manner with Git repositories.", + "keywords": ["git", "vcs"], + "homepage": "https://github.com/klaussilveira/gitter", + "type": "library", + "license": "BSD-2-Clause", + "authors": [ + { + "name": "Klaus Silveira", + "email": "klaussilveira@php.net", + "homepage": "http://www.klaussilveira.com/", + "role": "Developer" + } + ], + "require": { + "php": ">=5.3.0", + "symfony/process": ">=2.2" + }, + "require-dev": { + "symfony/filesystem": ">=2.2", + "phpunit/phpunit": ">=3.7.1", + "mockery/mockery": "0.9.1" + }, + "minimum-stability": "stable", + "autoload": { + "psr-0": { + "Gitter": "lib/" + } + } +} 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 +# Copyright (c) 2014-2017 Shawn Iwinski # # 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 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 + 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 - 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 - 0.3.0-5 - Use full require paths in autoloader -- cgit