Blame php-stecman-symfony-console-completion.spec

Shawn Iwinski b98e644
#
Shawn Iwinski b98e644
# Fedora spec file for php-stecman-symfony-console-completion
Shawn Iwinski b98e644
#
b208308
# Copyright (c) 2017-2019 Shawn Iwinski <shawn@iwin.ski>
Shawn Iwinski b98e644
#
Shawn Iwinski b98e644
# License: MIT
Shawn Iwinski b98e644
# http://opensource.org/licenses/MIT
Shawn Iwinski b98e644
#
Shawn Iwinski b98e644
# Please preserve changelog entries
Shawn Iwinski b98e644
#
Shawn Iwinski b98e644
Shawn Iwinski b98e644
%global github_owner     stecman
Shawn Iwinski b98e644
%global github_name      symfony-console-completion
b208308
%global github_version   0.10.1
b208308
%global github_commit    7bfa9b93e216896419f2f8de659935d7e04fecd8
Shawn Iwinski b98e644
Shawn Iwinski b98e644
%global composer_vendor  stecman
Shawn Iwinski b98e644
%global composer_project symfony-console-completion
Shawn Iwinski b98e644
Shawn Iwinski b98e644
# "php": ">=5.3.2"
Shawn Iwinski b98e644
%global php_min_ver 5.3.2
b208308
# "symfony/console": "~2.3 || ~3.0 || ~4.0"
Shawn Iwinski b98e644
#     NOTE: Min version not 2.3 because autoloader required
Shawn Iwinski b98e644
%global symfony_min_ver %{?el6:2.3.31}%{!?el6:2.7.1}
b208308
%global symfony_max_ver 5.0
Shawn Iwinski b98e644
Shawn Iwinski b98e644
# Build using "--without tests" to disable tests
Shawn Iwinski b98e644
%global with_tests 0%{!?_without_tests:1}
Shawn Iwinski b98e644
Shawn Iwinski b98e644
%{!?phpdir:  %global phpdir  %{_datadir}/php}
Shawn Iwinski b98e644
Shawn Iwinski b98e644
Name:          php-%{composer_vendor}-%{composer_project}
Shawn Iwinski b98e644
Version:       %{github_version}
2fd253e
Release:       3%{?github_release}%{?dist}
Shawn Iwinski b98e644
Summary:       Automatic BASH completion for Symfony Console based applications
Shawn Iwinski b98e644
Shawn Iwinski b98e644
License:       MIT
Shawn Iwinski b98e644
URL:           https://github.com/%{github_owner}/%{github_name}
Shawn Iwinski b98e644
Source0:       %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
Shawn Iwinski b98e644
Shawn Iwinski b98e644
BuildArch:     noarch
Shawn Iwinski b98e644
# Tests
Shawn Iwinski b98e644
%if %{with_tests}
Shawn Iwinski b98e644
## composer.json
Shawn Iwinski b98e644
BuildRequires: php(language) >= %{php_min_ver}
Shawn Iwinski b98e644
BuildRequires: php-composer(phpunit/phpunit)
b208308
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
b208308
BuildRequires: (php-composer(symfony/console) >= %{symfony_min_ver} with php-composer(symfony/console) < %{symfony_max_ver})
b208308
%else
Shawn Iwinski b98e644
BuildRequires: php-composer(symfony/console) <  %{symfony_max_ver}
Shawn Iwinski b98e644
BuildRequires: php-composer(symfony/console) >= %{symfony_min_ver}
b208308
%endif
b208308
## phpcompatinfo for version 0.10.1
Shawn Iwinski b98e644
BuildRequires: php-pcre
b208308
BuildRequires: php-reflection
Shawn Iwinski b98e644
BuildRequires: php-spl
Shawn Iwinski b98e644
## Autoloader
Shawn Iwinski b98e644
BuildRequires: php-composer(fedora/autoloader)
Shawn Iwinski b98e644
%endif
Shawn Iwinski b98e644
Shawn Iwinski b98e644
# composer.json
Shawn Iwinski b98e644
Requires:      php(language) >= %{php_min_ver}
b208308
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
b208308
Requires:      (php-composer(symfony/console) >= %{symfony_min_ver} with php-composer(symfony/console) < %{symfony_max_ver})
b208308
%else
Shawn Iwinski b98e644
Requires:      php-composer(symfony/console) <  %{symfony_max_ver}
Shawn Iwinski b98e644
Requires:      php-composer(symfony/console) >= %{symfony_min_ver}
b208308
%endif
b208308
# phpcompatinfo for version 0.10.1
Shawn Iwinski b98e644
Requires:      php-pcre
Shawn Iwinski b98e644
Requires:      php-spl
Shawn Iwinski b98e644
# Autoloader
Shawn Iwinski b98e644
Requires:      php-composer(fedora/autoloader)
Shawn Iwinski b98e644
Shawn Iwinski b98e644
# Composer
Shawn Iwinski b98e644
Provides:      php-composer(%{composer_vendor}/%{composer_project}) = %{version}
Shawn Iwinski b98e644
Shawn Iwinski b98e644
%description
Shawn Iwinski b98e644
This package provides automatic (tab) completion in BASH and ZSH for Symfony
Shawn Iwinski b98e644
Console Component based applications. With zero configuration, this package
Shawn Iwinski b98e644
allows completion of available command names and the options they provide.
Shawn Iwinski b98e644
User code can define custom completion behaviour for argument and option values.
Shawn Iwinski b98e644
Shawn Iwinski b98e644
Autoloader:
Shawn Iwinski b98e644
%{phpdir}/Stecman/Component/Symfony/Console/BashCompletion/autoload.php
Shawn Iwinski b98e644
Shawn Iwinski b98e644
Shawn Iwinski b98e644
%prep
Shawn Iwinski b98e644
%setup -qn %{github_name}-%{github_commit}
Shawn Iwinski b98e644
Shawn Iwinski b98e644
Shawn Iwinski b98e644
%build
Shawn Iwinski b98e644
: Create autoloader
Shawn Iwinski b98e644
cat <<'AUTOLOAD' | tee src/autoload.php
Shawn Iwinski b98e644
Shawn Iwinski b98e644
/**
Shawn Iwinski b98e644
 * Autoloader for %{name} and its' dependencies
Shawn Iwinski b98e644
 * (created by %{name}-%{version}-%{release}).
Shawn Iwinski b98e644
 */
