diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | php-league-climate.spec | 87 |
2 files changed, 46 insertions, 48 deletions
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/php-league-climate.spec b/php-league-climate.spec index d7059d9..cadec15 100644 --- a/php-league-climate.spec +++ b/php-league-climate.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-league-climate # -# Copyright (c) 2016 Shawn Iwinski <shawn@iwin.ski> +# Copyright (c) 2016-2017 Shawn Iwinski <shawn@iwin.ski> # # License: MIT # http://opensource.org/licenses/MIT @@ -39,7 +39,7 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 3%{?github_release}%{?dist} Summary: Allows you to easily output colored text, special formats, and more Group: Development/Libraries @@ -51,16 +51,18 @@ URL: http://climate.thephpleague.com/ Source0: %{name}-%{github_version}-%{github_commit}.tar.gz Source1: %{name}-get-source.sh -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # Tests %if %{with_tests} ## composer.json -BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(mikey179/vfsStream) < %{vfsstream_max_ver} BuildRequires: php-composer(mikey179/vfsStream) >= %{vfsstream_min_ver} -BuildRequires: php-composer(mockery/mockery) >= %{mockery_min_ver} +BuildRequires: php-composer(mockery/mockery) < %{mockery_max_ver} +BuildRequires: php-composer(mockery/mockery) >= %{mockery_min_ver} BuildRequires: php-composer(phpunit/phpunit) -BuildRequires: php-composer(seld/cli-prompt) >= %{seld_cli_prompt_min_ver} +BuildRequires: php-composer(seld/cli-prompt) < %{seld_cli_prompt_max_ver} +BuildRequires: php-composer(seld/cli-prompt) >= %{seld_cli_prompt_min_ver} ## phpcompatinfo (computed from version 3.2.1) BuildRequires: php-json BuildRequires: php-mbstring @@ -69,11 +71,11 @@ BuildRequires: php-posix BuildRequires: php-reflection BuildRequires: php-zlib ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json -Requires: php(language) >= %{php_min_ver} +Requires: php(language) >= %{php_min_ver} Requires: php-composer(seld/cli-prompt) >= %{seld_cli_prompt_min_ver} Requires: php-composer(seld/cli-prompt) < %{seld_cli_prompt_max_ver} # phpcompatinfo (computed from version 3.2.1) @@ -84,7 +86,7 @@ Requires: php-posix Requires: php-reflection Requires: php-zlib # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -101,81 +103,65 @@ Autoloader: %{phpdir}/League/CLImate/autoload.php %prep %setup -qn %{github_name}-%{github_commit} + +%build + : Create autoloader cat <<'AUTOLOAD' | tee src/autoload.php <?php /** * Autoloader for %{name} and its' dependencies * (created by %{name}-%{version}-%{release}). - * - * @return \Symfony\Component\ClassLoader\ClassLoader */ +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(); -} +\Fedora\Autoloader\Autoload::addPsr4('League\\CLImate\\', __DIR__); -$fedoraClassLoader->addPrefix('League\\CLImate\\', dirname(dirname(__DIR__))); - -// Required dependencies -require_once '%{phpdir}/Seld/CliPrompt/autoload.php'; - -return $fedoraClassLoader; +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Seld/CliPrompt/autoload.php', +)); AUTOLOAD -%build -# Empty build section, nothing to build - - %install -rm -rf %{buildroot} - mkdir -p %{buildroot}%{phpdir}/League/CLImate cp -rp src/* %{buildroot}%{phpdir}/League/CLImate/ %check %if %{with_tests} -: Make PSR-0 tests -mkdir -p tests-psr0/League/CLImate -ln -s ../../../tests tests-psr0/League/CLImate/Tests - : Create tests bootstrap cat <<'BOOTSTRAP' | tee bootstrap.php <?php require_once '%{buildroot}%{phpdir}/League/CLImate/autoload.php'; -$fedoraClassLoader->addPrefix('League\\CLImate\\Tests\\', __DIR__.'/tests-psr0'); +\Fedora\Autoloader\Autoload::addPsr4('League\\CLImate\\Tests\\', __DIR__.'/tests'); -require_once '%{phpdir}/Mockery/autoload.php'; -require_once '%{phpdir}/org/bovigo/vfs/autoload.php'; +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Mockery/autoload.php', + '%{phpdir}/org/bovigo/vfs/autoload.php', +)); BOOTSTRAP : Remove Composer vendor file load sed '/require.*vendor\/mikey179/d' -i tests/FileTest.php -%{_bindir}/phpunit --verbose --bootstrap bootstrap.php - -if which php70; then - php70 %{_bindir}/phpunit --verbose --bootstrap bootstrap.php -fi +: Upstream tests +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in "" %{?rhel:php55} php56 php70 php71; 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.md %doc CHANGELOG.md @@ -186,6 +172,11 @@ rm -rf %{buildroot} %changelog +* Mon May 15 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 3.2.1-3 +- Switch autoloader to php-composer(fedora/autoloader) +- Add max versions to build dependencies +- Test with SCLs if available + * Fri Apr 15 2016 Remi Collet <remi@remirepo.net> - 3.2.1-1 - backport for remi repository |