diff options
author | Remi Collet <remi@remirepo.net> | 2017-05-14 17:58:58 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-05-14 17:58:58 +0200 |
commit | 71195395d5d5808978db68a75050f11b9708ea31 (patch) | |
tree | b4275bfcda265e1f5b41f3a5412ef3bcff645b25 | |
parent | d50da2890ae3647550e05a2e0449d5a83caedd39 (diff) |
sync with Fedora
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | composer.json | 31 | ||||
-rwxr-xr-x | php-doctrine-annotations-get-source.sh | 4 | ||||
-rw-r--r-- | php-doctrine-annotations.spec | 78 |
4 files changed, 79 insertions, 41 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..1c65f6c --- /dev/null +++ b/composer.json @@ -0,0 +1,31 @@ +{ + "name": "doctrine/annotations", + "type": "library", + "description": "Docblock Annotations Parser", + "keywords": ["annotations", "docblock", "parser"], + "homepage": "http://www.doctrine-project.org", + "license": "MIT", + "authors": [ + {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, + {"name": "Roman Borschel", "email": "roman@code-factory.org"}, + {"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"}, + {"name": "Jonathan Wage", "email": "jonwage@gmail.com"}, + {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} + ], + "require": { + "php": ">=5.3.2", + "doctrine/lexer": "1.*" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "4.*" + }, + "autoload": { + "psr-0": { "Doctrine\\Common\\Annotations\\": "lib/" } + }, + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + } +} diff --git a/php-doctrine-annotations-get-source.sh b/php-doctrine-annotations-get-source.sh index e283587..f8f69e8 100755 --- a/php-doctrine-annotations-get-source.sh +++ b/php-doctrine-annotations-get-source.sh @@ -37,6 +37,8 @@ print "GIT_REPO = $GIT_REPO" print "GIT_DIR = $GIT_DIR" TEMP_DIR=$(mktemp --dir) +TAR_FILE=$PWD/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz +CMP_FILE=$PWD/composer.json pushd $TEMP_DIR print "Cloning git repo..." @@ -45,6 +47,7 @@ pushd $TEMP_DIR pushd $GIT_DIR print "Checking out commit..." $GIT checkout $GIT_COMMIT + cp composer.json $CMP_FILE popd TAR_DIR=${GIT_NAME}-${GIT_COMMIT} @@ -52,7 +55,6 @@ pushd $TEMP_DIR mv $GIT_DIR $TAR_DIR - TAR_FILE=`$RPM --eval='%{_sourcedir}'`/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz print "TAR_FILE = $TAR_FILE" [ -e $TAR_FILE ] && rm -f $TAR_FILE diff --git a/php-doctrine-annotations.spec b/php-doctrine-annotations.spec index c255ca3..430b1fd 100644 --- a/php-doctrine-annotations.spec +++ b/php-doctrine-annotations.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-doctrine-annotations # -# 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 @@ -36,7 +36,7 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 4%{?github_release}%{?dist} Summary: PHP docblock annotations parser library Group: Development/Libraries @@ -48,14 +48,15 @@ URL: https://github.com/%{github_owner}/%{github_name} Source0: %{name}-%{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: %{_bindir}/phpunit -BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(doctrine/cache) < %{cache_max_ver} BuildRequires: php-composer(doctrine/cache) >= %{cache_min_ver} +BuildRequires: php-composer(phpunit/phpunit) +BuildRequires: php-composer(doctrine/lexer) < %{lexer_max_ver} #BuildRequires: php-composer(doctrine/lexer) >= %%{lexer_min_ver} BuildRequires: php-doctrine-lexer >= %{lexer_min_ver} ## phpcompatinfo (computed from version 1.2.7) @@ -67,11 +68,11 @@ BuildRequires: php-reflection BuildRequires: php-spl BuildRequires: php-tokenizer # 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(doctrine/lexer) >= %%{lexer_min_ver} Requires: php-doctrine-lexer >= %{lexer_min_ver} Requires: php-composer(doctrine/lexer) < %{lexer_max_ver} @@ -84,7 +85,7 @@ Requires: php-reflection Requires: php-spl Requires: php-tokenizer # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -95,42 +96,32 @@ Conflicts: php-pear(pear.doctrine-project.org/DoctrineCommon) < 2.4 %description %{summary} (extracted from Doctrine Common). +Autoloader: %{phpdir}/Doctrine/Common/Annotations/autoload.php + %prep %setup -qn %{github_name}-%{github_commit} + +%build : Create autoloader cat <<'AUTOLOAD' | tee lib/Doctrine/Common/Annotations/autoload.php <?php /** - * Autoloader created by %{name}-%{version}-%{release} - * - * @return \Symfony\Component\ClassLoader\ClassLoader + * Autoloader for %{name} and its' dependencies + * (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(); -} +\Fedora\Autoloader\Autoload::addPsr4('Doctrine\\Common\\Annotations\\', __DIR__); -$fedoraClassLoader->addPrefix('Doctrine\\Common\\Annotations\\', dirname(dirname(dirname(__DIR__)))); - -require_once '%{phpdir}/Doctrine/Common/Lexer/autoload.php'; - -return $fedoraClassLoader; +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Doctrine/Common/Lexer/autoload.php', +)); AUTOLOAD -%build -# Empty build section, nothing required - - %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{phpdir} cp -rp lib/* %{buildroot}%{phpdir}/ @@ -144,26 +135,28 @@ sed "s#require.*autoload.*#require_once '%{buildroot}%{phpdir}/Doctrine/Common/A : Create tests bootstrap cat <<'BOOTSTRAP' | tee bootstrap.php <?php - require_once '%{phpdir}/Doctrine/Common/Cache/autoload.php'; -require_once __DIR__ . '/tests/Doctrine/Tests/TestInit.php'; +require_once __DIR__.'/tests/Doctrine/Tests/TestInit.php'; BOOTSTRAP -: Run tests -%{_bindir}/phpunit \ - -d pcre.recursion_limit=10000 \ - --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 \ + -d pcre.recursion_limit=10000 \ + --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 @@ -172,6 +165,11 @@ rm -rf %{buildroot} %changelog +* Fri May 12 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.7-4 +- Switch autoloader to php-composer(fedora/autoloader) +- Add max versions to build dependencies +- Test with SCLs if available + * Sat Sep 05 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.7-1 - Updated to 1.2.7 (RHBZ #1258669 / CVE-2015-5723) - Updated autoloader to load dependencies after self registration |