From ab11475328215f1a051201a67966dec11144de35 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 7 Jun 2017 09:25:37 +0200 Subject: sync with Fedora --- .gitignore | 7 ++++++ composer.json | 27 +++++++++++++++++++++ php-PhpOption.spec | 71 +++++++++++++++++++++++++++--------------------------- 3 files changed, 69 insertions(+), 36 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..553a375 --- /dev/null +++ b/composer.json @@ -0,0 +1,27 @@ +{ + "name": "phpoption/phpoption", + "description": "Option Type for PHP", + "keywords": ["php","option","language","type"], + "type": "library", + "license": "Apache2", + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.7.*" + }, + "autoload": { + "psr-0": { "PhpOption\\": "src/" } + }, + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + } +} diff --git a/php-PhpOption.spec b/php-PhpOption.spec index 63a8ed4..88a9889 100644 --- a/php-PhpOption.spec +++ b/php-PhpOption.spec @@ -1,8 +1,8 @@ # remirepo spec file for php-PhpOption, from Fedora: # -# RPM spec file for php-PhpOption +# Fedora spec file for php-PhpOption # -# Copyright (c) 2013-2015 Shawn Iwinski +# Copyright (c) 2013-2017 Shawn Iwinski # # License: MIT # http://opensource.org/licenses/MIT @@ -28,7 +28,7 @@ Name: php-PhpOption Version: %{github_version} -Release: 1%{?dist} +Release: 2%{?dist} Summary: Option type for PHP Group: Development/Libraries @@ -36,17 +36,16 @@ License: ASL 2.0 URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # Tests %if %{with_tests} -BuildRequires: php-composer(phpunit/phpunit) >= 4.7 +BuildRequires: php-composer(phpunit/phpunit) ## composer.json BuildRequires: php(language) >= %{php_min_ver} ## phpcompatinfo (computed from version 1.5.0) BuildRequires: php-spl ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json @@ -54,7 +53,7 @@ Requires: php(language) >= %{php_min_ver} # phpcompatinfo (computed from version 1.5.0) 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} @@ -83,56 +82,51 @@ make your code more robust. On the other hand, the Option type also allows the API developer to provide more concise API methods, and empowers the API user in how he consumes these methods. +Autoloader: %{phpdir}/PhpOption/autoload.php + %prep %setup -qn %{github_name}-%{github_commit} + +%build : Create autoloader cat <<'AUTOLOAD' | tee src/PhpOption/autoload.php register(); -} - -$fedoraClassLoader->addPrefix('PhpOption\\', dirname(__DIR__)); - -return $fedoraClassLoader; +\Fedora\Autoloader\Autoload::addPsr4('PhpOption\\', __DIR__); AUTOLOAD -%build -# Empty build section, nothing to build - - %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{phpdir} -cp -rp src/* %{buildroot}%{phpdir}/ +cp -rp src/PhpOption %{buildroot}%{phpdir}/ %check -%{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/PhpOption/autoload.php - - -%clean -rm -rf %{buildroot} +%if %{with_tests} +: 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 %{buildroot}%{phpdir}/PhpOption/autoload.php \ + || RETURN_CODE=1 + fi +done +exit $RETURN_CODE +%else +: Tests skipped +%endif %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc *.md @@ -141,7 +135,12 @@ rm -rf %{buildroot} %changelog -* Tue Sep 22 2015 Remi Collet 1.4.0-1 +* Sun Jun 04 2017 Shawn Iwinski - 1.5.0-1 +- Updated to 1.5.0 +- Switched autoloader to php-composer(fedora/autoloader) +- Test with SCLs if available + +* Tue Sep 22 2015 Remi Collet 1.5.0-1 - update to 1.5.0 * Sat Jul 11 2015 Shawn Iwinski - 1.4.0-4 -- cgit