summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-09-12 11:54:28 +0200
committerRemi Collet <remi@remirepo.net>2019-09-12 11:54:28 +0200
commit3ce7c5b8331b3e027a2da6afd98d8923e16607d1 (patch)
tree5dbd6acf97d9f1566881241f0020e7584895d3e6
new package
-rw-r--r--.gitignore8
-rw-r--r--3.patch47
-rw-r--r--Makefile4
-rw-r--r--composer.json28
-rw-r--r--php-phplang-scope-exit.spec116
5 files changed, 203 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fc9aa8c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+clog
+package-*.xml
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/3.patch b/3.patch
new file mode 100644
index 0000000..7208fb9
--- /dev/null
+++ b/3.patch
@@ -0,0 +1,47 @@
+From 26815e9d3f0169d7d16327f8e034eb64cf6914fc Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 12 Sep 2019 11:25:07 +0200
+Subject: [PATCH] Fix #2 add a BSD license file
+
+---
+ LICENSE | 31 +++++++++++++++++++++++++++++++
+ 1 file changed, 31 insertions(+)
+ create mode 100644 LICENSE
+
+diff --git a/LICENSE b/LICENSE
+new file mode 100644
+index 0000000..fdbb5b7
+--- /dev/null
++++ b/LICENSE
+@@ -0,0 +1,31 @@
++Copyright (c) 2016 by Sara Golemon
++
++Some rights reserved.
++
++Redistribution and use in source and binary forms, with or without
++modification, are permitted provided that the following conditions are
++met:
++
++ * Redistributions of source code must retain the above copyright
++ notice, this list of conditions and the following disclaimer.
++
++ * Redistributions in binary form must reproduce the above
++ copyright notice, this list of conditions and the following
++ disclaimer in the documentation and/or other materials provided
++ with the distribution.
++
++ * The names of the contributors may not be used to endorse or
++ promote products derived from this software without specific
++ prior written permission.
++
++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
++OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
++OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..91b0fd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../common/Makefile
+
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..3b3e223
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,28 @@
+{
+ "name": "phplang/scope-exit",
+ "description": "Emulation of SCOPE_EXIT construct from C++",
+ "type": "library",
+ "keywords": [
+ "cleanup",
+ "scope",
+ "exit"
+ ],
+ "homepage": "https://github.com/phplang/scope-exit",
+ "license": "BSD",
+ "authors": [
+ {
+ "name": "Sara Golemon",
+ "email": "pollita@php.net",
+ "homepage": "https://twitter.com/SaraMG",
+ "role": "Developer"
+ }
+ ],
+ "autoload": {
+ "psr-4": {
+ "PhpLang\\": "src/"
+ }
+ },
+ "require-dev": {
+ "phpunit/phpunit": "*"
+ }
+}
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
+<?php
+require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{pk_project}-autoload.php';
+EOF
+
+ret=0
+for cmd in php php56 php70 php71 php72 php73 php74; do
+ if which $cmd; then
+ $cmd %{phpunit} --no-coverage --verbose . || 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
+* 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