summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-05-26 07:59:50 +0200
committerRemi Collet <fedora@famillecollet.com>2015-05-26 07:59:50 +0200
commit80e8f30f7796361cb5958065f7adcffbb8572735 (patch)
treede34819f7cf56f82090a7dfb8bd513595acb2c20
parent5bdd9be2ddb4bbfc01313c66235ab0457647d71a (diff)
php-Analog: 1.0.6
-rw-r--r--Makefile10
-rw-r--r--php-Analog-php7.patch128
-rw-r--r--php-Analog.spec112
3 files changed, 210 insertions, 40 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d095534
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,10 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+INCL1 := $(shell php-config --includes)
+INCL2 := -I $(shell php-config --include-dir)/sapi/embed
+LIBS := -lphp5 $(shell php-config --libs)
+
+include ../../common/Makefile
+
+tembed: tembed.c
+ gcc -Wall $(INCL1) $(INCL2) tembed.c $(LIBS) -o tembed
diff --git a/php-Analog-php7.patch b/php-Analog-php7.patch
new file mode 100644
index 0000000..379698f
--- /dev/null
+++ b/php-Analog-php7.patch
@@ -0,0 +1,128 @@
+From e9edc16f45f4205246ae9ed0ce623910a7111dfd Mon Sep 17 00:00:00 2001
+From: Johnny Broadway <johnny@johnnybroadway.com>
+Date: Mon, 25 May 2015 09:17:40 -0500
+Subject: [PATCH] Renamed Null to Ignore for PHP7 compatibility
+
+---
+ README.md | 2 +-
+ examples/ignore.php | 9 +++++++++
+ examples/null.php | 9 ---------
+ lib/Analog/Handler/Ignore.php | 20 ++++++++++++++++++++
+ lib/Analog/Handler/Null.php | 3 +++
+ 5 files changed, 33 insertions(+), 10 deletions(-)
+ create mode 100644 examples/ignore.php
+ delete mode 100644 examples/null.php
+ create mode 100644 lib/Analog/Handler/Ignore.php
+
+diff --git a/README.md b/README.md
+index a21891b..ee90b5d 100644
+--- a/README.md
++++ b/README.md
+@@ -25,11 +25,11 @@ with examples for each in the examples folder. These include:
+ * File - Append messages to a file
+ * FirePHP - Send messages to [FirePHP](http://www.firephp.org/) browser plugin
+ * GELF - Send message to the [Graylog2](http://www.graylog2.org/) log management server
++* Ignore - Do nothing
+ * LevelBuffer - Buffer messages and send only if sufficient error level reached
+ * Mail - Send email notices
+ * Mongo - Save to MongoDB collection
+ * Multi - Send different log levels to different handlers
+-* Null - Do nothing
+ * Post - Send messages over HTTP POST to another machine
+ * Stderr - Send messages to STDERR
+ * Syslog - Send messages to syslog
+diff --git a/examples/ignore.php b/examples/ignore.php
+new file mode 100644
+index 0000000..f5f766e
+--- /dev/null
++++ b/examples/ignore.php
+@@ -0,0 +1,9 @@
++<?php
++
++require '../lib/Analog.php';
++
++Analog::handler (Analog\Handler\Ignore::init ());
++
++Analog::log ('Hellooooooo');
++
++?>
+\ No newline at end of file
+diff --git a/examples/null.php b/examples/null.php
+deleted file mode 100644
+index aa24a3b..0000000
+--- a/examples/null.php
++++ /dev/null
+@@ -1,9 +0,0 @@
+-<?php
+-
+-require '../lib/Analog.php';
+-
+-Analog::handler (Analog\Handler\Null::init ());
+-
+-Analog::log ('Hellooooooo');
+-
+-?>
+\ No newline at end of file
+diff --git a/lib/Analog/Handler/Ignore.php b/lib/Analog/Handler/Ignore.php
+new file mode 100644
+index 0000000..57c67b5
+--- /dev/null
++++ b/lib/Analog/Handler/Ignore.php
+@@ -0,0 +1,20 @@
++<?php
++
++namespace Analog\Handler;
++
++/**
++ * Ignores anything sent to it so you can disable logging.
++ *
++ * Usage:
++ *
++ * Analog::handler (Analog\Handler\Ignore::init ());
++ *
++ * Analog::log ('Log me');
++ */
++class Ignore {
++ public static function init () {
++ return function ($info) {
++ // do nothing
++ };
++ }
++}
+\ No newline at end of file
+diff --git a/lib/Analog/Handler/Null.php b/lib/Analog/Handler/Null.php
+index 00a0017..29254eb 100644
+--- a/lib/Analog/Handler/Null.php
++++ b/lib/Analog/Handler/Null.php
+@@ -3,6 +3,9 @@
+ namespace Analog\Handler;
+
+ /**
++ * Note: Deprecated because Null is a reserved word in PHP7.
++ * Please use Analog\Handler\Ignore instead.
++ *
+ * Ignores anything sent to it so you can disable logging.
+ *
+ * Usage:
+From 69615c0e8b4033169b45d58f778fd3ba638d1d52 Mon Sep 17 00:00:00 2001
+From: Johnny Broadway <johnny@johnnybroadway.com>
+Date: Mon, 25 May 2015 10:23:49 -0500
+Subject: [PATCH] Replaced mention of Null with Ignore
+
+---
+ lib/Analog/Handler/Multi.php | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/Analog/Handler/Multi.php b/lib/Analog/Handler/Multi.php
+index dff0887..332e5ed 100644
+--- a/lib/Analog/Handler/Multi.php
++++ b/lib/Analog/Handler/Multi.php
+@@ -19,7 +19,7 @@
+ * Analog::WARNING => Analog\Handler\File::init( 'logs/warnings.log' ),
+ *
+ * // Debug and info messages sent here
+- * Analog::DEBUG => Analog\Handler\Null::init() // do nothing
++ * Analog::DEBUG => Analog\Handler\Ignore::init() // do nothing
+ * ) ) );
+ *
+ * // will be ignored
diff --git a/php-Analog.spec b/php-Analog.spec
index 38edbf1..976e2c2 100644
--- a/php-Analog.spec
+++ b/php-Analog.spec
@@ -1,35 +1,56 @@
-%global commit 9ab4c9e462cd6804d74f6cae9ba967c054b1629e
-%global shortcommit %(c=%{commit}; echo ${c:0:7})
-%global real_name Analog
-%global minus_name analog
-
-%global devver 1
+# remirepo spec file for php-Analog, from:
+#
+# Fedora spec file for php-Analog
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please preserve changelog entries
+#
+%global gh_owner jbroadway
+%global gh_project analog
+%global gh_commit 1fcc97fd842f37013587d64aba5f3f1fa6b0d911
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+#global gh_date 20150213
+%global real_name Analog
Name: php-Analog
Summary: PHP micro logging package
-Version: 1.0.0
-%if %{devver}
-Release: 5.git%{shortcommit}%{?dist}
-%else
-Release: 3%{?dist}
-%endif
-%if %{devver}
-Source0: https://github.com/jbroadway/%{real_name}/archive/%{commit}/%{real_name}-%{version}-%{shortcommit}.tar.gz
+Version: 1.0.6
+%if 0%{?gh_date}
+Release: 5.%{gh_date}git%{gh_short}%{?dist}
%else
-Source0: https://github.com/downloads/jbroadway/%{minus_name}/%{minus_name}-%{version}-stable.tar.gz
+Release: %{?dist}
%endif
-URL: https://github.com/jbroadway/analog
License: MIT
Group: Development/Libraries
+URL: https://github.com/jbroadway/analog
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz
+
+Patch0: %{name}-php7.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
-
-BuildRequires: php-pear(pear.phpunit.de/PHPUnit)
-
-Requires: php-common >= 5.3.0
-Requires: php-spl, php-date, php-json
-Requires: php-pcre, php-curl
+# For tests
+BuildRequires: %{_bindir}/phpunit
+BuildRequires: php-composer(psr/log)
+
+# from composer.json, "require": {
+# "psr/log": "1.*",
+# "php": ">=5.3.2"
+Requires: php(language) >= 5.3.2
+Requires: php-composer(psr/log)
+# From phpcompatinfo report
+Requires: php-curl
+Requires: php-date
+Requires: php-json
+Requires: php-pcre
+Requires: php-reflection
+Requires: php-spl
+Requires: php-xml
+# mongo is optional
+
+Provides: php-composer(analog/analog) = %{version}
%description
@@ -46,13 +67,13 @@ with examples for each in the examples folder. These include:
- File - Append messages to a file
- FirePHP - Send messages to FirePHP browser plugin
- GELF - Send message to the Graylog2 log management server
+- Ignore - Do nothing
- LevelBuffer - Buffer messages and send only if sufficient error
level reached
- Mail - Send email notices
- Mongo - Save to MongoDB collection, requires php-pecl(mongo)
package to be installed
- Multi - Send different log levels to different handlers
-- Null - Do nothing
- Post - Send messages over HTTP POST to another machine
- Stderr - Send messages to STDERR
- Syslog - Send messages to syslog
@@ -63,16 +84,9 @@ out of the box too.
%prep
-%if %{devver}
-%setup -qn %{minus_name}-%{commit}
-%else
-%setup -qn %{minus_name}-%{version}-stable
-%endif
-#files that should not exist
-find ./ -name "._*.php" -exec rm -f '{}' \;
+%setup -qn %{gh_project}-%{gh_commit}
-#patch for locked file issue (applied upstreamà
-sed -e "s/ | LOCK_NB//" -i lib/Analog/Handler/File.php
+%patch0 -p1
%build
@@ -80,29 +94,47 @@ sed -e "s/ | LOCK_NB//" -i lib/Analog/Handler/File.php
%install
-rm -rf $RPM_BUILD_ROOT
+rm -rf %{buildroot}
# install framework files
-install -d $RPM_BUILD_ROOT%{_datadir}/php
-cp -a lib/%{real_name} $RPM_BUILD_ROOT%{_datadir}/php/
+install -d %{buildroot}%{_datadir}/php
+cp -a lib/%{real_name} %{buildroot}%{_datadir}/php/
%check
-#could fail because of seconds in date comparison
-phpunit tests
+: Generate simple PSR-0 autoloader
+cat <<EOF | tee bs.php
+<?php
+spl_autoload_register(function (\$class) {
+ \$src = str_replace(array('\\\\', '_'), '/', \$class).'.php';
+ @include_once \$src;
+});
+EOF
+: Upstream test suite
+phpunit --bootstrap bs.php --include-path=%{buildroot}%{_datadir}/php
+
%clean
-rm -rf $RPM_BUILD_ROOT
+rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
-%doc LICENSE README.md examples lib/%{real_name}.php
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc README.md
+%doc examples lib/%{real_name}.php
+%doc composer.json
%dir %{_datadir}/php/%{real_name}
%{_datadir}/php/%{real_name}/*
%changelog
+* Tue May 26 2015 Remi Collet <remi@fedoraproject.org> - 1.0.6-1
+- update to 1.0.6
+- composer dependencies
+- add patch for PHP-7 (add Ignore, Null is deprecated)
+
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-5.git9ab4c9e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
@@ -129,5 +161,5 @@ rm -rf $RPM_BUILD_ROOT
- Latest snapshot (bug fixes, new handlers)
- Fix Requires
-* Sun Dec 01 2012 Johan Cwiklinski <johan AT x-tnd DOT be> - 1.0.0-1
+* Sat Dec 01 2012 Johan Cwiklinski <johan AT x-tnd DOT be> - 1.0.0-1
- Initial packaging