Shawn Iwinski 90002fc
#
Shawn Iwinski 90002fc
# Fedora spec file for php-guzzlehttp-psr7
Shawn Iwinski 90002fc
#
498439d
# Copyright (c) 2015-2017 Shawn Iwinski <shawn.iwinski@gmail.com>
Shawn Iwinski 90002fc
#
Shawn Iwinski 90002fc
# License: MIT
Shawn Iwinski 90002fc
# http://opensource.org/licenses/MIT
Shawn Iwinski 90002fc
#
Shawn Iwinski 90002fc
# Please preserve changelog entries
Shawn Iwinski 90002fc
#
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
%global github_owner     guzzle
Shawn Iwinski 90002fc
%global github_name      psr7
a6b9f1c
%global github_version   1.4.2
a6b9f1c
%global github_commit    f5b8a8512e2b58b0071a7280e39f14f72e05d87c
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
%global composer_vendor  guzzlehttp
Shawn Iwinski 90002fc
%global composer_project psr7
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
# "php": ">=5.4.0"
Shawn Iwinski 90002fc
%global php_min_ver 5.4.0
Shawn Iwinski 90002fc
# "psr/http-message": "~1.0"
Shawn Iwinski 90002fc
%global psr_http_message_min_ver 1.0
Shawn Iwinski 90002fc
%global psr_http_message_max_ver 2.0
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
# Build using "--without tests" to disable tests
Shawn Iwinski 90002fc
%global with_tests 0%{!?_without_tests:1}
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
%{!?phpdir:  %global phpdir  %{_datadir}/php}
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
Name:          php-%{composer_vendor}-%{composer_project}
Shawn Iwinski 90002fc
Version:       %{github_version}
498439d
Release:       1%{?github_release}%{?dist}
Shawn Iwinski 90002fc
Summary:       PSR-7 message implementation
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
Group:         Development/Libraries
Shawn Iwinski 90002fc
License:       MIT
Shawn Iwinski 90002fc
URL:           https://github.com/%{github_owner}/%{github_name}
498439d
498439d
# GitHub export does not include tests.
498439d
# Run php-guzzlehttp-psr7-get-source.sh to create full source.
498439d
Source0:       %{name}-%{github_version}-%{github_commit}.tar.gz
498439d
Source1:       %{name}-get-source.sh
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
BuildArch:     noarch
Shawn Iwinski 90002fc
# Tests
Shawn Iwinski 90002fc
%if %{with_tests}
Shawn Iwinski 90002fc
## composer.json
498439d
BuildRequires: php(language) >= %{php_min_ver}
Shawn Iwinski 90002fc
BuildRequires: php-composer(phpunit/phpunit)
498439d
BuildRequires: php-composer(psr/http-message) <  %{psr_http_message_max_ver}
Shawn Iwinski 90002fc
BuildRequires: php-composer(psr/http-message) >= %{psr_http_message_min_ver}
a6b9f1c
## phpcompatinfo (computed from version 1.4.2)
Shawn Iwinski 90002fc
BuildRequires: php-hash
Shawn Iwinski 90002fc
BuildRequires: php-pcre
8bd5837
BuildRequires: php-reflection
Shawn Iwinski 90002fc
BuildRequires: php-spl
Shawn Iwinski 90002fc
BuildRequires: php-zlib
Shawn Iwinski 90002fc
## Autoloader
498439d
BuildRequires: php-composer(fedora/autoloader)
Shawn Iwinski 90002fc
%endif
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
# composer.json
498439d
Requires:      php(language) >= %{php_min_ver}
Shawn Iwinski 90002fc
Requires:      php-composer(psr/http-message) <  %{psr_http_message_max_ver}
498439d
Requires:      php-composer(psr/http-message) >= %{psr_http_message_min_ver}
a6b9f1c
# phpcompatinfo (computed from version 1.4.2)
Shawn Iwinski 90002fc
Requires:      php-hash
Shawn Iwinski 90002fc
Requires:      php-pcre
Shawn Iwinski 90002fc
Requires:      php-spl
Shawn Iwinski 90002fc
# Autoloader
498439d
Requires:      php-composer(fedora/autoloader)
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
# Composer
Shawn Iwinski 90002fc
Provides:      php-composer(%{composer_vendor}/%{composer_project}) = %{version}
498439d
Provides:      php-composer(psr/http-message-implementation) = 1.0
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
%description
Shawn Iwinski 90002fc
PSR-7 message implementation, several stream decorators, and some helpful
Shawn Iwinski 90002fc
functionality like query string parsing.
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
%prep
Shawn Iwinski 90002fc
%setup -qn %{github_name}-%{github_commit}
Shawn Iwinski 90002fc
498439d
498439d
%build
Shawn Iwinski 90002fc
: Create autoloader
Shawn Iwinski ce9f2e0
cat <<'AUTOLOAD' | tee src/autoload.php
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
/**
Shawn Iwinski 90002fc
 * Autoloader for %{name} and its' dependencies
Shawn Iwinski 3b6086e
 * (created by %{name}-%{version}-%{release}).
Shawn Iwinski 90002fc
 */
