summaryrefslogtreecommitdiffstats
path: root/php-doctrine-lexer.spec
diff options
context:
space:
mode:
Diffstat (limited to 'php-doctrine-lexer.spec')
-rw-r--r--php-doctrine-lexer.spec85
1 files changed, 63 insertions, 22 deletions
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