Shawn Iwinski b98e644
require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
Shawn Iwinski b98e644
Shawn Iwinski b98e644
\Fedora\Autoloader\Autoload::addPsr4(
Shawn Iwinski b98e644
    'Stecman\\Component\\Symfony\\Console\\BashCompletion\\',
Shawn Iwinski b98e644
    __DIR__
Shawn Iwinski b98e644
);
Shawn Iwinski b98e644
Shawn Iwinski b98e644
\Fedora\Autoloader\Dependencies::required(array(
Shawn Iwinski b98e644
    array(
b208308
        '%{phpdir}/Symfony4/Component/Console/autoload.php',
Shawn Iwinski b98e644
        '%{phpdir}/Symfony3/Component/Console/autoload.php',
Shawn Iwinski b98e644
        '%{phpdir}/Symfony/Component/Console/autoload.php',
Shawn Iwinski b98e644
    ),
Shawn Iwinski b98e644
));
Shawn Iwinski b98e644
AUTOLOAD
Shawn Iwinski b98e644
Shawn Iwinski b98e644
Shawn Iwinski b98e644
%install
Shawn Iwinski b98e644
mkdir -p %{buildroot}%{phpdir}/Stecman/Component/Symfony/Console
Shawn Iwinski b98e644
cp -rp src %{buildroot}%{phpdir}/Stecman/Component/Symfony/Console/BashCompletion
Shawn Iwinski b98e644
Shawn Iwinski b98e644
Shawn Iwinski b98e644
%check
Shawn Iwinski b98e644
%if %{with_tests}
21b6111
: Create tests bootstrap
21b6111
cat <<'BOOTSTRAP' | tee -a bootstrap.php
21b6111
21b6111
require_once '%{buildroot}%{phpdir}/Stecman/Component/Symfony/Console/BashCompletion/autoload.php';
21b6111
if (!class_exists('PHPUnit\\Framework\\TestCase')) {
21b6111
    class_alias('PHPUnit_Framework_TestCase', 'PHPUnit\\Framework\\TestCase');
21b6111
}
21b6111
BOOTSTRAP
21b6111
Shawn Iwinski b98e644
%if 0%{?el6}
Shawn Iwinski b98e644
: Skip tests requiring PHPUnit >= 4.4
Shawn Iwinski b98e644
sed \
Shawn Iwinski b98e644
    -e 's/function testCompleteDoubleDash/function SKIP_testCompleteDoubleDash/' \