498439d
require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
Shawn Iwinski 90002fc
498439d
\Fedora\Autoloader\Autoload::addPsr4('GuzzleHttp\\Psr7\\', __DIR__);
a6b9f1c
require_once __DIR__.'/functions_include.php';
Shawn Iwinski 90002fc
498439d
\Fedora\Autoloader\Dependencies::required([
498439d
    '%{phpdir}/Psr/Http/Message/autoload.php',
498439d
]);
Shawn Iwinski 90002fc
AUTOLOAD
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
%install
Shawn Iwinski 90002fc
mkdir -p %{buildroot}%{phpdir}/GuzzleHttp/Psr7
Shawn Iwinski 90002fc
cp -rp src/* %{buildroot}%{phpdir}/GuzzleHttp/Psr7/
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
%check
Shawn Iwinski 90002fc
%if %{with_tests}
498439d
: Upstream tests
a6b9f1c
RETURN_CODE=0
a6b9f1c
for PHP_EXEC in php %{?rhel:php55} php56 php70 php71; do
a6b9f1c
    if [ "php" == "$PHP_EXEC" ] || which $PHP_EXEC; then
a6b9f1c
        $PHP_EXEC %{_bindir}/phpunit --verbose \
a6b9f1c
            --bootstrap %{buildroot}%{phpdir}/GuzzleHttp/Psr7/autoload.php \
a6b9f1c
            || RETURN_CODE=1
498439d
    fi
498439d
done
a6b9f1c
exit $RETURN_CODE
Shawn Iwinski 90002fc
%else
Shawn Iwinski 90002fc
: Tests skipped
Shawn Iwinski 90002fc
%endif
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
%files
Shawn Iwinski 90002fc
%{!?_licensedir:%global license %%doc}
Shawn Iwinski 90002fc
%license LICENSE
Shawn Iwinski 90002fc
%doc *.md
Shawn Iwinski 90002fc
%doc composer.json
Shawn Iwinski 90002fc
%dir %{phpdir}/GuzzleHttp
Shawn Iwinski 90002fc
     %{phpdir}/GuzzleHttp/Psr7
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
%changelog
a6b9f1c
* Sat Apr 08 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.4.2-1
a6b9f1c
- Updated to 1.4.2 (RHBZ #1434198)
a6b9f1c
- Don't use autoloader to load functions include
a6b9f1c
498439d
* Sat Mar 04 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.4.1-1
498439d
- Updated to 1.4.1 (RHBZ #1425429)
498439d
- Switch autoloader to php-composer(fedora/autoloader)
498439d
- Test with SCLs if available
498439d
ef34a2c
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-2
ef34a2c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
ef34a2c
64f274f
* Sun Jul 03 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.3.1-1
64f274f
- Updated to 1.3.1 (RHBZ #1352354)
64f274f
8bd5837
* Sun May 29 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.3.0-1
8bd5837
- Updated to 1.3.0 (RHBZ #1326975)
8bd5837
Shawn Iwinski 3b6086e
* Fri Mar 11 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.3-1
Shawn Iwinski 3b6086e
- Updated to 1.2.3 (RHBZ #1301276)
Shawn Iwinski 3b6086e
717ff59
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-2
717ff59
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
717ff59
Shawn Iwinski d280dd7
* Wed Nov 04 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.1-1
Shawn Iwinski d280dd7
- Updated to 1.2.1 (RHBZ #1277467)
Shawn Iwinski d280dd7
Shawn Iwinski ce9f2e0
* Sun Aug 16 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.0-1
Shawn Iwinski ce9f2e0
- Updated to 1.2.0 (RHBZ #1253997)
Shawn Iwinski ce9f2e0
- Updated autoloader to load dependencies after self registration
Shawn Iwinski ce9f2e0
Shawn Iwinski 6e03bd8
* Sun Jul 19 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.1.0-3
Shawn Iwinski 6e03bd8
- Use full paths in autoloader
Shawn Iwinski 6e03bd8
Shawn Iwinski 90002fc
* Wed Jul 08 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.1.0-2
Shawn Iwinski 90002fc
- Add autoloader dependencies
Shawn Iwinski 90002fc
- Modify autoloader
Shawn Iwinski 90002fc
Shawn Iwinski 90002fc
* Mon Jul 06 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.1.0-1
Shawn Iwinski 90002fc
- Initial package