blob: 754ee45c21ab95cdc25de36e74be5b1860d88978 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
# remirepo/fedora spec file for php-phplang-scope-exit
#
# SPDX-FileCopyrightText: Copyright 2019-2024 Remi Collet
# SPDX-License-Identifier: CECILL-2.1
# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
#
# Please, preserve the changelog entries
#
%global with_tests 0%{!?_without_tests:1}
# Github
%global gh_commit 8b5a1cbc54df7c1d14916711fb339e67d08cb3dd
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner phplang
%global gh_project scope-exit
# Packagist
%global pk_vendor %{gh_owner}
%global pk_project %{gh_project}
# Namespace
%global ns_vendor PhpLang
%global ns_project %nil
%global major %nil
Name: php-%{pk_vendor}-%{pk_project}%{major}
Version: 1.0.0
Release: 13%{?gh_date?%{gh_date}git%{gh_short}}%{?dist}
Summary: Emulation of SCOPE_EXIT construct from C++
License: BSD-3-Clause
URL: https://github.com/%{gh_owner}/%{gh_project}
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{?gh_short}.tar.gz
BuildArch: noarch
%if %{with_tests}
BuildRequires: php(language)
# For tests, from composer.json "require-dev": {
# "phpunit/phpunit": "*",
BuildRequires: phpunit10
%global phpunit %{_bindir}/phpunit10
# For autoloader
BuildRequires: php-fedora-autoloader-devel
%endif
Requires: php(language)
# From phpcompatinfo report for 1.0.3
# only Core
# For generated autoloader
Requires: php-composer(fedora/autoloader)
# Composer
Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
%description
This simple class provides an implementation of C++'s SCOPE_EXIT, or GoLang's
defer.
To use, assign an instance of this object to a local variable. When that
variable falls out of scope (or is explicitly unset), the callback passed
to the constructor will be invoked. This is useful, for example, to aid
cleanup at the end of a function.
Autoloader: %{_datadir}/php/%{ns_vendor}/%{pk_project}-autoload.php
%prep
%setup -q -n %{gh_project}-%{gh_commit}
%build
%{_bindir}/phpab -t fedora -o src/%{pk_project}-autoload.php src
%install
: Library
mkdir -p %{buildroot}%{_datadir}/php
cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}
%check
%if %{with_tests}
mkdir vendor
cat << 'EOF' | tee vendor/autoload.php
<?php
require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{pk_project}-autoload.php';
class_alias('PHPUnit\\Framework\\TestCase', 'PHPUnit_Framework_TestCase');
EOF
ret=0
for cmd in php php81 php82 php83 php84; do
if which $cmd; then
$cmd %{phpunit} \
--do-not-cache-result \
--no-coverage \
--no-configuration \
. || ret=1
fi
done
exit $ret
%else
: Test suite disabled
%endif
%files
# remirepo:1
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc composer.json
%doc README.md
%{_datadir}/php/%{ns_vendor}
%changelog
* Mon Dec 23 2024 Remi Collet <remi@remirepo.net> - 1.0.0-13
- re-license spec file to CECILL-2.1
* Wed Jan 31 2024 Remi Collet <remi@remirepo.net> - 1.0.0-12
- switch to phpunit10, fix FTBFS #2261502
* Thu Sep 19 2019 Remi Collet <remi@remirepo.net> - 1.0.0-2
- add commit to include LICENSE file (no change)
* Thu Sep 12 2019 Remi Collet <remi@remirepo.net> - 1.0.0-1
- initial package
- open https://github.com/phplang/scope-exit/issues/2 missing LICENSE
- open https://github.com/phplang/scope-exit/pull/3 add LICENSE
|