summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-09-02 15:15:04 +0200
committerRemi Collet <remi@remirepo.net>2019-09-02 15:15:04 +0200
commit082ab3738fa134831330d11d684a3e204511b170 (patch)
tree23eb1646e16c7e466d7416a55c089400e3d967b8
parentb6d403ca24b188b1570dc69dff1759161c9394f5 (diff)
- rename to php-phpmyadmin-sql-parser5
- move to /usr/share/php/PhpMyAdmin/SqlParser5 - raise dependency on PHP 7.1 - switch to phpunit7 - add patch for PHP 7.4 from https://github.com/phpmyadmin/sql-parser/pull/258
-rw-r--r--258.patch35
-rw-r--r--composer.json6
-rw-r--r--php-phpmyadmin-sql-parser5-autoload.patch34
-rw-r--r--php-phpmyadmin-sql-parser5.spec79
4 files changed, 99 insertions, 55 deletions
diff --git a/258.patch b/258.patch
new file mode 100644
index 0000000..ba6220a
--- /dev/null
+++ b/258.patch
@@ -0,0 +1,35 @@
+From 579f7445f7cfd8c3ff07f20fe836a1c56518656e Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 2 Sep 2019 15:02:02 +0200
+Subject: [PATCH] fix implode arg. order
+
+---
+ src/Components/Expression.php | 2 +-
+ src/Components/ExpressionArray.php | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/Components/Expression.php b/src/Components/Expression.php
+index 9c21def5..108f3350 100644
+--- a/src/Components/Expression.php
++++ b/src/Components/Expression.php
+@@ -433,7 +433,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
+ public static function build($component, array $options = [])
+ {
+ if (is_array($component)) {
+- return implode($component, ', ');
++ return implode(', ', $component);
+ }
+
+ if ($component->expr !== '' && ! is_null($component->expr)) {
+diff --git a/src/Components/ExpressionArray.php b/src/Components/ExpressionArray.php
+index 2f44d7af..eb05aac9 100644
+--- a/src/Components/ExpressionArray.php
++++ b/src/Components/ExpressionArray.php
+@@ -122,6 +122,6 @@ public static function build($component, array $options = [])
+ $ret[] = $frag::build($frag);
+ }
+
+- return implode($ret, ', ');
++ return implode(', ', $ret);
+ }
+ }
diff --git a/composer.json b/composer.json
index f4af964..c525411 100644
--- a/composer.json
+++ b/composer.json
@@ -16,14 +16,14 @@
"source": "https://github.com/phpmyadmin/sql-parser"
},
"require": {
- "php": ">=5.3.0",
+ "php": "^7.1",
"symfony/polyfill-mbstring": "^1.3"
},
"require-dev": {
"sami/sami": "^4.0",
"phpunit/php-code-coverage": "*",
- "phpunit/phpunit": "~4.8 || ~5.7 || ~6.5",
- "squizlabs/php_codesniffer": "^2.9"
+ "phpunit/phpunit": "^7.4",
+ "phpmyadmin/coding-standard": "^1.0"
},
"conflict": {
"phpmyadmin/motranslator": "<3.0"
diff --git a/php-phpmyadmin-sql-parser5-autoload.patch b/php-phpmyadmin-sql-parser5-autoload.patch
index 3cea924..e36b353 100644
--- a/php-phpmyadmin-sql-parser5-autoload.patch
+++ b/php-phpmyadmin-sql-parser5-autoload.patch
@@ -1,9 +1,9 @@
diff -up ./bin/highlight-query.rpm ./bin/highlight-query
---- ./bin/highlight-query.rpm 2019-06-03 14:32:07.000000000 +0200
-+++ ./bin/highlight-query 2019-06-04 19:06:37.085484476 +0200
-@@ -1,29 +1,7 @@
- #!/usr/bin/env php
+--- ./bin/highlight-query.rpm 2019-09-02 14:54:16.417436515 +0200
++++ ./bin/highlight-query 2019-09-02 14:55:10.825758789 +0200
+@@ -2,29 +2,7 @@
<?php
+ declare(strict_types=1);
-$files = array(
- __DIR__ . "/../vendor/autoload.php",
@@ -28,16 +28,16 @@ diff -up ./bin/highlight-query.rpm ./bin/highlight-query
- "php composer.phar install" . PHP_EOL
- );
-}
-+require '/usr/share/php/PhpMyAdmin/SqlParser/autoload.php';
++require '/usr/share/php/PhpMyAdmin/SqlParser5/autoload.php';
$cli = new PhpMyAdmin\SqlParser\Utils\CLI();
exit($cli->runHighlight());
diff -up ./bin/lint-query.rpm ./bin/lint-query
---- ./bin/lint-query.rpm 2019-06-03 14:32:07.000000000 +0200
-+++ ./bin/lint-query 2019-06-04 19:06:37.085484476 +0200
-@@ -1,29 +1,7 @@
- #!/usr/bin/env php
+--- ./bin/lint-query.rpm 2019-09-02 14:54:16.417436515 +0200
++++ ./bin/lint-query 2019-09-02 14:55:18.682805327 +0200
+@@ -2,29 +2,7 @@
<?php
+ declare(strict_types=1);
-$files = array(
- __DIR__ . "/../vendor/autoload.php",
@@ -62,16 +62,16 @@ diff -up ./bin/lint-query.rpm ./bin/lint-query
- "php composer.phar install" . PHP_EOL
- );
-}
-+require '/usr/share/php/PhpMyAdmin/SqlParser/autoload.php';
++require '/usr/share/php/PhpMyAdmin/SqlParser5/autoload.php';
$cli = new PhpMyAdmin\SqlParser\Utils\CLI();
exit($cli->runLint());
diff -up ./bin/tokenize-query.rpm ./bin/tokenize-query
---- ./bin/tokenize-query.rpm 2019-06-04 19:08:04.886758030 +0200
-+++ ./bin/tokenize-query 2019-06-04 19:08:09.025766484 +0200
-@@ -1,29 +1,7 @@
- #!/usr/bin/env php
+--- ./bin/tokenize-query.rpm 2019-09-02 14:54:16.418436521 +0200
++++ ./bin/tokenize-query 2019-09-02 14:55:29.169867441 +0200
+@@ -2,29 +2,7 @@
<?php
+ declare(strict_types=1);
-$files = array(
- __DIR__ . "/../vendor/autoload.php",
@@ -96,13 +96,13 @@ diff -up ./bin/tokenize-query.rpm ./bin/tokenize-query
- "php composer.phar install" . PHP_EOL
- );
-}
-+require '/usr/share/php/PhpMyAdmin/SqlParser/autoload.php';
++require '/usr/share/php/PhpMyAdmin/SqlParser5/autoload.php';
$cli = new PhpMyAdmin\SqlParser\Utils\CLI();
exit($cli->runTokenize());
diff -up ./src/Translator.php.rpm ./src/Translator.php
---- ./src/Translator.php.rpm 2019-06-03 14:32:07.000000000 +0200
-+++ ./src/Translator.php 2019-06-04 19:06:37.085484476 +0200
+--- ./src/Translator.php.rpm 2019-05-10 02:57:14.000000000 +0200
++++ ./src/Translator.php 2019-09-02 14:54:16.418436521 +0200
@@ -40,7 +40,7 @@ class Translator
self::$loader->textdomain('sqlparser');
diff --git a/php-phpmyadmin-sql-parser5.spec b/php-phpmyadmin-sql-parser5.spec
index bcc035a..340cfec 100644
--- a/php-phpmyadmin-sql-parser5.spec
+++ b/php-phpmyadmin-sql-parser5.spec
@@ -1,4 +1,4 @@
-# remirepo/fedora spec file for php-phpmyadmin-sql-parser
+# remirepo/fedora spec file for php-phpmyadmin-sql-parser5
#
# Copyright (c) 2015-2019 Remi Collet
# License: CC-BY-SA
@@ -7,7 +7,7 @@
# Please, preserve the changelog entries
#
-%global gh_commit b35c21f82e7202d739f6349a583b11e6d32b2b64
+%global gh_commit 538611d5336e1bd8aea30744dab43289334f1657
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner phpmyadmin
#global gh_date 20150820
@@ -15,9 +15,10 @@
%global with_tests 0%{!?_without_tests:1}
%global ns_vendor PhpMyAdmin
%global ns_project SqlParser
+%global major 5
-Name: php-%{gh_owner}-%{gh_project}
-Version: 4.3.2
+Name: php-%{gh_owner}-%{gh_project}%{major}
+Version: 5.0.0
Release: 1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist}
Summary: A validating SQL lexer and parser with a focus on MySQL dialect
@@ -27,43 +28,39 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit
# Use our autoloader and locale relocation
Patch0: %{name}-autoload.patch
+# PHP 7.4
+Patch1: https://patch-diff.githubusercontent.com/raw/phpmyadmin/sql-parser/pull/258.patch
BuildArch: noarch
BuildRequires: gettext
%if %{with_tests}
-BuildRequires: php(language) >= 5.3.0
+BuildRequires: php(language) >= 7.1
BuildRequires: php-composer(phpmyadmin/motranslator) >= 3.0
BuildRequires: php-mbstring
+BuildRequires: php-spl
# For tests, from composer.json "require-dev": {
# "phpunit/php-code-coverage": "*",
-# "phpunit/phpunit": "~4.8 || ~5.7 || ~6.5",
-# "squizlabs/php_codesniffer": "^2.9"
-%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
-BuildRequires: phpunit6 >= 6.5
-%global phpunit %{_bindir}/phpunit6
-%else
-BuildRequires: php-composer(phpunit/phpunit)
-%global phpunit %{_bindir}/phpunit
-%endif
+# "phpunit/phpunit": "^7.4",
+# "phpmyadmin/coding-standard": "^1.0"
+BuildRequires: phpunit7 >= 7.4
+%global phpunit %{_bindir}/phpunit7
%endif
# For autoloader
BuildRequires: php-composer(fedora/autoloader)
# From composer.json, "require": {
-# "php": ">=5.3.0",
+# "php": "^7.1",
# "symfony/polyfill-mbstring": "^1.3"
# From composer.json, "conflict": {
# "phpmyadmin/motranslator": "<3.0"
# From composer.json, "suggest": {
# "ext-mbstring": "For best performance",
# "phpmyadmin/motranslator": "Translate messages to your favorite locale"
-
-Requires: php(language) >= 5.3
+Requires: php(language) >= 7.1
Requires: php-composer(phpmyadmin/motranslator) >= 3.0
# Mandatory to avoid symfony/polyfill-mbstring
Requires: php-mbstring
-# From phpcompatinfo report for 4.2.0
-Requires: php-pcre
+# From phpcompatinfo report for 5.0.0
Requires: php-spl
# For generated autoloader
Requires: php-composer(fedora/autoloader)
@@ -80,13 +77,14 @@ A validating SQL lexer and parser with a focus on MySQL dialect.
This library was originally developed for phpMyAdmin during
the Google Summer of Code 2015.
-Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php
+Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php
%prep
%setup -q -n %{gh_project}-%{gh_commit}
%patch0 -p0 -b .rpm
+%patch1 -p1
find src -name \*rpm -exec rm {} \;
: Create autoloader
@@ -115,9 +113,9 @@ rm locale/sqlparser.pot
%install
: Library
mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor}
-cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}
+cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
# keep locale in project dir as name seems too generic
-cp -pr locale %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/locale
+cp -pr locale %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/locale
: Commands
install -Dpm 0755 bin/highlight-query %{buildroot}%{_bindir}/%{name}-highlight-query
@@ -134,7 +132,7 @@ install -Dpm 0755 bin/tokenize-query %{buildroot}%{_bindir}/%{name}-tokenize-qu
mkdir vendor
cat << 'EOF' | tee vendor/autoload.php
<?php
-require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php';
+require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\Tests\\', dirname(__DIR__).'/tests');
EOF
@@ -145,7 +143,7 @@ ret=0
for cmdarg in "php %{phpunit}" php71 php72 php73 php74; do
if which $cmdarg; then
set $cmdarg
- $1 ${2:-%{_bindir}/phpunit6} --no-coverage --verbose || ret=1
+ $1 ${2:-%{_bindir}/phpunit7} --no-coverage --verbose || ret=1
fi
done
exit $ret
@@ -154,11 +152,13 @@ exit $ret
%endif
+# remirepo:1
%if 0%{?fedora} >= 12 || 0%{?rhel} >= 7
%files -f sqlparser.lang
+# remirepo:5
%else
%files
-%{_datadir}/php/%{ns_vendor}/%{ns_project}/locale/*/LC_MESSAGES/*.mo
+%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/locale/*/LC_MESSAGES/*.mo
%endif
%{!?_licensedir:%global license %%doc}
%license LICENSE.txt
@@ -167,19 +167,28 @@ exit $ret
%{_bindir}/%{name}-highlight-query
%{_bindir}/%{name}-lint-query
%{_bindir}/%{name}-tokenize-query
-%dir %{_datadir}/php/%{ns_vendor}/%{ns_project}
- %{_datadir}/php/%{ns_vendor}/%{ns_project}/*php
- %{_datadir}/php/%{ns_vendor}/%{ns_project}/Components/
- %{_datadir}/php/%{ns_vendor}/%{ns_project}/Contexts/
- %{_datadir}/php/%{ns_vendor}/%{ns_project}/Exceptions/
- %{_datadir}/php/%{ns_vendor}/%{ns_project}/Statements/
- %{_datadir}/php/%{ns_vendor}/%{ns_project}/Utils/
-%dir %{_datadir}/php/%{ns_vendor}/%{ns_project}/locale/
-%dir %{_datadir}/php/%{ns_vendor}/%{ns_project}/locale/*/
-%dir %{_datadir}/php/%{ns_vendor}/%{ns_project}/locale/*/LC_MESSAGES/
+%dir %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
+ %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/*php
+ %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/Components/
+ %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/Contexts/
+ %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/Exceptions/
+ %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/Statements/
+ %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/Utils/
+%dir %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/locale/
+%dir %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/locale/*/
+%dir %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/locale/*/LC_MESSAGES/
%changelog
+* Mon Sep 2 2019 Remi Collet <remi@remirepo.net> - 5.0.0-1
+- update to 5.0.0
+- rename to php-phpmyadmin-sql-parser5
+- move to /usr/share/php/PhpMyAdmin/SqlParser5
+- raise dependency on PHP 7.1
+- switch to phpunit7
+- add patch for PHP 7.4 from
+ https://github.com/phpmyadmin/sql-parser/pull/258
+
* Tue Jun 4 2019 Remi Collet <remi@remirepo.net> - 4.3.2-1
- update to 4.3.2
- add php-phpmyadmin-sql-parser-tokenize-query command