diff options
author | Remi Collet <remi@remirepo.net> | 2019-08-01 08:20:30 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2019-08-01 08:20:30 +0200 |
commit | 2e4961b1e9735252ea690849ca8af50b5b26c21e (patch) | |
tree | 7dd5fc7370031fc4b9fab24210374ed32ae6e6f0 | |
parent | 078d3a6f6069c955c6c3e6ebf9b047c2a62145c3 (diff) |
- update to 1.1.0
- raise dependency on PHP 7.2
- sources from git snapshot
- run upstream test suite during build
- use classmap autoloader
-rw-r--r-- | composer.json | 41 | ||||
-rwxr-xr-x | makesrc.sh | 28 | ||||
-rw-r--r-- | php-doctrine-lexer.spec | 85 |
3 files changed, 132 insertions, 22 deletions
diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4e82741 --- /dev/null +++ b/composer.json @@ -0,0 +1,41 @@ +{ + "name": "doctrine/lexer", + "type": "library", + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "keywords": [ + "php", + "parser", + "lexer", + "annotations", + "docblock" + ], + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "license": "MIT", + "authors": [ + {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, + {"name": "Roman Borschel", "email": "roman@code-factory.org"}, + {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} + ], + "require": { + "php": "^7.2" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan": "^0.11.8", + "phpunit/phpunit": "^8.2" + }, + "autoload": { + "psr-4": { "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" } + }, + "autoload-dev": { + "psr-4": { "Doctrine\\Tests\\": "tests/Doctrine" } + }, + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "config": { + "sort-packages": true + } +} diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..97be9f6 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +NAME=$(basename $PWD) +OWNER=$(sed -n '/^%global github_owner/{s/.* //;p}' $NAME.spec) +PROJECT=$(sed -n '/^%global github_name/{s/.* //;p}' $NAME.spec) +VERSION=$(sed -n '/^%global github_version/{s/.* //;p}' $NAME.spec) +COMMIT=$(sed -n '/^%global github_commit/{s/.* //;p}' $NAME.spec) +SHORT=${COMMIT:0:7} + +echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n" + +echo "Cloning..." +rm -rf $PROJECT-$COMMIT +git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + +echo "Getting commit..." +pushd $PROJECT-$COMMIT +git checkout $COMMIT +cp composer.json ../composer.json +popd + +echo "Archiving..." +tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs $PROJECT-$COMMIT + +echo "Cleaning..." +rm -rf $PROJECT-$COMMIT + +echo "Done." diff --git a/php-doctrine-lexer.spec b/php-doctrine-lexer.spec index 23f0cb8..1bc482f 100644 --- a/php-doctrine-lexer.spec +++ b/php-doctrine-lexer.spec @@ -9,35 +9,49 @@ # # Please preserve changelog entries # - +# Github %global github_owner doctrine %global github_name lexer -%global github_version 1.0.2 -%global github_commit 1febd6c3ef84253d7c815bed85fc622ad207a9f8 - +%global github_version 1.1.0 +%global github_commit e17f069ede36f7534b95adec71910ed1b49c74ea +%global github_short %(c=%{github_commit}; echo ${c:0:7}) +# Namespace +%global ns_vendor Doctrine +%global ns_project Common +%global ns_subproj Lexer +# Packagist %global composer_vendor doctrine %global composer_project lexer -# "php": ">=5.3.2" -%global php_min_ver 5.3.2 +# "php": ">=7.2" +%global php_min_ver 7.2 %{!?phpdir: %global phpdir %{_datadir}/php} +%global with_tests 0%{!?_without_tests:1} Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} Release: 1%{?github_release}%{?dist} Summary: Base library for a lexer that can be used in top-down, recursive descent parsers -Group: Development/Libraries License: MIT URL: https://github.com/%{github_owner}/%{github_name} -Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz +# git snapshot with tests +Source0: %{name}-%{github_version}-%{github_short}.tgz +Source1: makesrc.sh BuildArch: noarch +BuildRequires: php-fedora-autoloader-devel +%if %{with_tests} +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-pcre +BuildRequires: php-reflection +BuildRequires: phpunit8 +%endif # composer.json Requires: php(language) >= %{php_min_ver} -# phpcompatinfo (computed from version 1.0.1) +# phpcompatinfo (computed from version 1.1.0) Requires: php-pcre Requires: php-reflection # Autoloader @@ -52,7 +66,7 @@ parsers. This lexer is used in Doctrine Annotations and in Doctrine ORM (DQL). -Autoloader: %{phpdir}/Doctrine/Common/Lexer/autoload.php +Autoloader: %{phpdir}/%{ns_vendor}/%{ns_project}/%{ns_subproj}/autoload.php %prep @@ -60,17 +74,11 @@ Autoloader: %{phpdir}/Doctrine/Common/Lexer/autoload.php %build -: Create autoloader -cat <<'AUTOLOAD' | tee lib/Doctrine/Common/Lexer/autoload.php -<?php -/** - * Autoloader for %{name} and its' dependencies - * (created by %{name}-%{version}-%{release}). - */ -require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; - -\Fedora\Autoloader\Autoload::addPsr4('Doctrine\\Common\\Lexer\\', __DIR__); -AUTOLOAD +: Generate a simple autoloader +%{_bindir}/phpab \ + --output lib/%{ns_vendor}/%{ns_project}/%{ns_subproj}/autoload.php \ + --template fedora \ + lib/%{ns_vendor}/%{ns_project} %install @@ -79,7 +87,33 @@ cp -rp lib/* %{buildroot}%{phpdir}/ %check -# No upstream tests +%if %{with_tests} +: Generate autoloader +mkdir vendor +%{_bindir}/phpab \ + --output vendor/autoload.php \ + --template fedora \ + tests + +cat << 'EOF' | tee -a vendor/autoload.php +require "%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/%{ns_subproj}/autoload.php"; +EOF + +# we don't want PHPStan (which pull nette framework) + +: Run test suite +ret=0 +for cmd in php php72 php73 php74; do + if which $cmd; then + $cmd %{_bindir}/phpunit8 \ + --bootstrap vendor/autoload.php \ + --verbose || ret=1 + fi +done +exit $ret +%else +: Test suite disabled +%endif %files @@ -93,6 +127,13 @@ cp -rp lib/* %{buildroot}%{phpdir}/ %changelog +* Thu Aug 1 2019 Remi Collet <remi@remirepo.net> - 1.1.0-1 +- update to 1.1.0 +- raise dependency on PHP 7.2 +- sources from git snapshot +- run upstream test suite during build +- use classmap autoloader + * Tue Jun 11 2019 Remi Collet <remi@remirepo.net> - 1.0.2-1 - update to 1.0.2 |