From a9873995f4397b7a408f1ed222586e6ac808e669 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 6 Nov 2012 18:10:46 +0100 Subject: php-horde-Horde-Support: make compatible with both existing UUID extensions --- php-horde-Horde-Support-uuid.patch | 26 ++++++++++++++++++++++++++ php-horde-Horde-Support.spec | 18 +++++++++++++----- 2 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 php-horde-Horde-Support-uuid.patch diff --git a/php-horde-Horde-Support-uuid.patch b/php-horde-Horde-Support-uuid.patch new file mode 100644 index 0000000..0cfc163 --- /dev/null +++ b/php-horde-Horde-Support-uuid.patch @@ -0,0 +1,26 @@ +diff -up Horde_Support-2.0.0/lib/Horde/Support/Uuid.php.old Horde_Support-2.0.0/lib/Horde/Support/Uuid.php +--- Horde_Support-2.0.0/lib/Horde/Support/Uuid.php.old 2012-11-06 17:23:48.000000000 +0100 ++++ Horde_Support-2.0.0/lib/Horde/Support/Uuid.php 2012-11-06 17:36:23.000000000 +0100 +@@ -36,9 +36,20 @@ class Horde_Support_Uuid + */ + public function generate() + { ++ $this->_uuid = NULL; + if (extension_loaded('uuid')) { +- $this->_uuid = uuid_create(); +- } else { ++ if (function_exists("uuid_export")) { ++ // UUID extension from http://www.ossp.org/pkg/lib/uuid/ ++ if (!uuid_create($ctx) && !uuid_make($ctx, UUID_MAKE_V4) && !uuid_export($ctx, UUID_FMT_STR, $str)) { ++ $this->_uuid = $str; ++ uuid_destroy($ctx); ++ } ++ } else { ++ // UUID extension from http://pecl.php.net/package/uuid ++ $this->_uuid = uuid_create(); ++ } ++ } ++ if (!$this->_uuid) { + list($time_mid, $time_low) = explode(' ', microtime()); + $time_low = (int)$time_low; + $time_mid = (int)substr($time_mid, 2) & 0xffff; diff --git a/php-horde-Horde-Support.spec b/php-horde-Horde-Support.spec index 8275650..01d88b1 100644 --- a/php-horde-Horde-Support.spec +++ b/php-horde-Horde-Support.spec @@ -8,7 +8,7 @@ Name: php-horde-Horde-Support Version: 2.0.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Horde support package Group: Development/Libraries @@ -16,6 +16,8 @@ License: BSD URL: http://pear.horde.org Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz +Patch0: %{name}-uuid.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildArch: noarch BuildRequires: php-pear(PEAR) >= 1.7.0 @@ -36,9 +38,6 @@ Requires: php-pear(%{pear_channel}/Horde_Exception) >= 2.0.0 Conflicts: php-pear(%{pear_channel}/Horde_Exception) >= 3.0.0 Requires: php-pear(%{pear_channel}/Horde_Stream_Wrapper) >= 2.0.0 Conflicts: php-pear(%{pear_channel}/Horde_Stream_Wrapper) >= 3.0.0 -# designed to work with php-pecl-uuid, not uuid-php -Requires: php-pecl(uuid) -Conflicts: uuid-php Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version} @@ -46,13 +45,19 @@ Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version} Support classes not tied to Horde but is used by it. These classes can be used outside of Horde as well. +Optional dependencies: +- uuid-php or php-pecl-uuid + %prep %setup -q -c -T tar xif %{SOURCE0} cd %{pear_name}-%{version} -mv ../package.xml %{name}.xml +%patch0 -p1 -b .uuid + +sed -e '/Uuid.php/s/md5sum=.*name/name/' \ + ../package.xml >%{name}.xml %build @@ -101,6 +106,9 @@ fi %changelog +* Tue Nov 6 2012 Remi Collet - 2.0.0-3 +- add patch to allow uuid-php or php-pecl-uuid + * Sun Nov 4 2012 Remi Collet - 2.0.0-2 - conflicts with uuid-php - add optionnal %%check -- cgit