summaryrefslogtreecommitdiffstats
path: root/php-staabm-side-effects-detector.spec
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2024-12-06 08:50:57 +0100
committerRemi Collet <remi@php.net>2024-12-06 08:50:57 +0100
commit81205f703e346358ff9a26ad03a2b49d7e627aec (patch)
tree6135ef4bf0fe7cfc1dce3478c6bfe40c0279c578 /php-staabm-side-effects-detector.spec
initial package
Diffstat (limited to 'php-staabm-side-effects-detector.spec')
-rw-r--r--php-staabm-side-effects-detector.spec119
1 files changed, 119 insertions, 0 deletions
diff --git a/php-staabm-side-effects-detector.spec b/php-staabm-side-effects-detector.spec
new file mode 100644
index 0000000..94772b4
--- /dev/null
+++ b/php-staabm-side-effects-detector.spec
@@ -0,0 +1,119 @@
+# remirepo/fedora spec file for php-staabm-side-effects-detector
+#
+# SPDX-FileCopyrightText: 2024 Remi Collet
+# SPDX-License-Identifier: CECILL-2.1
+# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+#
+# Please, preserve the changelog entries
+#
+
+%bcond_without tests
+
+%global gh_commit d8334211a140ce329c13726d4a715adbddd0a163
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner staabm
+%global gh_project side-effects-detector
+%global php_home %{_datadir}/php
+%global ns_owner staabm
+%global ns_project SideEffectsDetector
+
+Name: php-%{gh_owner}-%{gh_project}
+Version: 1.0.5
+Release: 1%{?dist}
+Summary: A static analysis tool to detect side effects in PHP code
+
+License: MIT
+URL: https://github.com/%{gh_owner}/%{gh_project}
+# git snapshot to get everything, despite .gitattributes
+Source0: %{name}-%{version}-%{gh_short}.tgz
+Source1: makesrc.sh
+
+BuildArch: noarch
+%if %{with tests}
+BuildRequires: php(language) >= 7.4
+BuildRequires: php-tokenizer
+# From composer.json, "require-dev": {
+# "phpstan/extension-installer": "^1.4.3",
+# "phpstan/phpstan": "^1.12.6",
+# "phpunit/phpunit": "^9.6.21",
+# "symfony/var-dumper": "^5.4.43",
+# "tomasvotruba/type-coverage": "1.0.0",
+# "tomasvotruba/unused-public": "1.0.0"
+BuildRequires: phpunit9 >= 9.6.21
+%endif
+# Autoloader
+BuildRequires: php-fedora-autoloader-devel
+
+# From composer.json, "require": {
+# "php": "^7.4 || ^8.0",
+# "ext-tokenizer": "*"
+Requires: php(language) >= 7.4
+Requires: php-tokenizer
+# From phpcompatinfo report for version 1.0.5
+#nothing
+# Autoloader
+Requires: php-composer(fedora/autoloader)
+
+Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version}
+
+
+%description
+Analyzes php-code for side-effects.
+
+When code has no side-effects it can e.g. be used with eval($code)
+in the same process without interfering.
+
+Side-effects are classified into categories to filter them more easily
+depending on your use-case.
+
+This library is used e.g. in PHPUnit to improve performance of PHPT test-cases.
+
+Autoloader: %{php_home}/%{ns_owner}/%{ns_project}/autoload.php
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+
+%build
+: Generate autoloader
+phpab --template fedora --output lib/autoload.php lib
+
+
+%install
+: Library
+mkdir -p %{buildroot}%{php_home}/%{ns_owner}
+cp -pr lib %{buildroot}%{php_home}/%{ns_owner}/%{ns_project}
+
+
+%check
+%if %{with tests}
+mkdir vendor
+cat << 'EOF' | tee vendor/autoload.php
+<?php
+require_once '%{buildroot}%{php_home}/%{ns_owner}/%{ns_project}/autoload.php';
+EOF
+
+ret=0
+for cmd in php php81 php82 php83 php84; do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit9 --no-coverage || ret=1
+ fi
+done
+exit $ret
+%else
+: Test suite disabled
+%endif
+
+
+%files
+%license LICENSE
+%doc composer.json
+%doc *.md
+%dir %{php_home}/%{ns_owner}
+ %{php_home}/%{ns_owner}/%{ns_project}
+
+
+%changelog
+* Fri Dec 6 2024 Remi Collet <remi@remirepo.net> - 1.0.5-1
+- initial package