diff options
author | Remi Collet <remi@remirepo.net> | 2017-06-07 09:20:31 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-06-07 09:20:31 +0200 |
commit | 24ec0374fae9ce21ca1805b4593e1fb69a654f21 (patch) | |
tree | c8f2617be404833fa7eadbbb8ca17eb47168dff2 | |
parent | 543a04b77fc60c80bd65886ea16ff40df8bc54fe (diff) |
v1.6.0 (backported from Fedora)
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | composer.json | 28 | ||||
-rw-r--r-- | php-Metadata.spec | 104 |
3 files changed, 83 insertions, 56 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/composer.json b/composer.json new file mode 100644 index 0000000..58dec88 --- /dev/null +++ b/composer.json @@ -0,0 +1,28 @@ +{ + "name": "jms/metadata", + "description": "Class/method/property metadata management in PHP", + "keywords": ["annotations","metadata","yaml","xml"], + "type": "library", + "license": "Apache-2.0", + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "require": { + "php": ">=5.3.0" + }, + "require-dev" : { + "doctrine/cache" : "~1.0", + "symfony/cache" : "~3.1" + }, + "autoload": { + "psr-0": { "Metadata\\": "src/" } + }, + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + } +} diff --git a/php-Metadata.spec b/php-Metadata.spec index d36ea5b..1201fea 100644 --- a/php-Metadata.spec +++ b/php-Metadata.spec @@ -1,8 +1,8 @@ # remirepo spec file for php-Metadata, from Fedora: # -# RPM spec file for php-Metadata +# Fedora spec file for php-Metadata # -# Copyright (c) 2013-2015 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2013-2017 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -12,8 +12,8 @@ %global github_owner schmittjoh %global github_name metadata -%global github_version 1.5.1 -%global github_commit 22b72455559a25777cfd28c4ffda81ff7639f353 +%global github_version 1.6.0 +%global github_commit 6a06970a10e0a532fb52d3959547123b84a3b3ab %global composer_vendor jms %global composer_project metadata @@ -32,43 +32,43 @@ Name: php-Metadata Version: %{github_version} -Release: 3%{?github_release}%{?dist} -Summary: A library for class/method/property metadata management in PHP +Release: 1%{?github_release}%{?dist} +Summary: Class/method/property metadata management in PHP Group: Development/Libraries 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: %{_bindir}/phpunit -BuildRequires: php-composer(symfony/dependency-injection) +BuildRequires: php-composer(phpunit/phpunit) ## composer.json -BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-composer(doctrine/cache) >= %{doctrine_cache_min_ver} -BuildRequires: php-composer(doctrine/cache) < %{doctrine_cache_max_ver} -## phpcompatinfo (computed from version 1.5.1) +BuildRequires: php(language) >= %{php_min_ver} +## phpcompatinfo (computed from version 1.6.0) BuildRequires: php-date BuildRequires: php-reflection BuildRequires: php-spl ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif -Requires: php-composer(doctrine/cache) >= %{doctrine_cache_min_ver} -Requires: php-composer(doctrine/cache) < %{doctrine_cache_max_ver} -Requires: php-composer(symfony/dependency-injection) # composer.json Requires: php(language) >= %{php_min_ver} -# phpcompatinfo (computed from version 1.5.1) +# phpcompatinfo (computed from version 1.6.0) Requires: php-date Requires: php-reflection Requires: php-spl # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) + +%if 0%{?fedora} >= 21 +# phpcompatinfo (computed from version 1.6.0) +Suggests: php-composer(doctrine/cache) +Suggests: php-composer(psr/cache) +Suggests: php-composer(symfony/dependency-injection) +%endif # Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release} @@ -83,50 +83,37 @@ sources (annotations, YAML/XML/PHP configuration files). The metadata classes are used to abstract away that source and provide a common interface for all of them. +Autoloader: %{phpdir}/Metadata/autoload.php + %prep %setup -qn %{github_name}-%{github_commit} + +%build : Create autoloader cat <<'AUTOLOAD' | tee src/Metadata/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'; -require_once '%{phpdir}/Doctrine/Common/Cache/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('Metadata\\', dirname(__DIR__)); +\Fedora\Autoloader\Autoload::addPsr4('Metadata\\', __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); - -return $fedoraClassLoader; +\Fedora\Autoloader\Dependencies::optional(array( + '%{phpdir}/Doctrine/Common/Cache/autoload.php', + '%{phpdir}/Psr/Cache/autoload.php', + '%{phpdir}/Symfony/Component/DependencyInjection/autoload.php', +)); AUTOLOAD -%build -# Empty build section, nothing to build - %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{phpdir} -cp -rp src/* %{buildroot}%{phpdir}/ +cp -rp src/Metadata %{buildroot}%{phpdir}/ %check @@ -134,25 +121,25 @@ cp -rp src/* %{buildroot}%{phpdir}/ : Create tests bootstrap cat <<'BOOTSTRAP' | tee bootstrap.php <?php - -$fedoraClassLoader = - require_once '%{buildroot}%{phpdir}/Metadata/autoload.php'; - -$fedoraClassLoader->addprefix('Metadata\\Tests\\', __DIR__ . '/tests'); +require_once '%{buildroot}%{phpdir}/Metadata/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr4('Metadata\\Tests\\', __DIR__.'/tests/Metadata/Tests'); BOOTSTRAP -%{_bindir}/phpunit --verbose --bootstrap ./bootstrap.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 @@ -162,6 +149,11 @@ rm -rf %{buildroot} %changelog +* Sun Jun 04 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.6.0-1 +- Updated to 1.6.0 +- Switched autoloader to php-composer(fedora/autoloader) +- Test with SCLs if available + * Sat Jul 11 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.5.1-3 - Added autoloader - Added standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming provides |