Shawn Iwinski fa0b303
#
Shawn Iwinski fa0b303
# Fedora spec file for php-typo3-phar-stream-wrapper2
Shawn Iwinski fa0b303
#
Shawn Iwinski fa0b303
# Copyright (c) 2019 Shawn Iwinski <shawn@iwin.ski>
Shawn Iwinski fa0b303
#
Shawn Iwinski fa0b303
# License: MIT
Shawn Iwinski fa0b303
# http://opensource.org/licenses/MIT
Shawn Iwinski fa0b303
#
Shawn Iwinski fa0b303
# Please preserve changelog entries
Shawn Iwinski fa0b303
#
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
%global github_owner     TYPO3
Shawn Iwinski fa0b303
%global github_name      phar-stream-wrapper
7670191
%global github_version   2.1.3
7670191
%global github_commit    e8a656d72028b97ab9f61ed993734f3cded02eeb
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
%global composer_vendor  typo3
Shawn Iwinski fa0b303
%global composer_project phar-stream-wrapper
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
# "php": "^5.3.3|^7.0"
Shawn Iwinski fa0b303
%global php_min_ver 5.3.3
eec0925
# "brumann/polyfill-unserialize": "^1.0"
eec0925
%global polyfill_unserialize_min_ver 1.0
eec0925
%global polyfill_unserialize_max_ver 2.0
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
# Build using "--without tests" to disable tests
Shawn Iwinski fa0b303
%global with_tests 0%{!?_without_tests:1}
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
%{!?phpdir:  %global phpdir  %{_datadir}/php}
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
Name:          php-%{composer_vendor}-%{composer_project}2
Shawn Iwinski fa0b303
Version:       %{github_version}
e0eff86
Release:       3%{?github_release}%{?dist}
Shawn Iwinski fa0b303
Summary:       Interceptors for PHP's native phar:// stream handling (v2)
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
License:       MIT
Shawn Iwinski fa0b303
URL:           https://github.com/%{github_owner}/%{github_name}
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
# GitHub export does not include tests.
Shawn Iwinski fa0b303
# Run php-typo3-phar-stream-wrapper2-get-source.sh to create full source.
Shawn Iwinski fa0b303
Source0:       %{name}-%{github_version}-%{github_commit}.tar.gz
Shawn Iwinski fa0b303
Source1:       %{name}-get-source.sh
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
BuildArch:     noarch
Shawn Iwinski fa0b303
# Tests
Shawn Iwinski fa0b303
%if %{with_tests}
Shawn Iwinski fa0b303
## composer.json
Shawn Iwinski fa0b303
BuildRequires: php(language) >= %{php_min_ver}
Shawn Iwinski fa0b303
BuildRequires: php-composer(phpunit/phpunit)
eec0925
BuildRequires: php-fileinfo
eec0925
BuildRequires: php-json
eec0925
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
eec0925
BuildRequires: (php-composer(brumann/polyfill-unserialize) >= %{polyfill_unserialize_min_ver} with php-composer(brumann/polyfill-unserialize) < %{polyfill_unserialize_max_ver})
eec0925
%else
eec0925
BuildRequires: php-composer(brumann/polyfill-unserialize) >= %{polyfill_unserialize_min_ver}
eec0925
BuildRequires: php-composer(brumann/polyfill-unserialize) <  %{polyfill_unserialize_max_ver}
eec0925
%endif
eec0925
## phpcompatinfo for version 2.1.2
eec0925
BuildRequires: php-pcre
Shawn Iwinski fa0b303
BuildRequires: php-pecl(opcache)
eec0925
BuildRequires: php-reflection
Shawn Iwinski fa0b303
BuildRequires: php-spl
Shawn Iwinski fa0b303
## Autoloader
Shawn Iwinski fa0b303
BuildRequires: php-composer(fedora/autoloader)
Shawn Iwinski fa0b303
%endif
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
# composer.json
Shawn Iwinski fa0b303
Requires:      php(language) >= %{php_min_ver}
eec0925
Requires:      php-json
eec0925
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
eec0925
Requires:      (php-composer(brumann/polyfill-unserialize) >= %{polyfill_unserialize_min_ver} with php-composer(brumann/polyfill-unserialize) < %{polyfill_unserialize_max_ver})
eec0925
%else
eec0925
Requires:      php-composer(brumann/polyfill-unserialize) >= %{polyfill_unserialize_min_ver}
eec0925
Requires:      php-composer(brumann/polyfill-unserialize) <  %{polyfill_unserialize_max_ver}
eec0925
%endif
eec0925
# phpcompatinfo for version 2.1.2
eec0925
Requires:      php-pcre
Shawn Iwinski fa0b303
Requires:      php-spl
Shawn Iwinski fa0b303
# Autoloader
Shawn Iwinski fa0b303
Requires:      php-composer(fedora/autoloader)
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
# Weak dependencies
eec0925
%if 0%{?fedora} >= 21 || 0%{?rhel} >= 8
eec0925
Suggests:      php-fileinfo
Shawn Iwinski fa0b303
Suggests:      php-pecl(opcache)
Shawn Iwinski fa0b303
%endif
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
# Composer
Shawn Iwinski fa0b303
Provides:      php-composer(%{composer_vendor}/%{composer_project}) = %{version}
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
%description
Shawn Iwinski fa0b303
%{summary}.
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
Autoloader: %{phpdir}/TYPO3/PharStreamWrapper2/autoload.php
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
%prep
Shawn Iwinski fa0b303
%setup -qn %{github_name}-%{github_commit}
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
%build
Shawn Iwinski fa0b303
: Create autoloader
Shawn Iwinski fa0b303
cat <<'AUTOLOAD' | tee src/autoload.php
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
/**
Shawn Iwinski fa0b303
 * Autoloader for %{name} and its' dependencies
Shawn Iwinski fa0b303
 * (created by %{name}-%{version}-%{release}).
Shawn Iwinski fa0b303
 */
