packages: php-predis/php-predis.spec (NEW), php-predis/run-tests.sh (NEW), ...
glen
glen at pld-linux.org
Sat Oct 9 17:07:20 CEST 2010
Author: glen Date: Sat Oct 9 15:07:20 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- new
---- Files affected:
packages/php-predis:
php-predis.spec (NONE -> 1.1) (NEW), run-tests.sh (NONE -> 1.1) (NEW), tests.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/php-predis/php-predis.spec
diff -u /dev/null packages/php-predis/php-predis.spec:1.1
--- /dev/null Sat Oct 9 17:07:20 2010
+++ packages/php-predis/php-predis.spec Sat Oct 9 17:07:14 2010
@@ -0,0 +1,70 @@
+# $Revision$, $Date$
+#
+# Conditional build:
+%bcond_without tests # build without tests
+
+%define php_min_version 5.2.6
+%define modname predis
+%include /usr/lib/rpm/macros.php
+Summary: Flexible and feature-complete PHP client library for Redis
+Summary(pl.UTF-8): %{modname} -
+Name: php-%{modname}
+Version: 0.6.1
+Release: 1
+License: BSD-like
+Group: Development/Languages/PHP
+Source0: http://github.com/nrk/predis/tarball/v%{version}-PHP5.2#/%{modname}.tgz
+# Source0-md5: 5204809fa8943c8a667134cd2b8bd3a3
+Source1: run-tests.sh
+Patch0: tests.patch
+URL: http://github.com/nrk/predis/
+%{?with_tests:BuildRequires: php-PHPUnit}
+%{?with_tests:BuildRequires: redis}
+BuildRequires: rpmbuild(macros) >= 1.519
+Requires: php-common >= 4:%{php_min_version}
+Requires: php-pcre
+Requires: php-spl
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Predis is a flexible and feature-complete PHP client library for the
+Redis key-value database.
+
+%prep
+%setup -qc
+mv *-predis-*/* .
+%patch0 -p1
+install -p %{SOURCE1} test
+
+%build
+%if %{with tests}
+cd test
+sh -x run-tests.sh
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{php_data_dir},%{_examplesdir}/%{name}-%{version}}
+
+cp -a lib/* $RPM_BUILD_ROOT%{php_data_dir}
+cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc CHANGELOG LICENSE TODO README.markdown
+%{php_data_dir}/Predis.php
+%{php_data_dir}/Predis_Compatibility.php
+%{_examplesdir}/%{name}-%{version}
+
+%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback at pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log$
+Revision 1.1 2010/10/09 15:07:14 glen
+- new
================================================================
Index: packages/php-predis/run-tests.sh
diff -u /dev/null packages/php-predis/run-tests.sh:1.1
--- /dev/null Sat Oct 9 17:07:20 2010
+++ packages/php-predis/run-tests.sh Sat Oct 9 17:07:14 2010
@@ -0,0 +1,57 @@
+#!/bin/sh
+# start redis daemon, and run tests, kill the daemon when tests are ran
+# Author: Elan Ruusamäe <glen at delfi.ee>
+
+cat > redis.conf <<'EOF'
+bind 127.0.0.1
+
+daemonize no
+#pidfile redis.pid
+port 6380
+bind 127.0.0.1
+timeout 300
+loglevel warning
+logfile stdout
+
+#databases 16
+#save 900 1
+#save 300 10
+#save 60 10000
+#rdbcompression yes
+#dbfilename dump.rdb
+#dir .
+#appendonly no
+#appendfsync everysec
+#vm-enabled no
+#vm-swap-file redis.swap
+#vm-max-memory 0
+#vm-page-size 32
+#vm-pages 134217728
+#vm-max-threads 4
+#glueoutputbuf yes
+#hash-max-zipmap-entries 64
+#hash-max-zipmap-value 512
+#activerehashing yes
+EOF
+
+# kill any previous daemon
+kill $(cat redis.pid 2>/dev/null) 2>/dev/null
+# setup hook to terminate on shutdown
+trap 'set -x;kill $(cat redis.pid)' 1 2 3 15 EXIT QUIT
+
+/usr/sbin/redis-server redis.conf &
+rc=$?
+pid=$!
+echo $pid > redis.pid
+[ $rc = 0 ] || exit $rc
+
+# it fails to report bind errors on startup, so wait for some and then see if pid is up
+sleep 2
+if ! kill -0 $pid; then
+ exit 1
+fi
+
+# now can really execute tests
+phpunit .
+# exit with phpunit exitcode
+exit $?
================================================================
Index: packages/php-predis/tests.patch
diff -u /dev/null packages/php-predis/tests.patch:1.1
--- /dev/null Sat Oct 9 17:07:20 2010
+++ packages/php-predis/tests.patch Sat Oct 9 17:07:14 2010
@@ -0,0 +1,23 @@
+--- php-predis-0.6.1/test/PredisShared.php 2010-10-09 17:38:52.650508019 +0300
++++ php-predis-0.6.1/test/PredisShared.php 2010-10-09 17:46:01.993925181 +0300
+@@ -1,9 +1,9 @@
+ <?php
+ require_once '../lib/Predis.php';
+
+-if (I_AM_AWARE_OF_THE_DESTRUCTIVE_POWER_OF_THIS_TEST_SUITE !== true) {
++/*if (I_AM_AWARE_OF_THE_DESTRUCTIVE_POWER_OF_THIS_TEST_SUITE !== true) {
+ exit('Please set the I_AM_AWARE_OF_THE_DESTRUCTIVE_POWER_OF_THIS_TEST_SUITE constant to TRUE if you want to proceed.');
+-}
++}*/
+
+ if (!function_exists('array_union')) {
+ function array_union(Array $a, Array $b) {
+@@ -17,7 +17,7 @@
+
+ class RC {
+ const SERVER_HOST = '127.0.0.1';
+- const SERVER_PORT = 6379;
++ const SERVER_PORT = 6380;
+ const DEFAULT_DATABASE = 15;
+
+ const WIPE_OUT = 1;
================================================================
More information about the pld-cvs-commit
mailing list