Shawn Iwinski b98e644
    -e 's/function testCompleteOptionFull/function SKIP_testCompleteOptionFull/' \
21b6111
    -e 's/function testCompleteOptionShortcutFirst/function SKIP_testCompleteOptionShortcutFirst/' \
Shawn Iwinski b98e644
    -i tests/Stecman/Component/Symfony/Console/BashCompletion/CompletionHandlerTest.php
Shawn Iwinski b98e644
%endif
Shawn Iwinski b98e644
Shawn Iwinski b98e644
: Upstream tests
Shawn Iwinski b98e644
RETURN_CODE=0
Shawn Iwinski b98e644
PHPUNIT=$(which phpunit)
b208308
for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72 php73 php74; do
Shawn Iwinski b98e644
    if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
21b6111
        $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php || RETURN_CODE=1
Shawn Iwinski b98e644
    fi
Shawn Iwinski b98e644
done
Shawn Iwinski b98e644
exit $RETURN_CODE
Shawn Iwinski b98e644
%else
Shawn Iwinski b98e644
: Tests skipped
Shawn Iwinski b98e644
%endif
Shawn Iwinski b98e644
Shawn Iwinski b98e644
Shawn Iwinski b98e644
%files
Shawn Iwinski b98e644
%{!?_licensedir:%global license %%doc}
Shawn Iwinski 2aa78fe
%license LICENCE
Shawn Iwinski b98e644
%doc *.md
Shawn Iwinski b98e644
%doc composer.json
Shawn Iwinski b98e644
%dir %{phpdir}/Stecman
Shawn Iwinski b98e644
%dir %{phpdir}/Stecman/Component
Shawn Iwinski b98e644
%dir %{phpdir}/Stecman/Component/Symfony
Shawn Iwinski b98e644
%dir %{phpdir}/Stecman/Component/Symfony/Console
Shawn Iwinski b98e644
     %{phpdir}/Stecman/Component/Symfony/Console/BashCompletion
Shawn Iwinski b98e644
Shawn Iwinski b98e644
Shawn Iwinski b98e644
%changelog
2fd253e
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.10.1-3
2fd253e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
2fd253e
21b6111
* Tue May 14 2019 Shawn Iwinski <shawn@iwin.ski> - 0.10.1-2
21b6111
- Fix EPEL6 build
21b6111
b208308
* Tue May 14 2019 Shawn Iwinski <shawn@iwin.ski> - 0.10.1-1
b208308
- Update to 0.10.1 (RHBZ #1562562)
b208308
- Add range version dependencies for Fedora >= 27 || RHEL >= 8
b208308
93af053
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-5
93af053
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
93af053
f418011
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-4
f418011
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
f418011
0736c10
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-3
0736c10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
0736c10
Shawn Iwinski 2aa78fe
* Fri Nov 03 2017 Shawn Iwinski <shawn@iwin.ski> - 0.7.0-2
Shawn Iwinski 2aa78fe
- Remove rename of license file
Shawn Iwinski 2aa78fe
Shawn Iwinski b98e644
* Thu Oct 26 2017 Shawn Iwinski <shawn@iwin.ski> - 0.7.0-1
Shawn Iwinski b98e644
- Initial package