diff options
Diffstat (limited to 'php-jdorn-sql-formatter.spec')
-rw-r--r-- | php-jdorn-sql-formatter.spec | 72 |
1 files changed, 33 insertions, 39 deletions
diff --git a/php-jdorn-sql-formatter.spec b/php-jdorn-sql-formatter.spec index e49707a..3596077 100644 --- a/php-jdorn-sql-formatter.spec +++ b/php-jdorn-sql-formatter.spec @@ -1,8 +1,8 @@ # remirepo spec file for php-jdorn-sql-formatter, from Fedora: # -# RPM spec file for php-jdorn-sql-formatter +# Fedora spec file for php-jdorn-sql-formatter # -# Copyright (c) 2015 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2015-2017 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -29,7 +29,7 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 2%{?dist} +Release: 5%{?dist} Summary: PHP SQL highlighting library Group: Development/Libraries @@ -38,7 +38,6 @@ URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz BuildArch: noarch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # Tests %if %{with_tests} ## composer.json @@ -47,7 +46,7 @@ BuildRequires: php(language) >= %{php_min_ver} ## phpcompatinfo (computed from version 1.2.17) BuildRequires: php-pcre ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json @@ -55,7 +54,7 @@ Requires: php(language) >= %{php_min_ver} # phpcompatinfo (computed from version 1.2.17) Requires: php-pcre # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -66,34 +65,12 @@ A lightweight php class for formatting sql statements. It can automatically indent and add line breaks in addition to syntax highlighting. +Autoloader: %{libdir}/autoload.php + %prep %setup -qn %{github_name}-%{github_commit} -: Create autoloader -(cat <<'AUTOLOAD' -<?php -/** - * Autoloader created by %{name}-%{version}-%{release} - * - * @return \Symfony\Component\ClassLoader\ClassLoader - */ - -if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) { - if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) { - require_once 'Symfony/Component/ClassLoader/ClassLoader.php'; - } - - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} - -$fedoraClassLoader->addPrefix('SqlFormatter', __DIR__); - -return $fedoraClassLoader; -AUTOLOAD -) | tee lib/autoload.php - : Modify examples sed "s#require.*SqlFormatter.*#require_once '%{libdir}/autoload.php';#" \ -i examples/cli.php \ @@ -101,30 +78,43 @@ sed "s#require.*SqlFormatter.*#require_once '%{libdir}/autoload.php';#" \ %build -# Empty build section, nothing required +: Create autoloader +cat <<'AUTOLOAD' | tee lib/autoload.php +<?php +/** + * Autoloader for %{name} and its' dependencies + * (created by %{name}-%{version}-%{release}). + */ +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; + +\Fedora\Autoloader\Autoload::addPsr4('SqlFormatter\\', __DIR__); +AUTOLOAD %install -rm -rf %{buildroot} - mkdir -p %{buildroot}%{libdir} cp -pr lib/* %{buildroot}%{libdir}/ %check %if %{with_tests} -%{_bindir}/phpunit --bootstrap %{buildroot}%{libdir}/autoload.php +: Upstream tests +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do + if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then + $PHP_EXEC $PHPUNIT --verbose \ + --bootstrap %{buildroot}%{libdir}/autoload.php \ + || RETURN_CODE=1 + fi +done +exit $RETURN_CODE %else : Tests skipped %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE.txt %doc *.md @@ -134,6 +124,10 @@ rm -rf %{buildroot} %changelog +* Mon May 15 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.17-5 +- Switch autoloader to php-composer(fedora/autoloader) +- Test with SCLs if available + * Wed Jun 17 2015 Remi Collet <remi@remirepo.net> - 1.2.17-2 - add backport stuff for remirepo |