diff options
-rw-r--r-- | php-google-apiclient-1.1.2-move_autoloader.patch (renamed from 0001-relocate-autoloader-to-src-Google-backport-from-mast.patch) | 243 | ||||
-rw-r--r-- | php-google-apiclient.spec | 10 |
2 files changed, 95 insertions, 158 deletions
diff --git a/0001-relocate-autoloader-to-src-Google-backport-from-mast.patch b/php-google-apiclient-1.1.2-move_autoloader.patch index e32a174..35bc716 100644 --- a/0001-relocate-autoloader-to-src-Google-backport-from-mast.patch +++ b/php-google-apiclient-1.1.2-move_autoloader.patch @@ -1,113 +1,5 @@ -From 16577c1924941194e353f97c61a0c7320b429d8b Mon Sep 17 00:00:00 2001 -From: Adam Williamson <awilliam@redhat.com> -Date: Sat, 20 Dec 2014 15:27:21 -0800 -Subject: [PATCH] relocate autoloader to src/Google (backport from master) - ---- - README.md | 2 +- - autoload.php | 33 -------------------------------- - examples/appengineauth.php | 2 +- - examples/batch.php | 2 +- - examples/fileupload.php | 2 +- - examples/idtoken.php | 2 +- - examples/multi-api.php | 2 +- - examples/service-account.php | 2 +- - examples/simple-query.php | 2 +- - examples/simplefileupload.php | 2 +- - examples/user-example.php | 2 +- - src/Google/Auth/Abstract.php | 2 +- - src/Google/Auth/AppIdentity.php | 2 +- - src/Google/Auth/AssertionCredentials.php | 2 +- - src/Google/Auth/Exception.php | 2 +- - src/Google/Auth/LoginTicket.php | 2 +- - src/Google/Auth/OAuth2.php | 2 +- - src/Google/Auth/Simple.php | 2 +- - src/Google/Cache/Apc.php | 2 +- - src/Google/Cache/Exception.php | 2 +- - src/Google/Cache/File.php | 2 +- - src/Google/Cache/Memcache.php | 2 +- - src/Google/Cache/Null.php | 2 +- - src/Google/Client.php | 2 +- - src/Google/Collection.php | 2 +- - src/Google/Http/Batch.php | 2 +- - src/Google/Http/CacheParser.php | 2 +- - src/Google/Http/MediaFileUpload.php | 2 +- - src/Google/Http/REST.php | 2 +- - src/Google/Http/Request.php | 2 +- - src/Google/IO/Abstract.php | 2 +- - src/Google/IO/Curl.php | 2 +- - src/Google/IO/Exception.php | 2 +- - src/Google/IO/Stream.php | 2 +- - src/Google/Logger/Abstract.php | 2 +- - src/Google/Logger/Exception.php | 2 +- - src/Google/Logger/File.php | 2 +- - src/Google/Logger/Null.php | 2 +- - src/Google/Logger/Psr.php | 2 +- - src/Google/Service/Exception.php | 2 +- - src/Google/Service/Resource.php | 2 +- - src/Google/Signer/P12.php | 2 +- - src/Google/Verifier/Pem.php | 2 +- - src/Google/autoload.php | 32 +++++++++++++++++++++++++++++++ - tests/OAuthHelper.php | 2 +- - tests/bootstrap.php | 2 +- - 46 files changed, 76 insertions(+), 77 deletions(-) - delete mode 100644 autoload.php - create mode 100644 src/Google/autoload.php - -diff --git a/README.md b/README.md -index 7508aeb..752dad9 100644 ---- a/README.md -+++ b/README.md -@@ -26,7 +26,7 @@ See the examples/ directory for examples of the key client features. - ```PHP - <?php - -- require_once 'google-api-php-client/autoload.php'; // or wherever autoload.php is located -+ require_once 'google-api-php-client/src/Google/autoload.php'; // or wherever autoload.php is located - - $client = new Google_Client(); - $client->setApplicationName("Client_Library_Examples"); -diff --git a/autoload.php b/autoload.php -deleted file mode 100644 -index 3815c52..0000000 ---- a/autoload.php -+++ /dev/null -@@ -1,33 +0,0 @@ --<?php --/* -- * Copyright 2014 Google Inc. -- * -- * Licensed under the Apache License, Version 2.0 (the "License"); -- * you may not use this file except in compliance with the License. -- * You may obtain a copy of the License at -- * -- * http://www.apache.org/licenses/LICENSE-2.0 -- * -- * Unless required by applicable law or agreed to in writing, software -- * distributed under the License is distributed on an "AS IS" BASIS, -- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- * See the License for the specific language governing permissions and -- * limitations under the License. -- */ -- --function google_api_php_client_autoload($className) { -- $classPath = explode('_', $className); -- if ($classPath[0] != 'Google') { -- return; -- } -- if (count($classPath) > 3) { -- // Maximum class file path depth in this project is 3. -- $classPath = array_slice($classPath, 0, 3); -- } -- $filePath = dirname(__FILE__) . '/src/' . implode('/', $classPath) . '.php'; -- if (file_exists($filePath)) { -- require_once($filePath); -- } --} -- --spl_autoload_register('google_api_php_client_autoload'); diff --git a/examples/appengineauth.php b/examples/appengineauth.php -index 4300c70..91b649a 100644 +index 4300c70..7b147e9 100644 --- a/examples/appengineauth.php +++ b/examples/appengineauth.php @@ -21,7 +21,7 @@ include_once "templates/base.php"; @@ -115,12 +7,12 @@ index 4300c70..91b649a 100644 AppIdentity service on AppEngine. ************************************************/ -require_once realpath(dirname(__FILE__) . '/../autoload.php'); -+require_once realpath(dirname(__FILE__) .autoload.php'); ++require_once realpath(dirname(__FILE__) . '/../src/Google/autoload.php'); echo pageHeader("AppIdentity Account Access"); diff --git a/examples/batch.php b/examples/batch.php -index 3a51ab9..1efe53f 100644 +index 3a51ab9..5183e58 100644 --- a/examples/batch.php +++ b/examples/batch.php @@ -22,7 +22,7 @@ echo pageHeader("Batching Queries"); @@ -128,12 +20,12 @@ index 3a51ab9..1efe53f 100644 will batch up two queries into a single call. ************************************************/ -require_once realpath(dirname(__FILE__) . '/../autoload.php'); -+require_once realpath(dirname(__FILE__) .autoload.php'); ++require_once realpath(dirname(__FILE__) . '/../src/Google/autoload.php'); /************************************************ We create the client and set the simple API diff --git a/examples/fileupload.php b/examples/fileupload.php -index 0940e1c..9b3d27c 100644 +index 0940e1c..6a20390 100644 --- a/examples/fileupload.php +++ b/examples/fileupload.php @@ -17,7 +17,7 @@ @@ -141,12 +33,12 @@ index 0940e1c..9b3d27c 100644 session_start(); -require_once realpath(dirname(__FILE__) . '/../autoload.php'); -+require_once realpath(dirname(__FILE__) .autoload.php'); ++require_once realpath(dirname(__FILE__) . '/../src/Google/autoload.php'); /************************************************ We'll setup an empty 20MB file to upload. diff --git a/examples/idtoken.php b/examples/idtoken.php -index 963f35b..c354c11 100644 +index 963f35b..e3991e9 100644 --- a/examples/idtoken.php +++ b/examples/idtoken.php @@ -17,7 +17,7 @@ @@ -154,12 +46,12 @@ index 963f35b..c354c11 100644 session_start(); -require_once realpath(dirname(__FILE__) . '/../autoload.php'); -+require_once realpath(dirname(__FILE__) .autoload.php'); ++require_once realpath(dirname(__FILE__) . '/../src/Google/autoload.php'); /************************************************ ATTENTION: Fill in these values! Make sure diff --git a/examples/multi-api.php b/examples/multi-api.php -index 3780287..0f5dfeb 100644 +index 3780287..86f682c 100644 --- a/examples/multi-api.php +++ b/examples/multi-api.php @@ -17,7 +17,7 @@ @@ -167,12 +59,12 @@ index 3780287..0f5dfeb 100644 session_start(); -require_once realpath(dirname(__FILE__) . '/../autoload.php'); -+require_once realpath(dirname(__FILE__) .autoload.php'); ++require_once realpath(dirname(__FILE__) . '/../src/Google/autoload.php'); /************************************************ ATTENTION: Fill in these values! Make sure diff --git a/examples/service-account.php b/examples/service-account.php -index 4cc0840..7d0d848 100644 +index 4cc0840..45dc75c 100644 --- a/examples/service-account.php +++ b/examples/service-account.php @@ -21,7 +21,7 @@ include_once "templates/base.php"; @@ -180,12 +72,12 @@ index 4cc0840..7d0d848 100644 account. ************************************************/ -require_once realpath(dirname(__FILE__) . '/../autoload.php'); -+require_once realpath(dirname(__FILE__) .autoload.php'); ++require_once realpath(dirname(__FILE__) . '/../src/Google/autoload.php'); /************************************************ ATTENTION: Fill in these values! You can get diff --git a/examples/simple-query.php b/examples/simple-query.php -index e22790b..0cc139e 100644 +index e22790b..b3fd128 100644 --- a/examples/simple-query.php +++ b/examples/simple-query.php @@ -25,7 +25,7 @@ echo pageHeader("Simple API Access"); @@ -193,12 +85,12 @@ index e22790b..0cc139e 100644 anonymous quota (which is limited per IP). ************************************************/ -require_once realpath(dirname(__FILE__) . '/../autoload.php'); -+require_once realpath(dirname(__FILE__) .autoload.php'); ++require_once realpath(dirname(__FILE__) . '/../src/Google/autoload.php'); /************************************************ We create the client and set the simple API diff --git a/examples/simplefileupload.php b/examples/simplefileupload.php -index 1d8fbda..8e198a3 100644 +index 1d8fbda..40f14f2 100644 --- a/examples/simplefileupload.php +++ b/examples/simplefileupload.php @@ -17,7 +17,7 @@ @@ -206,12 +98,12 @@ index 1d8fbda..8e198a3 100644 session_start(); -require_once realpath(dirname(__FILE__) . '/../autoload.php'); -+require_once realpath(dirname(__FILE__) .autoload.php'); ++require_once realpath(dirname(__FILE__) . '/../src/Google/autoload.php'); /************************************************ We'll setup an empty 1MB file to upload. diff --git a/examples/user-example.php b/examples/user-example.php -index 4370b08..e950b98 100644 +index 4370b08..9cfd3d2 100644 --- a/examples/user-example.php +++ b/examples/user-example.php @@ -17,7 +17,7 @@ @@ -219,7 +111,7 @@ index 4370b08..e950b98 100644 session_start(); -require_once realpath(dirname(__FILE__) . '/../autoload.php'); -+require_once realpath(dirname(__FILE__) .autoload.php'); ++require_once realpath(dirname(__FILE__) . '/../src/Google/autoload.php'); /************************************************ ATTENTION: Fill in these values! Make sure @@ -637,6 +529,76 @@ index 563553b..f217c92 100644 /** * Verifies signatures using PEM encoded certificates. +diff --git a/tests/OAuthHelper.php b/tests/OAuthHelper.php +index e83e3e5..1e36a4f 100644 +--- a/tests/OAuthHelper.php ++++ b/tests/OAuthHelper.php +@@ -14,7 +14,7 @@ + * See the License for the specific language governing permissions and + * limitations under the License. + */ +-require_once dirname(__FILE__) . '/../autoload.php'; ++require_once dirname(__FILE__) . '/../src/Google/autoload.php'; + + $client = new Google_Client(); + $client->setScopes( +diff --git a/tests/bootstrap.php b/tests/bootstrap.php +index e1783a0..327b974 100644 +--- a/tests/bootstrap.php ++++ b/tests/bootstrap.php +@@ -15,7 +15,7 @@ + * limitations under the License. + */ + +-require_once dirname(__FILE__) . '/../autoload.php'; ++require_once dirname(__FILE__) . '/../src/Google/autoload.php'; + require_once dirname(__FILE__) . '/BaseTest.php'; + + date_default_timezone_set('UTC'); +diff --git a/README.md b/README.md +index 7508aeb..752dad9 100644 +--- a/README.md ++++ b/README.md +@@ -26,7 +26,7 @@ See the examples/ directory for examples of the key client features. + ```PHP + <?php + +- require_once 'google-api-php-client/autoload.php'; // or wherever autoload.php is located ++ require_once 'google-api-php-client/src/Google/autoload.php'; // or wherever autoload.php is located + + $client = new Google_Client(); + $client->setApplicationName("Client_Library_Examples"); +diff --git a/autoload.php b/autoload.php +index 3815c52..25af272 100644 +--- a/autoload.php ++++ b/autoload.php +@@ -15,19 +15,12 @@ + * limitations under the License. + */ + +-function google_api_php_client_autoload($className) { +- $classPath = explode('_', $className); +- if ($classPath[0] != 'Google') { +- return; +- } +- if (count($classPath) > 3) { +- // Maximum class file path depth in this project is 3. +- $classPath = array_slice($classPath, 0, 3); +- } +- $filePath = dirname(__FILE__) . '/src/' . implode('/', $classPath) . '.php'; +- if (file_exists($filePath)) { +- require_once($filePath); +- } ++// PHP 5.2 compatibility: E_USER_DEPRECATED was added in 5.3 ++if (!defined('E_USER_DEPRECATED')) { ++ define('E_USER_DEPRECATED', E_USER_WARNING); + } + +-spl_autoload_register('google_api_php_client_autoload'); ++$error = "google-api-php-client's autoloader was moved to src/Google/autoload.php in 1.1.3. This "; ++$error .= "redirect will be removed in 1.2. Please adjust your code to use the new location."; ++trigger_error($error, E_USER_DEPRECATED); ++require_once 'src/Google/autoload.php'; diff --git a/src/Google/autoload.php b/src/Google/autoload.php new file mode 100644 index 0000000..debdd27 @@ -675,32 +637,3 @@ index 0000000..debdd27 +} + +spl_autoload_register('google_api_php_client_autoload'); -diff --git a/tests/OAuthHelper.php b/tests/OAuthHelper.php -index e83e3e5..1e36a4f 100644 ---- a/tests/OAuthHelper.php -+++ b/tests/OAuthHelper.php -@@ -14,7 +14,7 @@ - * See the License for the specific language governing permissions and - * limitations under the License. - */ --require_once dirname(__FILE__) . '/../autoload.php'; -+require_once dirname(__FILE__) . '/../src/Google/autoload.php'; - - $client = new Google_Client(); - $client->setScopes( -diff --git a/tests/bootstrap.php b/tests/bootstrap.php -index e1783a0..327b974 100644 ---- a/tests/bootstrap.php -+++ b/tests/bootstrap.php -@@ -15,7 +15,7 @@ - * limitations under the License. - */ - --require_once dirname(__FILE__) . '/../autoload.php'; -+require_once dirname(__FILE__) . '/../src/Google/autoload.php'; - require_once dirname(__FILE__) . '/BaseTest.php'; - - date_default_timezone_set('UTC'); --- -2.2.0 - diff --git a/php-google-apiclient.spec b/php-google-apiclient.spec index c02ce16..1df2412 100644 --- a/php-google-apiclient.spec +++ b/php-google-apiclient.spec @@ -8,7 +8,7 @@ Name: php-google-apiclient Version: %{github_version} -Release: 1%{?dist} +Release: 2%{?dist} Summary: Client library for Google APIs Group: Development/Libraries @@ -18,13 +18,14 @@ Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{githu # Submitted upstream: https://github.com/google/google-api-php-client/pull/437 # Relocate the autoloader added in 1.1, or else we can't sensibly package it -Patch0: 0001-relocate-autoloader-to-src-Google-backport-from-mast.patch +# Rediffed against 1.1.2 (files have been moved/added upstream since) +Patch0: php-google-apiclient-1.1.2-move_autoloader.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # For tests BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-pear(pear.phpunit.de/PHPUnit) +BuildRequires: %{_bindir}/phpunit # For tests: phpcompatinfo (computed from 1.0.3-beta) BuildRequires: php-date BuildRequires: php-json @@ -121,6 +122,9 @@ rm -rf %{buildroot} %changelog +* Fri Jan 02 2015 Adam Williamson <awilliam@redhat.com> - 1.1.2-2 +- update autoloader relocation patch to match latest upstream submission + * Sat Dec 20 2014 Adam Williamson <awilliam@redhat.com> - 1.1.2-1 - new upstream release 1.1.2 - relocate autoloader to make it work with systemwide installation |