summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--Makefile4
-rw-r--r--composer.json50
-rw-r--r--php-phpmyadmin-sql-parser5-autoload.patch114
-rw-r--r--php-phpmyadmin-sql-parser5.spec344
5 files changed, 519 insertions, 0 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/Makefile b/Makefile
new file mode 100644
index 0000000..91b0fd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../common/Makefile
+
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..f4af964
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,50 @@
+{
+ "name": "phpmyadmin/sql-parser",
+ "description": "A validating SQL lexer and parser with a focus on MySQL dialect.",
+ "license": "GPL-2.0-or-later",
+ "keywords": ["sql", "lexer", "parser", "analysis"],
+ "homepage": "https://github.com/phpmyadmin/sql-parser",
+ "authors": [
+ {
+ "name": "The phpMyAdmin Team",
+ "email": "developers@phpmyadmin.net",
+ "homepage": "https://www.phpmyadmin.net/team/"
+ }
+ ],
+ "support": {
+ "issues": "https://github.com/phpmyadmin/sql-parser/issues",
+ "source": "https://github.com/phpmyadmin/sql-parser"
+ },
+ "require": {
+ "php": ">=5.3.0",
+ "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"
+ },
+ "conflict": {
+ "phpmyadmin/motranslator": "<3.0"
+ },
+ "suggest": {
+ "ext-mbstring": "For best performance",
+ "phpmyadmin/motranslator": "Translate messages to your favorite locale"
+ },
+ "bin": [
+ "bin/highlight-query",
+ "bin/lint-query",
+ "bin/tokenize-query"
+ ],
+ "autoload": {
+ "psr-4": {
+ "PhpMyAdmin\\SqlParser\\": "src"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "PhpMyAdmin\\SqlParser\\Tests\\": "tests"
+ }
+ }
+}
diff --git a/php-phpmyadmin-sql-parser5-autoload.patch b/php-phpmyadmin-sql-parser5-autoload.patch
new file mode 100644
index 0000000..3cea924
--- /dev/null
+++ b/php-phpmyadmin-sql-parser5-autoload.patch
@@ -0,0 +1,114 @@
+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
+ <?php
+
+-$files = array(
+- __DIR__ . "/../vendor/autoload.php",
+- __DIR__ . "/../../vendor/autoload.php",
+- __DIR__ . "/../../../autoload.php",
+- "vendor/autoload.php"
+-);
+-
+-$found = false;
+-foreach ($files as $file) {
+- if (file_exists($file)) {
+- require_once $file;
+- $found = true;
+- break;
+- }
+-}
+-
+-if (!$found) {
+- die(
+- "You need to set up the project dependencies using the following commands:" . PHP_EOL .
+- "curl -sS https://getcomposer.org/installer | php" . PHP_EOL .
+- "php composer.phar install" . PHP_EOL
+- );
+-}
++require '/usr/share/php/PhpMyAdmin/SqlParser/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
+ <?php
+
+-$files = array(
+- __DIR__ . "/../vendor/autoload.php",
+- __DIR__ . "/../../vendor/autoload.php",
+- __DIR__ . "/../../../autoload.php",
+- "vendor/autoload.php"
+-);
+-
+-$found = false;
+-foreach ($files as $file) {
+- if (file_exists($file)) {
+- require_once $file;
+- $found = true;
+- break;
+- }
+-}
+-
+-if (!$found) {
+- die(
+- "You need to set up the project dependencies using the following commands:" . PHP_EOL .
+- "curl -sS https://getcomposer.org/installer | php" . PHP_EOL .
+- "php composer.phar install" . PHP_EOL
+- );
+-}
++require '/usr/share/php/PhpMyAdmin/SqlParser/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
+ <?php
+
+-$files = array(
+- __DIR__ . "/../vendor/autoload.php",
+- __DIR__ . "/../../vendor/autoload.php",
+- __DIR__ . "/../../../autoload.php",
+- "vendor/autoload.php"
+-);
+-
+-$found = false;
+-foreach ($files as $file) {
+- if (file_exists($file)) {
+- require_once $file;
+- $found = true;
+- break;
+- }
+-}
+-
+-if (!$found) {
+- die(
+- "You need to set up the project dependencies using the following commands:" . PHP_EOL .
+- "curl -sS https://getcomposer.org/installer | php" . PHP_EOL .
+- "php composer.phar install" . PHP_EOL
+- );
+-}
++require '/usr/share/php/PhpMyAdmin/SqlParser/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
+@@ -40,7 +40,7 @@ class Translator
+ self::$loader->textdomain('sqlparser');
+
+ // Set path where to look for a domain
+- self::$loader->bindtextdomain('sqlparser', __DIR__ . '/../locale/');
++ self::$loader->bindtextdomain('sqlparser', __DIR__ . '/locale/');
+ }
+
+ if (is_null(self::$translator)) {
diff --git a/php-phpmyadmin-sql-parser5.spec b/php-phpmyadmin-sql-parser5.spec
new file mode 100644
index 0000000..bcc035a
--- /dev/null
+++ b/php-phpmyadmin-sql-parser5.spec
@@ -0,0 +1,344 @@
+# remirepo/fedora spec file for php-phpmyadmin-sql-parser
+#
+# Copyright (c) 2015-2019 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+
+%global gh_commit b35c21f82e7202d739f6349a583b11e6d32b2b64
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner phpmyadmin
+#global gh_date 20150820
+%global gh_project sql-parser
+%global with_tests 0%{!?_without_tests:1}
+%global ns_vendor PhpMyAdmin
+%global ns_project SqlParser
+
+Name: php-%{gh_owner}-%{gh_project}
+Version: 4.3.2
+Release: 1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist}
+Summary: A validating SQL lexer and parser with a focus on MySQL dialect
+
+License: GPLv2+
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{?gh_short}.tar.gz
+
+# Use our autoloader and locale relocation
+Patch0: %{name}-autoload.patch
+
+BuildArch: noarch
+BuildRequires: gettext
+%if %{with_tests}
+BuildRequires: php(language) >= 5.3.0
+BuildRequires: php-composer(phpmyadmin/motranslator) >= 3.0
+BuildRequires: php-mbstring
+# 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
+%endif
+# For autoloader
+BuildRequires: php-composer(fedora/autoloader)
+
+# From composer.json, "require": {
+# "php": ">=5.3.0",
+# "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-composer(phpmyadmin/motranslator) >= 3.0
+# Mandatory to avoid symfony/polyfill-mbstring
+Requires: php-mbstring
+# From phpcompatinfo report for 4.2.0
+Requires: php-pcre
+Requires: php-spl
+# For generated autoloader
+Requires: php-composer(fedora/autoloader)
+# For commands
+Requires: php-cli
+
+# Composer
+Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version}
+
+
+%description
+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
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+%patch0 -p0 -b .rpm
+find src -name \*rpm -exec rm {} \;
+
+: Create autoloader
+cat <<'AUTOLOAD' | tee src/autoload.php
+<?php
+/* Autoloader for %{name} and its dependencies */
+require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';
+
+\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\', __DIR__);
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{_datadir}/php/PhpMyAdmin/MoTranslator/autoload.php',
+));
+AUTOLOAD
+
+
+%build
+: Generate the locales
+for loc in $(find locale -name \*.po)
+do
+ msgfmt --statistics --check -o ${loc%.po}.mo $loc
+ rm $loc
+done
+rm locale/sqlparser.pot
+
+
+%install
+: Library
+mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor}
+cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}
+# keep locale in project dir as name seems too generic
+cp -pr locale %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/locale
+
+: Commands
+install -Dpm 0755 bin/highlight-query %{buildroot}%{_bindir}/%{name}-highlight-query
+install -Dpm 0755 bin/lint-query %{buildroot}%{_bindir}/%{name}-lint-query
+install -Dpm 0755 bin/tokenize-query %{buildroot}%{_bindir}/%{name}-tokenize-query
+
+%if 0%{?fedora} >= 12 || 0%{?rhel} >= 7
+%find_lang sqlparser
+%endif
+
+
+%check
+%if %{with_tests}
+mkdir vendor
+cat << 'EOF' | tee vendor/autoload.php
+<?php
+require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\Tests\\', dirname(__DIR__).'/tests');
+EOF
+
+: fix commands
+sed -e 's:%{_datadir}/php:%{buildroot}%{_datadir}/php:' -i bin/*query
+
+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
+ fi
+done
+exit $ret
+%else
+: Test suite disabled
+%endif
+
+
+%if 0%{?fedora} >= 12 || 0%{?rhel} >= 7
+%files -f sqlparser.lang
+%else
+%files
+%{_datadir}/php/%{ns_vendor}/%{ns_project}/locale/*/LC_MESSAGES/*.mo
+%endif
+%{!?_licensedir:%global license %%doc}
+%license LICENSE.txt
+%doc composer.json
+%doc README.md
+%{_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/
+
+
+%changelog
+* 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
+
+* Sun Jan 6 2019 Remi Collet <remi@remirepo.net> - 4.3.1-1
+- update to 4.3.1
+
+* Wed Dec 26 2018 Remi Collet <remi@remirepo.net> - 4.3.0-1
+- update to 4.3.0
+
+* Thu Nov 1 2018 Remi Collet <remi@remirepo.net> - 4.2.5-1
+- update to 4.2.5
+- switch to phpunit6
+
+* Wed Feb 21 2018 Remi Collet <remi@remirepo.net> - 4.2.4-3
+- allow motranslator v4
+
+* Thu Dec 7 2017 Remi Collet <remi@remirepo.net> - 4.2.4-1
+- Update to 4.2.4
+
+* Wed Oct 11 2017 Remi Collet <remi@remirepo.net> - 4.2.3-1
+- Update to 4.2.3
+
+* Fri Sep 29 2017 Remi Collet <remi@remirepo.net> - 4.2.2-1
+- Update to 4.2.2
+
+* Sat Sep 9 2017 Remi Collet <remi@remirepo.net> - 4.2.1-1
+- Update to 4.2.1
+
+* Thu Aug 31 2017 Remi Collet <remi@remirepo.net> - 4.2.0-1
+- Update to 4.2.0
+
+* Mon Aug 21 2017 Remi Collet <remi@remirepo.net> - 4.1.10-1
+- Update to 4.1.10
+
+* Thu Jul 13 2017 Remi Collet <remi@remirepo.net> - 4.1.9-1
+- Update to 4.1.9
+
+* Sun Jul 9 2017 Remi Collet <remi@remirepo.net> - 4.1.8-1
+- Update to 4.1.8
+
+* Tue Jun 6 2017 Remi Collet <remi@remirepo.net> - 4.1.7-1
+- Update to 4.1.7
+
+* Fri Jun 2 2017 Remi Collet <remi@remirepo.net> - 4.1.6-1
+- Update to 4.1.6
+
+* Mon May 15 2017 Remi Collet <remi@remirepo.net> - 4.1.5-1
+- Update to 4.1.5
+
+* Fri May 5 2017 Remi Collet <remi@remirepo.net> - 4.1.4-1
+- Update to 4.1.4
+
+* Sun Apr 30 2017 Remi Collet <remi@remirepo.net> - 4.1.3-2
+- fix lang files installation from review #1415686
+
+* Thu Apr 6 2017 Remi Collet <remi@remirepo.net> - 4.1.3-1
+- Update to 4.1.3
+
+* Mon Feb 20 2017 Remi Collet <remi@fedoraproject.org> - 4.1.2-1
+- update to 4.1.2
+
+* Wed Feb 8 2017 Remi Collet <remi@fedoraproject.org> - 4.1.1-1
+- update to 4.1.1
+
+* Mon Jan 23 2017 Remi Collet <remi@fedoraproject.org> - 4.1.0-1
+- update to 4.1.0
+- add dependency on phpmyadmin/motranslator
+- rename commands and always provide them
+- manage locales
+
+* Mon Jan 23 2017 Remi Collet <remi@fedoraproject.org> - 4.0.0-1
+- update to 4.0.0
+- rename to php-phpmyadmin-sql-parser
+
+* Fri Jan 20 2017 Remi Collet <remi@fedoraproject.org> - 3.4.17-1
+- update to 3.4.17
+- sources from a git snapshot to retrieve test suite
+- switch to PSR-4 autoloader
+
+* Fri Jan 6 2017 Remi Collet <remi@fedoraproject.org> - 3.4.16-1
+- update to 3.4.16
+
+* Mon Jan 2 2017 Remi Collet <remi@fedoraproject.org> - 3.4.15-1
+- update to 3.4.15
+
+* Wed Nov 30 2016 Remi Collet <remi@fedoraproject.org> - 3.4.14-1
+- update to 3.4.14
+
+* Wed Nov 16 2016 Remi Collet <remi@fedoraproject.org> - 3.4.13-1
+- update to 3.4.13
+
+* Wed Nov 9 2016 Remi Collet <remi@fedoraproject.org> - 3.4.12-1
+- update to 3.4.12
+- switch to fedora/autoloader
+
+* Tue Oct 25 2016 Remi Collet <remi@fedoraproject.org> - 3.4.11-1
+- update to 3.4.11
+
+* Tue Oct 4 2016 Remi Collet <remi@fedoraproject.org> - 3.4.10-1
+- update to 3.4.10
+
+* Mon Oct 3 2016 Remi Collet <remi@fedoraproject.org> - 3.4.9-1
+- update to 3.4.9
+
+* Thu Sep 22 2016 Remi Collet <remi@fedoraproject.org> - 3.4.8-1
+- update to 3.4.8 (no change)
+
+* Tue Sep 20 2016 Remi Collet <remi@fedoraproject.org> - 3.4.7-1
+- update to 3.4.7
+
+* Tue Sep 13 2016 Remi Collet <remi@fedoraproject.org> - 3.4.6-1
+- update to 3.4.6
+- lower dependency on php >= 5.3
+
+* Tue Sep 13 2016 Remi Collet <remi@fedoraproject.org> - 3.4.5-1
+- update to 3.4.5
+
+* Tue Jul 26 2016 Remi Collet <remi@fedoraproject.org> - 3.4.4-1
+- update to 3.4.4
+- switch from udan11/sql-parser to phpmyadmin/sql-parser
+- add sql-parser-highlight-query and sql-parser-lint-query commands
+
+* Tue Mar 1 2016 Remi Collet <remi@fedoraproject.org> - 3.4.0-1
+- update to 3.4.0 (for phpMyAdmin 4.5.5.1)
+- add patch from phpMyAdmin
+- raise dependency on php >= 5.4
+
+* Tue Feb 23 2016 Remi Collet <remi@fedoraproject.org> - 3.3.1-1
+- update to 3.3.1 (for phpMyAdmin 4.5.5)
+- don't run test with old PHPUnit (EPEL-6)
+
+* Sat Dec 26 2015 Remi Collet <remi@fedoraproject.org> - 3.0.8-1
+- update to 3.0.8 (for phpMyAdmin 4.5.3)
+
+* Fri Nov 13 2015 Remi Collet <remi@fedoraproject.org> - 3.0.7-1
+- update to 3.0.7
+- run test suite with both PHP 5 and 7 when available
+
+* Sun Nov 8 2015 Remi Collet <remi@fedoraproject.org> - 3.0.5-1
+- update to 3.0.5
+
+* Thu Oct 22 2015 Remi Collet <remi@fedoraproject.org> - 3.0.4-1
+- update to 3.0.4 (for upcoming phpMyAdmin 4.5.1)
+
+* Mon Oct 19 2015 Remi Collet <remi@fedoraproject.org> - 3.0.3-1
+- update to 3.0.3 (for upcoming phpMyAdmin 4.5.1)
+
+* Wed Sep 23 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-2
+- upstream patch for phpMyAdmin 4.5.0.2
+
+* Wed Sep 23 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-1
+- tagged as 1.0.0 (no change)
+
+* Sun Sep 20 2015 Remi Collet <remi@fedoraproject.org> - 0-0.3.20150820git1b2988f
+- fix provides and self-obsoletion (review #1262807)
+
+* Mon Sep 14 2015 Remi Collet <remi@fedoraproject.org> - 0-0.2.20150820git1b2988f
+- rename to php-udan11-sql-parser
+
+* Mon Sep 14 2015 Remi Collet <remi@fedoraproject.org> - 0-0.1.20150629git4aaed44
+- initial package