From 3ce7c5b8331b3e027a2da6afd98d8923e16607d1 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 12 Sep 2019 11:54:28 +0200 Subject: new package --- php-phplang-scope-exit.spec | 116 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 php-phplang-scope-exit.spec (limited to 'php-phplang-scope-exit.spec') diff --git a/php-phplang-scope-exit.spec b/php-phplang-scope-exit.spec new file mode 100644 index 0000000..674e0b8 --- /dev/null +++ b/php-phplang-scope-exit.spec @@ -0,0 +1,116 @@ +# remirepo/fedora spec file for php-phplang-scope-exit +# +# Copyright (c) 2019 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# + +%global with_tests 0%{!?_without_tests:1} +# Github +%global gh_commit 239b73abe89f9414aa85a7ca075ec9445629192b +%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: 1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist} +Summary: Emulation of SCOPE_EXIT construct from C++ + +License: BSD +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 + +Patch0: https://patch-diff.githubusercontent.com/raw/phplang/scope-exit/pull/3.patch + +BuildArch: noarch +%if %{with_tests} +BuildRequires: php(language) +# For tests, from composer.json "require-dev": { +# "phpunit/phpunit": "*", +BuildRequires: php-composer(phpunit/phpunit) +%global phpunit %{_bindir}/phpunit +# 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} +%patch0 -p1 -b .pr3 + + +%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 + - 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 -- cgit