diff options
author | Remi Collet <fedora@famillecollet.com> | 2017-01-23 13:38:19 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2017-01-23 13:38:19 +0100 |
commit | e20a8b3b37f02df6630f6671a90fd0afb0a99af8 (patch) | |
tree | 8cee834988ba3e69f856aeec5b031a36c46b5894 |
php-phpmyadmin-sql-parser: 4.0.0, New package
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | composer.json | 40 | ||||
-rw-r--r-- | php-phpmyadmin-sql-parser-autoload.patch | 68 | ||||
-rw-r--r-- | php-phpmyadmin-sql-parser.spec | 237 |
4 files changed, 349 insertions, 0 deletions
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..e03da1b --- /dev/null +++ b/composer.json @@ -0,0 +1,40 @@ +{ + "name": "phpmyadmin/sql-parser", + "description": "A validating SQL lexer and parser with a focus on MySQL dialect.", + "license": "GPL-2.0+", + "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", + "ext-mbstring": "*" + }, + "require-dev": { + "phpunit/php-code-coverage": "~2.0 || ~3.0", + "phpunit/phpunit": "~4.8 || ~5.1" + }, + "bin": [ + "bin/highlight-query", + "bin/lint-query" + ], + "autoload": { + "psr-4": { + "PhpMyAdmin\\SqlParser\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "PhpMyAdmin\\SqlParser\\Tests\\": "tests" + } + } +} diff --git a/php-phpmyadmin-sql-parser-autoload.patch b/php-phpmyadmin-sql-parser-autoload.patch new file mode 100644 index 0000000..3c80486 --- /dev/null +++ b/php-phpmyadmin-sql-parser-autoload.patch @@ -0,0 +1,68 @@ +diff -up bin/highlight-query.rpm bin/highlight-query +--- bin/highlight-query.rpm 2016-09-13 13:04:29.517214693 +0200 ++++ bin/highlight-query 2016-09-13 13:05:35.400519256 +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 SqlParser\Utils\CLI(); + exit($cli->runHighlight()); +diff -up bin/lint-query.rpm bin/lint-query +--- bin/lint-query.rpm 2016-09-13 13:04:29.517214693 +0200 ++++ bin/lint-query 2016-09-13 13:05:58.585626435 +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 SqlParser\Utils\CLI(); + exit($cli->runLint()); diff --git a/php-phpmyadmin-sql-parser.spec b/php-phpmyadmin-sql-parser.spec new file mode 100644 index 0000000..f38888d --- /dev/null +++ b/php-phpmyadmin-sql-parser.spec @@ -0,0 +1,237 @@ +# remirepo/fedora spec file for php-phpmyadmin-sql-parser +# +# Copyright (c) 2015-2017 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# + +%global gh_commit d070a5263f16128cb777c084981c7061a9a2dda3 +%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 +%if 0%{?fedora} >= 26 +%global with_cmd 1 +%else +%global with_cmd 0 +%endif + +Name: php-%{gh_owner}-%{gh_project} +Version: 4.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 + +Group: Development/Libraries +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 +Patch0: %{name}-autoload.patch + +BuildArch: noarch +%if %{with_tests} +BuildRequires: php(language) >= 5.3.0 +# For tests, from composer.json "require-dev": { +# "phpunit/php-code-coverage": "~2.0 || ~3.0", +# "phpunit/phpunit": "~4.8 || ~5.1" +BuildRequires: php-composer(phpunit/phpunit) +%endif +# For autoloader +BuildRequires: php-composer(fedora/autoloader) + +# From composer.json, "require": { +# "php": ">=5.3.0", +# "ext-mbstring": "*" +Requires: php(language) >= 5.3 +Requires: php-mbstring +# From phpcompatinfo report for 3.4.5 +Requires: php-ctype +Requires: php-pcre +# For generated autoloader +Requires: php-composer(fedora/autoloader) +%if %{with_cmd} +Requires: php-cli +%endif + +# 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 + + +%build +: 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__); +AUTOLOAD + + +%install +: Library +mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor} +cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project} + +%if %{with_cmd} +: Commands +install -Dpm 0755 bin/highlight-query %{buildroot}%{_bindir}/%{gh_project}-highlight-query +install -Dpm 0755 bin/lint-query %{buildroot}%{_bindir}/%{gh_project}-lint-query +%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 + +# remirepo:11 +run=0 +ret=0 +if which php56; then + php56 %{_bindir}/phpunit --no-coverage || ret=1 + run=1 +fi +if which php71; then + php71 %{_bindir}/phpunit --no-coverage || ret=1 + run=1 +fi +if [ $run -eq 0 ]; then +%{_bindir}/phpunit --no-coverage --verbose +# remirepo:2 +fi +exit $ret +%else +: Test suite disabled +%endif + + +%files +%{!?_licensedir:%global license %%doc} +%license LICENSE.txt +%doc composer.json +%doc README.md +%if %{with_cmd} +%{_bindir}/%{gh_project}-highlight-query +%{_bindir}/%{gh_project}-lint-query +%endif +%dir %{_datadir}/php/%{ns_vendor} + %{_datadir}/php/%{ns_vendor}/%{ns_project} + + +%changelog +* 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 |