summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-05-16 07:45:43 +0200
committerRemi Collet <remi@remirepo.net>2017-05-16 07:45:43 +0200
commit4439759dc3894f9bb4b5748207468d0a5e2253f7 (patch)
treef2ccef791ab03f2f29d3cd09d710b96b5fc52ff7
parentb666e636e5214c5f9b799acf6b0a596045993a01 (diff)
sync with FedoraHEADmaster
-rw-r--r--.gitignore7
-rw-r--r--composer.json30
-rw-r--r--php-jdorn-sql-formatter.spec72
3 files changed, 70 insertions, 39 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1ab5c4f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+package-*.xml
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..0f29a05
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,30 @@
+{
+ "name": "jdorn/sql-formatter",
+ "description": "a PHP SQL highlighting library",
+ "homepage": "https://github.com/jdorn/sql-formatter/",
+ "keywords": ["sql", "highlight"],
+ "minimum-stability": "dev",
+ "license": "MIT",
+ "type": "library",
+ "require": {
+ "php": ">=5.2.4"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "3.7.*"
+ },
+ "authors": [
+ {
+ "name": "Jeremy Dorn",
+ "email": "jeremy@jeremydorn.com",
+ "homepage": "http://jeremydorn.com/"
+ }
+ ],
+ "autoload": {
+ "classmap": ["lib"]
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3.x-dev"
+ }
+ }
+}
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