summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2023-06-27 15:51:00 +0200
committerRemi Collet <remi@php.net>2023-06-27 15:51:00 +0200
commit3efe286cca172dea845e848f39fc975c7856c548 (patch)
tree6832d1f9cf19802f6eb8cb1888d23744f4a4d382
duplicate v4
-rw-r--r--.gitignore9
-rw-r--r--Makefile4
-rw-r--r--composer.json41
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-nikic-php-parser5-rpm.patch18
-rw-r--r--php-nikic-php-parser5.spec323
6 files changed, 423 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01f0400
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+clog
+package-*.xml
+*.tgz
+*.tar.bz2
+*.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..2fd064a
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,41 @@
+{
+ "name": "nikic/php-parser",
+ "type": "library",
+ "description": "A PHP parser written in PHP",
+ "keywords": [
+ "php",
+ "parser"
+ ],
+ "license": "BSD-3-Clause",
+ "authors": [
+ {
+ "name": "Nikita Popov"
+ }
+ ],
+ "require": {
+ "php": ">=7.0",
+ "ext-tokenizer": "*"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0",
+ "ircmaxell/php-yacc": "^0.0.7"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.9-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "PhpParser\\": "lib/PhpParser"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "PhpParser\\": "test/PhpParser/"
+ }
+ },
+ "bin": [
+ "bin/php-parse"
+ ]
+}
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..7d752c6
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+NAME=$(basename $PWD)
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
+SHORT=${COMMIT:0:7}
+
+echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION, Commit=$COMMIT\n"
+
+echo "Cloning..."
+git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
+
+echo "Getting commit..."
+pushd $PROJECT-$COMMIT
+git checkout $COMMIT
+cp composer.json ../composer.json
+popd
+
+echo "Archiving..."
+tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs $PROJECT-$COMMIT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$COMMIT
+
+echo "Done."
+
diff --git a/php-nikic-php-parser5-rpm.patch b/php-nikic-php-parser5-rpm.patch
new file mode 100644
index 0000000..66edc42
--- /dev/null
+++ b/php-nikic-php-parser5-rpm.patch
@@ -0,0 +1,18 @@
+diff -up ./bin/php-parse.rpm ./bin/php-parse
+--- ./bin/php-parse.rpm 2016-04-19 15:41:41.000000000 +0200
++++ ./bin/php-parse 2016-04-20 06:33:22.712063600 +0200
+@@ -1,12 +1,7 @@
+ #!/usr/bin/env php
+ <?php
+
+-foreach ([__DIR__ . '/../../../autoload.php', __DIR__ . '/../vendor/autoload.php'] as $file) {
+- if (file_exists($file)) {
+- require $file;
+- break;
+- }
+-}
++require '/usr/share/php/PhpParser4/autoload.php';
+
+ ini_set('xdebug.max_nesting_level', 3000);
+
+
diff --git a/php-nikic-php-parser5.spec b/php-nikic-php-parser5.spec
new file mode 100644
index 0000000..2fa2164
--- /dev/null
+++ b/php-nikic-php-parser5.spec
@@ -0,0 +1,323 @@
+# remirepo/fedora spec file for php-nikic-php-parser4
+#
+# Copyright (c) 2016-2023 Remi Collet
+# License: CC-BY-SA-4.0
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+
+# For compatibility with SCL
+%undefine __brp_mangle_shebangs
+
+%if 0%{?fedora}
+%bcond_without tests
+%else
+# disabled as phpunit not availble
+%bcond_with tests
+%endif
+
+%global gh_commit 19526a33fb561ef417e822e85f08a00db4059c17
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner nikic
+%global gh_project PHP-Parser
+%global pk_project php-parser
+%global php_home %{_datadir}/php
+%global ns_project PhpParser
+%global major 4
+
+Name: php-%{gh_owner}-%{pk_project}%{major}
+Version: 4.16.0
+Release: 1%{?dist}
+Summary: A PHP parser written in PHP - version %{major}
+
+License: BSD-3-Clause
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: %{name}-%{version}-%{gh_short}.tgz
+Source1: makesrc.sh
+
+# Autoloader
+Patch0: %{name}-rpm.patch
+
+BuildArch: noarch
+%if %{with tests}
+# For tests
+# as we use phpunit9
+BuildRequires: php(language) >= 7.3
+BuildRequires: php-tokenizer
+BuildRequires: php-reflection
+BuildRequires: php-ctype
+BuildRequires: php-json
+BuildRequires: php-pcre
+BuildRequires: php-spl
+# From composer.json, "require-dev": {
+# "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0",
+# "ircmaxell/php-yacc": "0.0.7"
+%global phpunit %{_bindir}/phpunit9
+BuildRequires: phpunit9
+# Autoloader
+%endif
+BuildRequires: php-fedora-autoloader-devel
+
+# From composer.json, "require": {
+# "php": ">=7.0",
+# "ext-tokenizer": "*"
+Requires: php(language) >= 7.0
+Requires: php-tokenizer
+# From phpcompatinfo report for version 4.0.0
+Requires: php-reflection
+Requires: php-ctype
+Requires: php-json
+Requires: php-pcre
+Requires: php-spl
+Requires: php-cli
+# Autoloader
+Requires: php-composer(fedora/autoloader)
+
+Provides: php-composer(%{gh_owner}/%{pk_project}) = %{version}
+
+
+%description
+This is a PHP parser written in PHP.
+Its purpose is to simplify static code analysis and manipulation.
+
+This package provides the library version %{major} and the php-parse%{major} command.
+
+Documentation: https://github.com/nikic/PHP-Parser/tree/master/doc
+
+Autoloader: %{php_home}/%{ns_project}%{major}/autoload.php
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+%patch -P0 -p1 -b .rpm
+
+
+%build
+: Generate an simple classmap autoloader
+phpab --template fedora \
+ --output lib/%{ns_project}/autoload.php \
+ lib/%{ns_project}
+
+
+%install
+: Library
+mkdir -p %{buildroot}%{php_home}
+cp -pr lib/%{ns_project} %{buildroot}%{php_home}/%{ns_project}%{major}
+
+: Command
+install -Dpm 0755 bin/php-parse %{buildroot}%{_bindir}/php-parse%{major}
+
+
+%check
+%if %{with tests}
+: Test the command
+sed -e 's:%{php_home}:%{buildroot}%{php_home}:' \
+ bin/php-parse > bin/php-parse-test
+php bin/php-parse-test --help
+
+: Test suite autoloader
+mkdir vendor
+cat << 'AUTOLOAD' | tee vendor/autoload.php
+<?php
+\Fedora\Autoloader\Autoload::addPsr4('%{ns_project}\\', dirname(__DIR__).'/test/PhpParser/');
+AUTOLOAD
+
+: Upstream test suite
+FILTER="--filter '^((?!(testLexNewFeatures)).)*$'"
+
+ret=0
+for cmdarg in "php %{phpunit}" php80 php81 php82 php83; do
+ if which $cmdarg; then
+ set $cmdarg
+ $1 -d include_path=%{php_home} \
+ -d auto_prepend_file=%{buildroot}/%{php_home}/%{ns_project}%{major}/autoload.php \
+ ${2:-%{_bindir}/phpunit9} $FILTER --verbose || ret=1
+ fi
+done
+exit $ret
+%else
+: Test suite disabled
+%endif
+
+
+%files
+# remirepo:1
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc composer.json
+%doc *.md
+%{_bindir}/php-parse%{major}
+%{php_home}/%{ns_project}%{major}
+
+
+%changelog
+* Mon Jun 26 2023 Remi Collet <remi@remirepo.net> - 4.16.0-1
+- update to 4.16.0
+
+* Wed May 24 2023 Remi Collet <remi@remirepo.net> - 4.15.5-1
+- update to 4.15.5
+
+* Mon Mar 6 2023 Remi Collet <remi@remirepo.net> - 4.15.4-1
+- update to 4.15.4
+
+* Tue Jan 17 2023 Remi Collet <remi@remirepo.net> - 4.15.3-1
+- update to 4.15.3
+
+* Mon Nov 14 2022 Remi Collet <remi@remirepo.net> - 4.15.2-1
+- update to 4.15.2
+
+* Thu Sep 8 2022 Remi Collet <remi@remirepo.net> - 4.15.1-1
+- update to 4.15.1
+
+* Mon Jun 13 2022 Remi Collet <remi@remirepo.net> - 4.14.0-2
+- only run test suite on Fedora, not on EL
+
+* Wed Jun 1 2022 Remi Collet <remi@remirepo.net> - 4.14.0-1
+- update to 4.14.0
+
+* Wed Dec 1 2021 Remi Collet <remi@remirepo.net> - 4.13.2-1
+- update to 4.13.2
+
+* Thu Nov 4 2021 Remi Collet <remi@remirepo.net> - 4.13.1-1
+- update to 4.13.1
+
+* Tue Sep 21 2021 Remi Collet <remi@remirepo.net> - 4.13.0-1
+- update to 4.13.0
+
+* Wed Jul 21 2021 Remi Collet <remi@remirepo.net> - 4.12.0-1
+- update to 4.12.0
+
+* Wed Jul 21 2021 Remi Collet <remi@remirepo.net> - 4.11.0-2
+- add upstream patches for PHP 8.1
+
+* Mon Jul 5 2021 Remi Collet <remi@remirepo.net> - 4.11.0-1
+- update to 4.11.0
+- switch to phpunit9
+
+* Tue May 4 2021 Remi Collet <remi@remirepo.net> - 4.10.5-1
+- update to 4.10.5
+
+* Mon Dec 21 2020 Remi Collet <remi@remirepo.net> - 4.10.4-1
+- update to 4.10.4
+
+* Fri Dec 4 2020 Remi Collet <remi@remirepo.net> - 4.10.3-1
+- update to 4.10.3
+
+* Mon Sep 28 2020 Remi Collet <remi@remirepo.net> - 4.10.2-1
+- update to 4.10.2
+
+* Thu Sep 24 2020 Remi Collet <remi@remirepo.net> - 4.10.1-1
+- update to 4.10.1
+
+* Sun Sep 20 2020 Remi Collet <remi@remirepo.net> - 4.10.0-1
+- update to 4.10.0
+
+* Mon Aug 31 2020 Remi Collet <remi@remirepo.net> - 4.9.1-1
+- update to 4.9.1
+
+* Wed Aug 19 2020 Remi Collet <remi@remirepo.net> - 4.9.0-1
+- update to 4.9.0
+
+* Mon Aug 10 2020 Remi Collet <remi@remirepo.net> - 4.8.0-1
+- update to 4.8.0
+
+* Sun Jul 26 2020 Remi Collet <remi@remirepo.net> - 4.7.0-1
+- update to 4.7.0
+
+* Fri Jul 3 2020 Remi Collet <remi@remirepo.net> - 4.6.0-1
+- update to 4.6.0
+
+* Thu Jun 25 2020 Remi Collet <remi@remirepo.net> - 4.5.0-2
+- switch to classmap autoloader
+- add missing dependency on fedora/autoloader
+
+* Wed Jun 3 2020 Remi Collet <remi@remirepo.net> - 4.5.0-1
+- update to 4.5.0
+
+* Mon Apr 13 2020 Remi Collet <remi@remirepo.net> - 4.4.0-1
+- update to 4.4.0
+
+* Tue Nov 12 2019 Remi Collet <remi@remirepo.net> - 4.3.0-1
+- update to 4.3.0
+
+* Mon Oct 28 2019 Remi Collet <remi@remirepo.net> - 4.2.5-1
+- update to 4.2.5
+- sources from git snapshot
+
+* Mon Sep 2 2019 Remi Collet <remi@remirepo.net> - 4.2.4-1
+- update to 4.2.4
+
+* Mon Aug 19 2019 Remi Collet <remi@remirepo.net> - 4.2.3-1
+- update to 4.2.3
+- use phpunit8
+
+* Mon May 27 2019 Remi Collet <remi@remirepo.net> - 4.2.2-1
+- update to 4.2.2
+
+* Mon Feb 18 2019 Remi Collet <remi@remirepo.net> - 4.2.1-1
+- update to 4.2.1
+
+* Sun Jan 13 2019 Remi Collet <remi@remirepo.net> - 4.2.0-1
+- update to 4.2.0
+
+* Thu Dec 27 2018 Remi Collet <remi@remirepo.net> - 4.1.1-1
+- update to 4.1.1
+
+* Wed Oct 10 2018 Remi Collet <remi@remirepo.net> - 4.1.0-1
+- update to 4.1.0
+- https://github.com/nikic/PHP-Parser/issues/539 - PHP 7.3
+
+* Tue Sep 18 2018 Remi Collet <remi@remirepo.net> - 4.0.4-1
+- update to 4.0.4
+
+* Mon Jul 16 2018 Remi Collet <remi@remirepo.net> - 4.0.3-1
+- update to 4.0.3
+
+* Mon Jun 4 2018 Remi Collet <remi@remirepo.net> - 4.0.2-1
+- update to 4.0.2
+
+* Mon Mar 26 2018 Remi Collet <remi@remirepo.net> - 4.0.1-1
+- update to 4.0.1
+
+* Thu Mar 22 2018 Remi Collet <remi@remirepo.net> - 4.0.0-1
+- Update to 4.0.0
+- rename to php-nikic-php-parser4 and move to /usr/share/php/PhpParser4
+- raise dependency on PHP 7
+- use phpunit6 or phpunit7 (F28+)
+
+* Thu Mar 1 2018 Remi Collet <remi@remirepo.net> - 3.1.5-1
+- Update to 3.1.5
+
+* Fri Jan 26 2018 Remi Collet <remi@remirepo.net> - 3.1.4-1
+- Update to 3.1.4
+
+* Wed Dec 27 2017 Remi Collet <remi@remirepo.net> - 3.1.3-1
+- Update to 3.1.3
+
+* Mon Nov 6 2017 Remi Collet <remi@remirepo.net> - 3.1.2-1
+- Update to 3.1.2
+
+* Mon Sep 4 2017 Remi Collet <remi@remirepo.net> - 3.1.1-1
+- Update to 3.1.1
+
+* Sat Aug 5 2017 Remi Collet <remi@remirepo.net> - 3.1.0-1
+- Update to 3.1.0
+
+* Thu Jun 29 2017 Remi Collet <remi@remirepo.net> - 3.0.6-1
+- Update to 3.0.6
+
+* Mon Mar 6 2017 Remi Collet <remi@remirepo.net> - 3.0.5-1
+- Update to 3.0.5
+- always provide the command, with version suffix
+
+* Sat Feb 11 2017 Remi Collet <remi@fedoraproject.org> - 3.0.4-1
+- update to 3.0.4
+
+* Sat Feb 4 2017 Remi Collet <remi@fedoraproject.org> - 3.0.3-1
+- update to 3.0.3
+
+* Wed Dec 7 2016 Remi Collet <remi@fedoraproject.org> - 3.0.2-1
+- new package for library version 3
+