From 2e6e5ac2eb71b2c46f8a6fa741b47c6ec4fe9583 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 26 Nov 2015 15:22:57 +0100 Subject: php-goutte: 1.0.7 (backport from Fedora) --- php-goutte.spec | 183 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 129 insertions(+), 54 deletions(-) (limited to 'php-goutte.spec') diff --git a/php-goutte.spec b/php-goutte.spec index 2d7a22b..712e7a6 100644 --- a/php-goutte.spec +++ b/php-goutte.spec @@ -1,17 +1,44 @@ -%global github_owner fabpot +# remirepo spec file for php-goutte, from: +# +# Fedora spec file for php-goutte +# +# Copyright (c) 2014-2015 Shawn Iwinski +# +# License: MIT +# http://opensource.org/licenses/MIT +# +# Please preserve changelog entries +# + +%global github_owner FriendsOfPHP %global github_name Goutte -%global github_version 1.0.6 -%global github_commit 06a5451288ffddd204b10fa6c6f9ab2b86dd515d +%global github_version 1.0.7 +%global github_commit 794b196e76bdd37b5155cdecbad311f0a3b07625 + +%global composer_vendor fabpot +%global composer_project goutte # "php": ">=5.3.0" %global php_min_ver 5.3.0 -# "guzzle/*": "~3.1" +# "guzzle/http": "~3.1" +# "guzzle/plugin-history": "~3.1" +# "guzzle/plugin-mock": "~3.1" %global guzzle_min_ver 3.1 %global guzzle_max_ver 4.0 -# "symfony/*": "~2.1" -%global symfony_min_ver 2.1 +# "symfony/browser-kit": "~2.1" +# "symfony/css-selector": "~2.1" +# "symfony/dom-crawler": "~2.1" +# "symfony/finder": "~2.1" +# "symfony/process": "~2.1" +# NOTE: Min version not 2.1 because autoloader required +%global symfony_min_ver 2.7.1 %global symfony_max_ver 3.0 +# Build using "--without tests" to disable tests +%global with_tests 0%{!?_without_tests:1} + +%global phpdir %{_datadir}/php + Name: php-goutte Version: %{github_version} Release: 1%{?github_release}%{?dist} @@ -24,39 +51,46 @@ Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{githu BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -# For tests -BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-symfony-browserkit >= %{symfony_min_ver} -BuildRequires: php-symfony-browserkit < %{symfony_max_ver} -BuildRequires: php-symfony-cssselector >= %{symfony_min_ver} -BuildRequires: php-symfony-cssselector < %{symfony_max_ver} -BuildRequires: php-symfony-domcrawler >= %{symfony_min_ver} -BuildRequires: php-symfony-domcrawler < %{symfony_max_ver} -BuildRequires: php-symfony-finder >= %{symfony_min_ver} -BuildRequires: php-symfony-finder < %{symfony_max_ver} -BuildRequires: php-symfony-process >= %{symfony_min_ver} -BuildRequires: php-symfony-process < %{symfony_max_ver} -BuildRequires: php-pear(guzzlephp.org/pear/Guzzle) >= %{guzzle_min_ver} -BuildRequires: php-pear(guzzlephp.org/pear/Guzzle) < %{guzzle_max_ver} -BuildRequires: php-pear(pear.phpunit.de/PHPUnit) -# For tests: phpcompatinfo (computed from v1.0.6) +# Tests +%if %{with_tests} +BuildRequires: php-composer(phpunit/phpunit) +## composer.json +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(guzzle/http) >= %{guzzle_min_ver} +BuildRequires: php-composer(guzzle/plugin-history) >= %{guzzle_min_ver} +BuildRequires: php-composer(guzzle/plugin-mock) >= %{guzzle_min_ver} +BuildRequires: php-composer(symfony/browser-kit) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/css-selector) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/dom-crawler) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/finder) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/process) >= %{symfony_min_ver} BuildRequires: php-curl - -Requires: php(language) >= %{php_min_ver} -Requires: php-symfony-browserkit >= %{symfony_min_ver} -Requires: php-symfony-browserkit < %{symfony_max_ver} -Requires: php-symfony-cssselector >= %{symfony_min_ver} -Requires: php-symfony-cssselector < %{symfony_max_ver} -Requires: php-symfony-domcrawler >= %{symfony_min_ver} -Requires: php-symfony-domcrawler < %{symfony_max_ver} -Requires: php-symfony-finder >= %{symfony_min_ver} -Requires: php-symfony-finder < %{symfony_max_ver} -Requires: php-symfony-process >= %{symfony_min_ver} -Requires: php-symfony-process < %{symfony_max_ver} -Requires: php-pear(guzzlephp.org/pear/Guzzle) >= %{guzzle_min_ver} -Requires: php-pear(guzzlephp.org/pear/Guzzle) < %{guzzle_max_ver} -# phpcompatinfo (computed from v1.0.6) +## phpcompatinfo (computed from version 1.7.0) +# +## Autoloader +BuildRequires: php-composer(symfony/class-loader) +%endif + +# composer.json +Requires: php(language) >= %{php_min_ver} +Requires: php-composer(guzzle/http) >= %{guzzle_min_ver} +Requires: php-composer(guzzle/http) < %{guzzle_max_ver} +Requires: php-composer(symfony/browser-kit) >= %{symfony_min_ver} +Requires: php-composer(symfony/browser-kit) < %{symfony_max_ver} +Requires: php-composer(symfony/css-selector) >= %{symfony_min_ver} +Requires: php-composer(symfony/css-selector) < %{symfony_max_ver} +Requires: php-composer(symfony/dom-crawler) >= %{symfony_min_ver} +Requires: php-composer(symfony/dom-crawler) < %{symfony_max_ver} +Requires: php-composer(symfony/finder) >= %{symfony_min_ver} +Requires: php-composer(symfony/finder) < %{symfony_max_ver} +Requires: php-composer(symfony/process) >= %{symfony_min_ver} +Requires: php-composer(symfony/process) < %{symfony_max_ver} Requires: php-curl +# phpcompatinfo (computed from version 1.7.0) +# + +# Composer +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description Goutte is a screen scraping and web crawling library for PHP. @@ -64,10 +98,43 @@ Goutte is a screen scraping and web crawling library for PHP. Goutte provides a nice API to crawl websites and extract data from the HTML/XML responses. +Autoloader: %{phpdir}/Goutte/autoload.php + %prep %setup -qn %{github_name}-%{github_commit} +: Create autoloader +cat <<'AUTOLOAD' | tee Goutte/autoload.php +register(); +} + +$fedoraClassLoader->addPrefix('Goutte\\', dirname(__DIR__)); + +require_once '%{phpdir}/Guzzle/autoload.php'; +require_once '%{phpdir}/Symfony/Component/BrowserKit/autoload.php'; +require_once '%{phpdir}/Symfony/Component/CssSelector/autoload.php'; +require_once '%{phpdir}/Symfony/Component/DomCrawler/autoload.php'; +require_once '%{phpdir}/Symfony/Component/Finder/autoload.php'; +require_once '%{phpdir}/Symfony/Component/Process/autoload.php'; + +return $fedoraClassLoader; +AUTOLOAD + %build # Empty build section, nothing required @@ -75,25 +142,23 @@ from the HTML/XML responses. %install rm -rf %{buildroot} -mkdir -pm 0755 %{buildroot}/%{_datadir}/php/%{github_name} -cp -p %{github_name}/Client.php %{buildroot}/%{_datadir}/php/%{github_name}/ +mkdir -p %{buildroot}/%{phpdir}/Goutte +cp -p Goutte/{autoload,Client}.php %{buildroot}/%{phpdir}/Goutte/ -%check -# Create tests' bootstrap -mkdir vendor -cat > vendor/autoload.php <<'AUTOLOAD' - phpunit.xml +%check +%if %{with_tests} +%{_bindir}/phpunit --verbose \ + --bootstrap %{buildroot}/%{phpdir}/Goutte/autoload.php -%{_bindir}/phpunit -d date.timezone="UTC" +if which php70; then + php70 %{_bindir}/phpunit --verbose \ + --bootstrap %{buildroot}/%{phpdir}/Goutte/autoload.php +fi +%else +: Tests skipped +%endif %clean @@ -102,11 +167,21 @@ rm -rf %{buildroot} %files %defattr(-,root,root,-) -%doc LICENSE README.rst composer.json -%{_datadir}/php/%{github_name} +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc *.rst +%doc composer.json +%{phpdir}/Goutte %changelog +* Mon Nov 23 2015 Shawn Iwinski - 1.0.7-1 +- Updated to 1.0.7 +- Added spec file license header +- php-composer(*) dependencies +- Added php-composer(fabpot/goutte) virtual provide +- Added autoloader + * Sat May 17 2014 Remi Collet 1.0.6-1 - backport 1.0.6 for remi repo -- cgit