summaryrefslogtreecommitdiffstats
path: root/php-evenement.spec
diff options
context:
space:
mode:
Diffstat (limited to 'php-evenement.spec')
-rw-r--r--php-evenement.spec100
1 files changed, 67 insertions, 33 deletions
diff --git a/php-evenement.spec b/php-evenement.spec
index 1768bbc..dc72f27 100644
--- a/php-evenement.spec
+++ b/php-evenement.spec
@@ -7,28 +7,55 @@
#
# Please preserve changelog entries
#
-Name: php-evenement
-Version: 2.1.0
-Release: 1%{?dist}
-BuildArch: noarch
-
-License: MIT
-Summary: Événement is a very simple event dispatching library for PHP
-URL: https://github.com/igorw/evenement
-Source0: %{url}/archive/v%{version}.tar.gz
-
-BuildRequires: php-composer(phpunit/phpunit)
+%global github_owner igorw
+%global github_name evenement
+%global github_version 3.0.1
+%global github_commit 531bfb9d15f8aa57454f5f0285b18bec903b8fb7
+
+%global composer_vendor evenement
+%global composer_project evenement
+
+# "php": ">=7.0"
+%global php_min_ver 7.0
+
+# Build using "--without tests" to disable tests
+%global with_tests 0%{!?_without_tests:1}
+
+%{!?phpdir: %global phpdir %{_datadir}/php}
+
+Name: php-%{composer_project}
+Epoch: 1
+Version: %{github_version}
+Release: 1%{?github_release}%{?dist}
+
+License: MIT
+Summary: Événement is a very simple event dispatching library for PHP
+URL: https://github.com/%{github_owner}/%{github_name}
+Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
+
+BuildArch: noarch
+# Tests
+%if %{with_tests}
+## composer.json
+BuildRequires: php(language) >= %{php_min_ver}
+BuildRequires: phpunit6
+## phpcompatinfo (computed from version 3.0.1)
+## <none>
+## Autoloader
BuildRequires: php-composer(fedora/autoloader)
-# phpcompatinfo (computed from version 2.1.0)
-# <none>
+%endif
-Requires: php(language) >= 5.4.0
-# This is for the autoloader
-Requires: php-composer(fedora/autoloader)
-# phpcompatinfo (computed from version 2.1.0)
+# composer.json
+Requires: php(language) >= %{php_min_ver}
+# phpcompatinfo (computed from version 3.0.1)
# <none>
+# Autoloader
+Requires: php-composer(fedora/autoloader)
-Provides: php-composer(evenement/evenement) = %{version}
+# Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming
+Provides: php-%{composer_vendor}-%{composer_project} = %{epoch}:%{version}-%{release}
+# Composer
+Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
%description
@@ -43,7 +70,7 @@ Autoloader: %{_datadir}/php/Evenement/autoload.php
%prep
-%setup -q -n evenement-%{version}
+%setup -qn %{github_name}-%{github_commit}
%build
@@ -54,21 +81,21 @@ cat <<'AUTOLOAD' | tee src/Evenement/autoload.php
* Autoloader for %{name} and its' dependencies
* (created by %{name}-%{version}-%{release}).
*/
-require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';
+require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('Evenement\\', __DIR__);
AUTOLOAD
%install
-install -d -p -m 0755 %{buildroot}/%{_datadir}/php
-
-cp -a -r src/Evenement %{buildroot}/%{_datadir}/php/
+mkdir -p %{buildroot}%{phpdir}
+cp -rp src/Evenement %{buildroot}%{phpdir}/
%check
-: Create tests autoloader
-cat <<'AUTOLOAD' | tee autoload.php
+%if %{with_tests}
+: Create tests bootstrap
+cat <<'BOOTSTRAP' | tee bootstrap.php
<?php
require_once '%{buildroot}%{_datadir}/php/Evenement/autoload.php';
@@ -77,30 +104,37 @@ require_once '%{buildroot}%{_datadir}/php/Evenement/autoload.php';
\Fedora\Autoloader\Dependencies::required([
__DIR__.'/tests/Evenement/Tests/functions.php'
]);
-AUTOLOAD
-
-phpunit --bootstrap autoload.php
+BOOTSTRAP
: Upstream tests
RETURN_CODE=0
-PHPUNIT=$(which phpunit)
-for PHP_EXEC in "" %{?rhel:php55} php56 php70 php71 php72; do
+PHPUNIT=$(which phpunit6)
+for PHP_EXEC in "" php71 php72 php73 php74; do
if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
- $PHP_EXEC $PHPUNIT --verbose --bootstrap autoload.php \
+ $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php \
|| RETURN_CODE=1
fi
done
exit $RETURN_CODE
+%else
+: Tests skipped
+%endif
%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
-%doc CHANGELOG.md composer.json README.md
-%{_datadir}/php/Evenement
+%doc *.md
+%doc composer.json
+%doc doc
+%{phpdir}/Evenement
%changelog
+* Sat Dec 14 2019 Shawn Iwinski <shawn@iwin.ski> - 1:3.0.1-1
+- Update to 3.0.1 (RHBZ #1480022)
+- Use PHPUnit 6
+
* Sun Sep 10 2017 Shawn Iwinski <shawn@iwin.ski> - 2.1.0-1
- Update to 2.1.0
- Remove now unneeded patch