summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-05-15 16:35:23 +0200
committerRemi Collet <remi@remirepo.net>2019-05-15 16:35:23 +0200
commit558027f1380c227356b752dd0bb31b7bb294686c (patch)
tree97d0e2f720f2a83373b0cc31d0fb9e5e766d29c0
parente032af37507dc6cfbf1036394b829bb509585499 (diff)
3.0.0 from FedoraHEADmaster
-rw-r--r--.gitignore8
-rwxr-xr-xcomposer.json26
-rw-r--r--php-when.spec154
3 files changed, 138 insertions, 50 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/composer.json b/composer.json
new file mode 100755
index 0000000..9789d13
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,26 @@
+{
+ "name": "tplaner/when",
+ "type": "library",
+ "description": "Date/Calendar recursion library.",
+ "keywords": ["recurrence", "date", "time", "DateTime", "repeat"],
+ "homepage": "https://github.com/tplaner/When",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Tom Planer",
+ "email": "tplaner@gmail.com"
+ }
+ ],
+ "require": {
+ "php": ">=7.1.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "When\\": "src/"
+ }
+ },
+ "minimum-stability": "dev"
+}
diff --git a/php-when.spec b/php-when.spec
index 633ed71..c6fb260 100644
--- a/php-when.spec
+++ b/php-when.spec
@@ -1,73 +1,127 @@
-Name: php-when
-Version: 0.3
-Release: 2%{?dist}
-Summary: Date/Calendar recursion library for PHP
-
-Group: Development/Libraries
-License: MIT
-URL: https://github.com/tplaner/When
-# Download from
-# https://github.com/tplaner/When/archive/v0.3.tar.gz
-Source0: When-%{version}.tar.gz
-
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildArch: noarch
-
-Requires: php-date php-spl
+# remirepo spec file for php-when, from
+#
+# Fedora spec file for php-when
+#
+# Copyright (c) 2019 Shawn Iwinski <shawn@iwin.ski>
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please preserve changelog entries
+#
+
+%global github_owner tplaner
+%global github_name When
+%global github_version 3.0.0
+%global github_commit 09182e1707085382b8207c480120e96e98880563
+
+%global composer_vendor tplaner
+%global composer_project when
+
+# "php": ">=7.1.3"
+%global php_min_ver 7.1.3
+
+# Build using "--without tests" to disable tests
+%global with_tests 0%{!?_without_tests:1}
+
+%{!?phpdir: %global phpdir %{_datadir}/php}
+
+Name: php-when
+Version: %{github_version}
+Release: 1%{?github_release}%{?dist}
+Summary: Date/Calendar recursion library for PHP
+
+License: MIT
+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: php-composer(phpunit/phpunit)
+## phpcompatinfo (computed from version 3.0.0)
+BuildRequires: php-date
+BuildRequires: php-spl
+## Autoloader
+BuildRequires: php-composer(fedora/autoloader)
+%endif
+
+# composer.json
+Requires: php(language) >= %{php_min_ver}
+# phpcompatinfo (computed from version 3.0.0)
+Requires: php-date
+Requires: php-spl
+
+# Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming
+Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release}
+# Composer
+Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
%description
-PHP library that handles recursive dates: It determines the next date of
-recursion given an iCalendar "rrule" like pattern.
+%{summary}.
-%package tests
-Summary: Test files for %{name}
-Group: Development/Libraries
+Autoloader: %{phpdir}/When/autoload.php
-Requires: %{name} = %{version}-%{release}
-# phpunit tests
-Requires: php-phpunit-PHPUnit
-BuildRequires: php-phpunit-PHPUnit
-
-%description tests
-PHPUnit tests for %{name}.
%prep
-%setup -q -n When-%{version}
+%setup -qn %{github_name}-%{github_commit}
+
+# Remove exec bit from doc file
+chmod a-x composer.json
-# remove deprecated include and set prefix
-sed -e '/Framework.php/d' \
- -e '/When.php/s:./:when/:' \
- -e '/When_Iterator.php/s:./:when/:' \
- -i Tests/*php
%build
+: Create autoloader
+cat <<'AUTOLOAD' | tee src/autoload.php
+<?php
+/**
+ * Autoloader for %{name} and its' dependencies
+ * (created by %{name}-%{version}-%{release}).
+ */
+require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
+
+\Fedora\Autoloader\Autoload::addPsr4('When\\', __DIR__);
+AUTOLOAD
+
%install
-mkdir -p %{buildroot}%{_datadir}/php/when
-install -pm 644 When.php %{buildroot}%{_datadir}/php/when
-install -pm 644 When_Iterator.php %{buildroot}%{_datadir}/php/when
+mkdir -p %{buildroot}%{phpdir}
+cp -rp src %{buildroot}%{phpdir}/When
-mkdir -p %{buildroot}%{_datadir}/tests/%{name}
-install -pm 644 Tests/*.php %{buildroot}%{_datadir}/tests/%{name}/
%check
-cd Tests
-phpunit -d include_path=%{buildroot}%{_datadir}/php:.:%{_datadir}/php:%{_datadir}/pear -d date.timezone=UTC .
+%if %{with_tests}
+: Upstream tests
+RETURN_CODE=0
+PHPUNIT=$(which phpunit)
+for PHP_EXEC in php %{?rhel:php54 php55} php56 php70 php71 php72 php73 php74; do
+ if [ "php" == "$PHP_EXEC" ] || which $PHP_EXEC; then
+ $PHP_EXEC -d date.timezone=UTC $PHPUNIT --verbose \
+ --bootstrap %{buildroot}%{phpdir}/When/autoload.php \
+ || RETURN_CODE=1
+ fi
+done
+exit $RETURN_CODE
+%else
+: Tests skipped
+%endif
%files
-%defattr(-,root,root,-)
-%doc README.md
-%{_datadir}/php/when
-
-
-%files tests
-%defattr(-,root,root,-)
-%dir %{_datadir}/tests
-%{_datadir}/tests/%{name}
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc *.md
+%doc composer.json
+%{phpdir}/When
%changelog
+* Tue May 14 2019 Shawn Iwinski <shawn@iwin.ski> - 3.0.0-1
+- Update to 3.0.0 (RHBZ #1469514)
+- Rewrite spec and license it under the MIT license
+
* Mon Dec 17 2012 Remi Collet <remi@fedoraproject.org> - 0.3-2
- backport for remi repo.