[packages/php-google-api] add Google/autoload.php as single entry point to init
glen
glen at pld-linux.org
Fri Jan 23 00:18:49 CET 2015
commit fd8eb2aa2ac387e42513494492c36a2e3f0213a9
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Fri Jan 23 00:24:57 2015 +0200
add Google/autoload.php as single entry point to init
autoload.patch | 12 ++++++++++++
php-google-api.spec | 14 +++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/php-google-api.spec b/php-google-api.spec
index 73a0212..f70bddc 100644
--- a/php-google-api.spec
+++ b/php-google-api.spec
@@ -3,13 +3,14 @@
Summary: Google APIs Client Library for PHP
Name: php-google-api
Version: 1.1.2
-Release: 0.2
+Release: 0.5
License: Apache v2.0
Group: Development/Languages/PHP
Source0: https://github.com/google/google-api-php-client/archive/%{version}/google-api-php-client-%{version}.tar.gz
# Source0-md5: 44f2252aa279364236823fb3fc129d53
Patch0: php52.patch
Patch1: gapi.patch
+Patch2: autoload.patch
URL: https://developers.google.com/api-client-library/php/
BuildRequires: rpm-php-pearprov >= 4.4.2-11
BuildRequires: rpmbuild(macros) >= 1.461
@@ -38,6 +39,17 @@ simple, flexible, powerful API access.
%setup -qn google-api-php-client-%{version}
%patch0 -p1
%patch1 -p1
+%patch2 -p1
+
+# use single autoload so could use different autoloader than provided by this project
+# you intend to use this, you need to call it before accessing other classes
+mv autoload.php src/Google
+grep -r 'require_once.*autoload.php' src -l | xargs %{__sed} -i -e '/require_once.*autoload.php/d'
+
+# fixup paths in examples
+grep -r 'require_once.*autoload.php' examples -l | xargs %{__sed} -i -e "
+ s,realpath(dirname(__FILE__) . '/../autoload.php'),'Google/autoload.php',
+"
%install
rm -rf $RPM_BUILD_ROOT
diff --git a/autoload.patch b/autoload.patch
new file mode 100644
index 0000000..d978079
--- /dev/null
+++ b/autoload.patch
@@ -0,0 +1,12 @@
+--- google-api-php-client-1.1.2/autoload.php 2015-01-23 00:06:59.492462347 +0200
++++ google-api-php-client-1.1.2/autoload.php 2015-01-23 00:06:59.492462347 +0200
+@@ -24,7 +24,8 @@
+ // Maximum class file path depth in this project is 3.
+ $classPath = array_slice($classPath, 0, 3);
+ }
+- $filePath = dirname(__FILE__) . '/src/' . implode('/', $classPath) . '.php';
++ array_shift($classPath);
++ $filePath = dirname(__FILE__) . '/' . implode('/', $classPath) . '.php';
+ if (file_exists($filePath)) {
+ require_once($filePath);
+ }
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/php-google-api.git/commitdiff/b7290f00924a9b9e1f7a130ba7e27481515647d7
More information about the pld-cvs-commit
mailing list