Shawn Iwinski fa0b303
require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
\Fedora\Autoloader\Autoload::addPsr4('TYPO3\\PharStreamWrapper\\', __DIR__);
eec0925
eec0925
\Fedora\Autoloader\Dependencies::required(array(
eec0925
    '%{phpdir}/Brumann/Polyfill/autoload.php',
eec0925
));
Shawn Iwinski fa0b303
AUTOLOAD
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
%install
Shawn Iwinski fa0b303
mkdir -p %{buildroot}%{phpdir}/TYPO3
Shawn Iwinski fa0b303
cp -rp src %{buildroot}%{phpdir}/TYPO3/PharStreamWrapper2
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
%check
Shawn Iwinski fa0b303
%if %{with_tests}
Shawn Iwinski fa0b303
: Create tests bootstrap
Shawn Iwinski fa0b303
cat <<'BOOTSTRAP' | tee bootstrap.php
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
require '%{buildroot}%{phpdir}/TYPO3/PharStreamWrapper2/autoload.php';
eec0925
\Fedora\Autoloader\Autoload::addPsr4('TYPO3\\PharStreamWrapper\\Tests\\', __DIR__.'/tests');
Shawn Iwinski fa0b303
BOOTSTRAP
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
: Upstream tests
Shawn Iwinski fa0b303
RETURN_CODE=0
Shawn Iwinski fa0b303
PHPUNIT=$(which phpunit)
eec0925
for PHP_EXEC in php php70 php71 php72 php73 php74; do
Shawn Iwinski fa0b303
    if [ "php" == "$PHP_EXEC" ] || which $PHP_EXEC; then
eec0925
        $PHP_EXEC $PHPUNIT --verbose \
eec0925
            --testsuite "unit tests" \
eec0925
            --bootstrap bootstrap.php || RETURN_CODE=1
Shawn Iwinski fa0b303
    fi
Shawn Iwinski fa0b303
done
Shawn Iwinski fa0b303
exit $RETURN_CODE
Shawn Iwinski fa0b303
%else
Shawn Iwinski fa0b303
: Tests skipped
Shawn Iwinski fa0b303
%endif
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
%files
Shawn Iwinski fa0b303
%{!?_licensedir:%global license %%doc}
Shawn Iwinski fa0b303
%license LICENSE
Shawn Iwinski fa0b303
%doc *.md
Shawn Iwinski fa0b303
%doc composer.json
Shawn Iwinski fa0b303
%dir %{phpdir}/TYPO3
Shawn Iwinski fa0b303
     %{phpdir}/TYPO3/PharStreamWrapper2
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
Shawn Iwinski fa0b303
%changelog
e0eff86
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-3
e0eff86
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
e0eff86
3b59eb2
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-2
3b59eb2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
3b59eb2
7670191
* Sat Nov 16 2019 Shawn Iwinski <shawn@iwin.ski> - 2.1.3-1
7670191
- Update to 2.1.3 (RHBZ #1763189)
7670191
89d1d40
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.2-2
89d1d40
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
89d1d40
eec0925
* Sun Jun 16 2019 Shawn Iwinski <shawn@iwin.ski> - 2.1.2-1
eec0925
- Update to 2.1.2 (RHBZ #1708652, #1708653, #1708646, #1708649)
eec0925
- https://typo3.org/security/advisory/typo3-psa-2019-007/
eec0925
- https://nvd.nist.gov/vuln/detail/CVE-2019-11831
eec0925
- https://typo3.org/security/advisory/typo3-psa-2019-008/
eec0925
- https://nvd.nist.gov/vuln/detail/CVE-2019-11830
eec0925
Shawn Iwinski fa0b303
* Sat Feb 23 2019 Shawn Iwinski <shawn@iwin.ski> - 2.0.1-1
Shawn Iwinski fa0b303
- Initial package