From bf3baee705b84408e56dfc564b30741d4a1f233f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 19 Jul 2016 09:31:51 +0200 Subject: php-guzzlehttp-guzzle: 5.3.1 --- composer.json | 33 +++++++++++++++++ php-guzzlehttp-guzzle-get-source.sh | 71 ++++++++++++++++++++++++++++++++++++ php-guzzlehttp-guzzle.spec | 72 ++++++++++++++++++++++++++++--------- 3 files changed, 160 insertions(+), 16 deletions(-) create mode 100644 composer.json create mode 100755 php-guzzlehttp-guzzle-get-source.sh diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..717b3be --- /dev/null +++ b/composer.json @@ -0,0 +1,33 @@ +{ + "name": "guzzlehttp/guzzle", + "type": "library", + "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "keywords": ["framework", "http", "rest", "web service", "curl", "client", "HTTP client"], + "homepage": "http://guzzlephp.org/", + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "require": { + "php": ">=5.4.0", + "guzzlehttp/ringphp": "^1.1" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\": "tests/" + } + } +} diff --git a/php-guzzlehttp-guzzle-get-source.sh b/php-guzzlehttp-guzzle-get-source.sh new file mode 100755 index 0000000..4ad1051 --- /dev/null +++ b/php-guzzlehttp-guzzle-get-source.sh @@ -0,0 +1,71 @@ +#/bin/sh + +GIT=`which git` +RPM=`which rpm` + +if [ -z "$GIT" ] +then + echo "ERROR: 'git' command not found" 1>&2 + exit 1 +elif [ -z "$RPM" ] +then + echo "ERROR: 'rpm' command not found" 1>&2 + exit 1 +fi + +function print { + echo -e "\e[0;33m>>>>> ${1}\e[0m" +} + +if [ -x "$1" ] +then + SPEC=$1 +else + SPEC=`ls *.spec | head -1` +fi + +NAME=`echo $SPEC | sed 's#\.spec##'` +VERSION=`egrep '%global\s*github_version' $SPEC | awk '{print $3}'` + +print "SPEC = $SPEC" +print "NAME = $NAME" + +GIT_OWNER=`egrep '%global\s*github_owner' $SPEC | awk '{print $3}'` +GIT_NAME=`egrep '%global\s*github_name' $SPEC | awk '{print $3}'` +GIT_COMMIT=`egrep '%global\s*github_commit' $SPEC | awk '{print $3}'` +GIT_REPO=https://github.com/${GIT_OWNER}/${GIT_NAME} +GIT_DIR=`echo $GIT_REPO | sed 's#.*/##'` + +print "GIT_OWNER = $GIT_OWNER" +print "GIT_NAME = $GIT_NAME" +print "GIT_COMMIT = $GIT_COMMIT" +print "GIT_REPO = $GIT_REPO" +print "GIT_DIR = $GIT_DIR" + +TEMP_DIR=$(mktemp --dir) +TAR_FILE=$PWD/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz +CMP_FILE=$PWD/composer.json + +pushd $TEMP_DIR + print "Cloning git repo..." + $GIT clone $GIT_REPO + + pushd $GIT_DIR + print "Checking out commit..." + $GIT checkout $GIT_COMMIT + cp composer.json $CMP_FILE + popd + + TAR_DIR=${GIT_NAME}-${GIT_COMMIT} + print "TAR_DIR = $TAR_DIR" + + mv $GIT_DIR $TAR_DIR + + print "TAR_FILE = $TAR_FILE" + + [ -e $TAR_FILE ] && rm -f $TAR_FILE + tar --exclude-vcs -czf $TAR_FILE $TAR_DIR + chmod 0644 $TAR_FILE +popd + +rm -rf $TEMP_DIR diff --git a/php-guzzlehttp-guzzle.spec b/php-guzzlehttp-guzzle.spec index f4d4da8..0ad23d8 100644 --- a/php-guzzlehttp-guzzle.spec +++ b/php-guzzlehttp-guzzle.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-guzzlehttp-guzzle # -# Copyright (c) 2014-2015 Shawn Iwinski +# Copyright (c) 2014-2016 Shawn Iwinski # # License: MIT # http://opensource.org/licenses/MIT @@ -12,8 +12,8 @@ %global github_owner guzzle %global github_name guzzle -%global github_version 5.3.0 -%global github_commit f3c8c22471cb55475105c14769644a49c3262b93 +%global github_version 5.3.1 +%global github_commit 70f1fa53b71c4647bf2762c09068a95f77e12fb8 %global composer_vendor guzzlehttp %global composer_project guzzle @@ -41,13 +41,17 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 4%{?github_release}%{?dist}.1 +Release: 1%{?github_release}%{?dist} Summary: PHP HTTP client and webservice framework Group: Development/Libraries License: MIT URL: http://guzzlephp.org -Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz + +# GitHub export does not include tests. +# Run php-guzzlehttp-guzzle.sh to create full source. +Source0: %{name}-%{github_version}-%{github_commit}.tar.gz +Source1: %{name}-get-source.sh BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -60,7 +64,7 @@ BuildRequires: php-guzzlehttp-ringphp-tests BuildRequires: php(language) >= %{php_min_ver} #BuildRequires: php-composer(guzzlehttp/ringphp) >= %%{ring_min_ver} BuildRequires: php-guzzlehttp-ringphp >= %{ring_min_ver} -## phpcompatinfo (computed from version 5.3.0) +## phpcompatinfo (computed from version 5.3.1) BuildRequires: php-curl BuildRequires: php-date BuildRequires: php-filter @@ -81,7 +85,7 @@ Requires: php(language) >= %{php_min_ver} #Requires: php-composer(guzzlehttp/ringphp) >= %%{ring_min_ver} Requires: php-guzzlehttp-ringphp >= %{ring_min_ver} Requires: php-composer(guzzlehttp/ringphp) < %{ring_max_ver} -# phpcompatinfo (computed from version 5.3.0) +# phpcompatinfo (computed from version 5.3.1) Requires: php-curl Requires: php-date Requires: php-filter @@ -114,13 +118,14 @@ the pain out of consuming web services. %prep %setup -qn %{github_name}-%{github_commit} + +%build : Create autoloader cat <<'AUTOLOAD' | tee src/autoload.php addPrefix('GuzzleHttp\\', dirname(__DIR__)); +// Required dependency require_once '%{phpdir}/GuzzleHttp/Ring/autoload.php'; return $fedoraClassLoader; AUTOLOAD -%build -# Empty build section, nothing required - - %install rm -rf %{buildroot} mkdir -p %{buildroot}%{phpdir}/GuzzleHttp @@ -158,8 +160,7 @@ cp -pr src/* %{buildroot}%{phpdir}/GuzzleHttp/ cat <<'AUTOLOAD' | tee tests/autoload.php addPrefix('GuzzleHttp\\Tests', __DIR__); AUTOLOAD @@ -172,7 +173,38 @@ sed -e "s#.*require.*autoload.*#require __DIR__ . '/autoload.php';#" \ mkdir tests/GuzzleHttp ln -s .. tests/GuzzleHttp/Tests -%{_bindir}/phpunit --verbose +run=0 +ret=0 +if which php56; then + php56 %{_bindir}/phpunit + run=1 +fi + +%if 1 +: Skip allowed failures +: https://github.com/guzzle/guzzle/blob/5.3.1/.travis.yml +: https://travis-ci.org/guzzle/guzzle/builds/145548161 +sed -e 's/function testLoadsFromFileFile/function SKIP_testLoadsFromFileFile/' \ + -e 's/function testPersistsToFileFile/function SKIP_testPersistsToFileFile/' \ + -i tests/Cookie/FileCookieJarTest.php +sed -e 's/function testLoadsFromSession/function SKIP_testLoadsFromSession/' \ + -e 's/function testPersistsToSession/function SKIP_testPersistsToSession/' \ + -i tests/Cookie/SessionCookieJarTest.php +sed -e 's/function testParsesJsonResponses/function SKIP_testParsesJsonResponses/' \ + -e 's/function testThrowsExceptionWhenFailsToParseJsonResponse/function SKIP_testThrowsExceptionWhenFailsToParseJsonResponse/' \ + -i tests/Message/ResponseTest.php +sed 's/function testEnsuresResponseIsPresentAfterSending/function SKIP_testEnsuresResponseIsPresentAfterSending/' \ + -i tests/ClientTest.php +%endif + +if which php71; then + php71 %{_bindir}/phpunit || ret=1 + run=1 +fi +if [ $run -eq 0 ]; then +%{_bindir}/phpunit --verbose || ret=1 +fi +exit $ret %else : Tests skipped %endif @@ -192,6 +224,14 @@ rm -rf %{buildroot} %changelog +* Tue Jul 19 2016 Remi Collet - 5.3.1-1 +- update to 5.3.1 (bacported from Fedora) +- run test suite with both PHP 5 and 7 when available + +* Mon Jul 18 2016 Shawn Iwinski - 5.3.1-1 +- Update to 5.3.1 (RHBZ #1350616 / RHBZ #1357580 / CVE-2016-5385) +- Add "get source" script + * Fri Apr 15 2016 Remi Collet - 5.3.0-4.1 - fix dep. on EL-5 -- cgit