diff options
| -rw-r--r-- | composer.json | 16 | ||||
| l--------- | makesrc.sh | 1 | ||||
| -rw-r--r-- | psysh-bin-autoload.patch | 40 | ||||
| -rwxr-xr-x | psysh-get-source.sh | 74 | ||||
| -rw-r--r-- | psysh.spec | 112 | 
5 files changed, 179 insertions, 64 deletions
| diff --git a/composer.json b/composer.json index 1b20b50..a097b3d 100644 --- a/composer.json +++ b/composer.json @@ -13,18 +13,16 @@          }      ],      "require": { -        "php": ">=5.4.0", +        "php": "^8.0 || ^7.0 || ^5.5.9",          "ext-json": "*",          "ext-tokenizer": "*", -        "symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0|~5.0", -        "symfony/var-dumper": "~2.7|~3.0|~4.0|~5.0", -        "nikic/php-parser": "~1.3|~2.0|~3.0|~4.0", -        "dnoegel/php-xdg-base-dir": "0.1", -        "jakub-onderka/php-console-highlighter": "0.3.*|0.4.*" +        "symfony/console": "~5.0|~4.0|~3.0|^2.4.2|~2.3.10", +        "symfony/var-dumper": "~5.0|~4.0|~3.0|~2.7", +        "nikic/php-parser": "~4.0|~3.0|~2.0|~1.3", +        "dnoegel/php-xdg-base-dir": "0.1.*"      },      "require-dev": { -        "phpunit/phpunit": "~4.8.35|~5.0|~6.0|~7.0", -        "hoa/console": "~2.15|~3.16", +        "hoa/console": "3.17.*",          "bamarni/composer-bin-plugin": "^1.2"      },      "suggest": { @@ -48,7 +46,7 @@      "bin": ["bin/psysh"],      "extra": {          "branch-alias": { -            "dev-develop": "0.9.x-dev" +            "dev-master": "0.10.x-dev"          }      }  } diff --git a/makesrc.sh b/makesrc.sh new file mode 120000 index 0000000..d0c9c8d --- /dev/null +++ b/makesrc.sh @@ -0,0 +1 @@ +psysh-get-source.sh
\ No newline at end of file diff --git a/psysh-bin-autoload.patch b/psysh-bin-autoload.patch index a9e670a..42b544e 100644 --- a/psysh-bin-autoload.patch +++ b/psysh-bin-autoload.patch @@ -1,8 +1,8 @@  diff --git a/bin/psysh b/bin/psysh -index 4fbd223..ef7b940 100755 +index 0829481..2e73ad5 100755  --- a/bin/psysh  +++ b/bin/psysh -@@ -10,91 +10,7 @@ +@@ -10,101 +10,7 @@    * file that was distributed with this source code.    */ @@ -16,7 +16,7 @@ index 4fbd223..ef7b940 100755  -    foreach ($argv as $i => $arg) {  -        if ($arg === '--cwd') {  -            if ($i >= count($argv) - 1) { --                echo 'Missing --cwd argument.' . PHP_EOL; +-                fwrite(STDERR, 'Missing --cwd argument.' . PHP_EOL);  -                exit(1);  -            }  -            $cwd = $argv[$i + 1]; @@ -39,14 +39,21 @@ index 4fbd223..ef7b940 100755  -    $chunks = explode('/', $cwd);  -    while (!empty($chunks)) {  -        $path = implode('/', $chunks); +-        $prettyPath = $path; +-        if (isset($_SERVER['HOME']) && $_SERVER['HOME']) { +-            $prettyPath = preg_replace('/^' . preg_quote($_SERVER['HOME'], '/') . '/', '~', $path); +-        }  -  -        // Find composer.json  -        if (is_file($path . '/composer.json')) {  -            if ($cfg = json_decode(file_get_contents($path . '/composer.json'), true)) {  -                if (isset($cfg['name']) && $cfg['name'] === 'psy/psysh') { --                    // We're inside the psysh project. Let's use the local --                    // Composer autoload. +-                    // We're inside the psysh project. Let's use the local Composer autoload.  -                    if (is_file($path . '/vendor/autoload.php')) { +-                        if (realpath($path) !== realpath(__DIR__ . '/..')) { +-                            fwrite(STDERR, 'Using local PsySH version at ' . $prettyPath . PHP_EOL); +-                        } +-  -                        require $path . '/vendor/autoload.php';  -                    }  - @@ -60,9 +67,12 @@ index 4fbd223..ef7b940 100755  -            if ($cfg = json_decode(file_get_contents($path . '/composer.lock'), true)) {  -                foreach (array_merge($cfg['packages'], $cfg['packages-dev']) as $pkg) {  -                    if (isset($pkg['name']) && $pkg['name'] === 'psy/psysh') { --                        // We're inside a project which requires psysh. We'll --                        // use the local Composer autoload. +-                        // We're inside a project which requires psysh. We'll use the local Composer autoload.  -                        if (is_file($path . '/vendor/autoload.php')) { +-                            if (realpath($path . '/vendor') !== realpath(__DIR__ . '/../../..')) { +-                                fwrite(STDERR, 'Using local PsySH version at ' . $prettyPath . PHP_EOL); +-                            } +-  -                            require $path . '/vendor/autoload.php';  -                        }  - @@ -85,8 +95,8 @@ index 4fbd223..ef7b940 100755  -    } elseif (is_file(__DIR__ . '/../../../autoload.php')) {  -        require __DIR__ . '/../../../autoload.php';  -    } else { --        echo 'PsySH dependencies not found, be sure to run `composer install`.' . PHP_EOL; --        echo 'See https://getcomposer.org to get Composer.' . PHP_EOL; +-        fwrite(STDERR, 'PsySH dependencies not found, be sure to run `composer install`.' . PHP_EOL); +-        fwrite(STDERR, 'See https://getcomposer.org to get Composer.' . PHP_EOL);  -        exit(1);  -    }  -/* >>> */ @@ -95,23 +105,23 @@ index 4fbd223..ef7b940 100755   // If the psysh binary was included directly, assume they just wanted an   // autoloader and bail early. -@@ -115,21 +31,5 @@ if (Psy\Shell::isIncluded($trace)) { +@@ -128,21 +34,5 @@ if (Psy\Shell::isIncluded($trace)) {   // Clean up after ourselves.   unset($trace);  -// If the local version is too old, we can't do this  -if (!function_exists('Psy\bin')) { --    $argv = $_SERVER['argv']; +-    $argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();  -    $first = array_shift($argv);  -    if (preg_match('/php(\.exe)?$/', $first)) {  -        array_shift($argv);  -    }  -    array_unshift($argv, 'vendor/bin/psysh');  - --    echo 'A local PsySH dependency was found, but it cannot be loaded. Please update to' . PHP_EOL; --    echo 'the latest version, or run the local copy directly, e.g.:' . PHP_EOL; --    echo PHP_EOL; --    echo '    ' . implode(' ', $argv) . PHP_EOL; +-    fwrite(STDERR, 'A local PsySH dependency was found, but it cannot be loaded. Please update to' . PHP_EOL); +-    fwrite(STDERR, 'the latest version, or run the local copy directly, e.g.:' . PHP_EOL); +-    fwrite(STDERR, PHP_EOL); +-    fwrite(STDERR, '    ' . implode(' ', $argv) . PHP_EOL);  -    exit(1);  -}  - diff --git a/psysh-get-source.sh b/psysh-get-source.sh new file mode 100755 index 0000000..3947de4 --- /dev/null +++ b/psysh-get-source.sh @@ -0,0 +1,74 @@ +#/bin/sh + +GIT=`which git` +RPM=`which rpm` + +if [ -z "$GIT" ] +then +    echo "ERROR: 'git' command not found" 1>&2 +    exit 1 +elif [ -z "$RPM" ] +then +    echo "ERROR: 'rpm' command not found" 1>&2 +    exit 1 +fi + +function print { +    echo -e "\e[0;33m>>>>> ${1}\e[0m" +} + +if [ -x "$1" ] +then +    SPEC=$1 +else +    SPEC=`ls *.spec | head -1` +fi + +SPEC_DIR=`pwd` + +print "SPEC_DIR = $SPEC_DIR" + +NAME=`echo $SPEC | sed 's#\.spec##'` +VERSION=`egrep '%global\s*github_version' $SPEC | awk '{print $3}'` + +print "SPEC = $SPEC" +print "NAME = $NAME" + +GIT_OWNER=`egrep '%global\s*github_owner' $SPEC | awk '{print $3}'` +GIT_NAME=`egrep '%global\s*github_name' $SPEC | awk '{print $3}'` +GIT_COMMIT=`egrep '%global\s*github_commit' $SPEC | awk '{print $3}'` +GIT_REPO=https://github.com/${GIT_OWNER}/${GIT_NAME} +GIT_DIR=`echo $GIT_REPO | sed 's#.*/##'` + +print "GIT_OWNER = $GIT_OWNER" +print "GIT_NAME = $GIT_NAME" +print "GIT_COMMIT = $GIT_COMMIT" +print "GIT_REPO = $GIT_REPO" +print "GIT_DIR = $GIT_DIR" + +TEMP_DIR=$(mktemp --dir) + +pushd $TEMP_DIR +    print "Cloning git repo..." +    $GIT clone $GIT_REPO + +    pushd $GIT_DIR +        print "Checking out commit..." +        $GIT checkout $GIT_COMMIT +        cp composer.json ${SPEC_DIR}/composer.json +    popd + +    TAR_DIR=${GIT_NAME}-${GIT_COMMIT} +    print "TAR_DIR = $TAR_DIR" + +    mv $GIT_DIR $TAR_DIR + +    TAR_FILE=${SPEC_DIR}/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz +    print "TAR_FILE = $TAR_FILE" + +    [ -e $TAR_FILE ] && rm -f $TAR_FILE +    tar --exclude-vcs -czf $TAR_FILE $TAR_DIR +    chmod 0644 $TAR_FILE +popd + +rm -rf $TEMP_DIR @@ -2,7 +2,7 @@  #  # Fedora spec file for psysh  # -# Copyright (c) 2016-2019 Shawn Iwinski <shawn@iwin.ski> +# Copyright (c) 2016-2020 Shawn Iwinski <shawn@iwin.ski>  #  # License: MIT  # http://opensource.org/licenses/MIT @@ -12,34 +12,47 @@  %global github_owner     bobthecow  %global github_name      psysh -%global github_version   0.9.11 -%global github_commit    75d9ac1c16db676de27ab554a4152b594be4748e +%global github_version   0.10.4 +%global github_commit    a8aec1b2981ab66882a01cce36a49b6317dc3560  %global composer_vendor  psy  %global composer_project psysh -# "php": ">=5.4.0" -%global php_min_ver 5.4.0 -# "dnoegel/php-xdg-base-dir": "0.1" +%if 0%{?fedora} >= 32 || 0%{?rhel} >= 8 +%global with_symfony2 0 +%else +%global with_symfony2 1 +%endif + +# "php": "^8.0 || ^7.0 || ^5.5.9" +%global php_min_ver 5.5.9 +# "dnoegel/php-xdg-base-dir": "0.1.*"  %global php_xdg_base_dir_min_ver 0.1  %global php_xdg_base_dir_max_ver 0.2 -# "jakub-onderka/php-console-highlighter": "0.3.*|0.4.*" -%global php_console_highlighter_min_ver 0.3.0 -%global php_console_highlighter_max_ver 0.5.0  # "nikic/php-parser": "~1.3|~2.0|~3.0|~4.0" -#     NOTE: Min version not 1.2.1 to force 2.x so 1.x is not -#           a dependency so it could possibly be retired -%global php_parser_min_ver 2.0 +#     NOTE: Forcing minimum version 4 +%global php_parser_min_ver 4.0  %global php_parser_max_ver 5.0 -# "symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0|~5.0" -# "symfony/var-dumper": "~2.7|~3.0|~4.0|~5.0" +# "symfony/console": "~5.0|~4.0|~3.0|^2.4.2|~2.3.10" +# "symfony/var-dumper": "~5.0|~4.0|~3.0|~2.7" +%if %{with_symfony2}  #     NOTE: Min version not 2.7.0 because autoloader required  %global symfony_min_ver 2.7.1 +%else +%global symfony_min_ver 3.0 +%endif  %global symfony_max_ver 6.0  # Build using "--without tests" to disable tests  %global with_tests 0%{!?_without_tests:1} +# Range dependencies supported? +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +%global with_range_dependencies 1 +%else +%global with_range_dependencies 0 +%endif +  %{!?phpdir:  %global phpdir  %{_datadir}/php}  Name:          psysh @@ -48,8 +61,12 @@ Release:       1%{?github_release}%{?dist}  Summary:       A runtime developer console, interactive debugger and REPL for PHP  License:       MIT -URL:           http://psysh.org -Source0:       https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz +URL:           https://psysh.org + +# GitHub export does not include tests +# Run psysh-get-source.sh to create full source +Source0:       %{name}-%{github_version}-%{github_commit}.tar.gz +Source1:       %{name}-get-source.sh  # Update bin script to use generated autoloader  Patch0:        %{name}-bin-autoload.patch @@ -61,18 +78,16 @@ BuildRequires: php-cli  ## composer.json  BuildRequires: php(language) >= %{php_min_ver}  BuildRequires: php-composer(phpunit/phpunit) +%if %{with_range_dependencies} +BuildRequires: (php-composer(dnoegel/php-xdg-base-dir) >= %{php_xdg_base_dir_min_ver} with php-composer(dnoegel/php-xdg-base-dir) < %{php_xdg_base_dir_max_ver}) +BuildRequires: (php-composer(nikic/php-parser) >= %{php_parser_min_ver} with php-composer(nikic/php-parser) < %{php_parser_max_ver}) +BuildRequires: (php-composer(symfony/console) >= %{symfony_min_ver} with php-composer(symfony/console) < %{symfony_max_ver}) +BuildRequires: (php-composer(symfony/var-dumper) >= %{symfony_min_ver} with php-composer(symfony/var-dumper) < %{symfony_max_ver}) +%else  BuildRequires: php-composer(dnoegel/php-xdg-base-dir) <  %{php_xdg_base_dir_max_ver}  BuildRequires: php-composer(dnoegel/php-xdg-base-dir) >= %{php_xdg_base_dir_min_ver} -BuildRequires: php-composer(jakub-onderka/php-console-highlighter) <  %{php_console_highlighter_max_ver} -BuildRequires: php-composer(jakub-onderka/php-console-highlighter) >= %{php_console_highlighter_min_ver}  BuildRequires: php-composer(nikic/php-parser) <  %{php_parser_max_ver}  BuildRequires: php-composer(nikic/php-parser) >= %{php_parser_min_ver} -%if 0%{?fedora} >= 26 || 0%{?rhel} >= 8 -BuildRequires: php-composer(symfony/console) <  %{symfony_max_ver} -BuildRequires: php-composer(symfony/console) >= %{symfony_min_ver} -BuildRequires: php-composer(symfony/var-dumper) <  %{symfony_max_ver} -BuildRequires: php-composer(symfony/var-dumper) >= %{symfony_min_ver} -%else  BuildRequires: php-symfony3-console  BuildRequires: php-symfony3-var-dumper  %endif @@ -83,7 +98,7 @@ BuildRequires: php-pcntl  BuildRequires: php-posix  BuildRequires: php-readline  BuildRequires: php-sqlite3 -## phpcompatinfo (computed from version 0.9.11) +## phpcompatinfo (computed from version 0.10.4)  BuildRequires: php-date  BuildRequires: php-dom  BuildRequires: php-pcre @@ -97,18 +112,16 @@ BuildRequires: php-composer(fedora/autoloader)  Requires:      php-cli  # composer.json  Requires:      php(language) >= %{php_min_ver} +%if %{with_range_dependencies} +Requires:      (php-composer(dnoegel/php-xdg-base-dir) >= %{php_xdg_base_dir_min_ver} with php-composer(dnoegel/php-xdg-base-dir) < %{php_xdg_base_dir_max_ver}) +Requires:      (php-composer(nikic/php-parser) >= %{php_parser_min_ver} with php-composer(nikic/php-parser) < %{php_parser_max_ver}) +Requires:      (php-composer(symfony/console) >= %{symfony_min_ver} with php-composer(symfony/console) < %{symfony_max_ver}) +Requires:      (php-composer(symfony/var-dumper) >= %{symfony_min_ver} with php-composer(symfony/var-dumper) < %{symfony_max_ver}) +%else  Requires:      php-composer(dnoegel/php-xdg-base-dir) <  %{php_xdg_base_dir_max_ver}  Requires:      php-composer(dnoegel/php-xdg-base-dir) >= %{php_xdg_base_dir_min_ver} -Requires:      php-composer(jakub-onderka/php-console-highlighter) <  %{php_console_highlighter_max_ver} -Requires:      php-composer(jakub-onderka/php-console-highlighter) >= %{php_console_highlighter_min_ver}  Requires:      php-composer(nikic/php-parser) <  %{php_parser_max_ver}  Requires:      php-composer(nikic/php-parser) >= %{php_parser_min_ver} -%if 0%{?fedora} >= 26 || 0%{?rhel} >= 8 -Requires:      php-composer(symfony/console) <  %{symfony_max_ver} -Requires:      php-composer(symfony/console) >= %{symfony_min_ver} -Requires:      php-composer(symfony/var-dumper) <  %{symfony_max_ver} -Requires:      php-composer(symfony/var-dumper) >= %{symfony_min_ver} -%else  Requires:      php-symfony3-console  Requires:      php-symfony3-var-dumper  %endif @@ -119,7 +132,7 @@ Requires:      php-pcntl  Requires:      php-posix  Requires:      php-readline  Requires:      php-sqlite3 -# phpcompatinfo (computed from version 0.9.11) +# phpcompatinfo (computed from version 0.10.4)  Requires:      php-date  Requires:      php-pcre  Requires:      php-pdo @@ -161,7 +174,7 @@ require_once '%{phpdir}/Fedora/Autoloader/autoload.php';  require_once __DIR__.'/functions.php';  \Fedora\Autoloader\Dependencies::required([ -    '%{phpdir}/JakubOnderka/PhpConsoleHighlighter/autoload.php', +    '%{phpdir}/PhpParser4/autoload.php',      '%{phpdir}/XdgBaseDir/autoload.php',      [          '%{phpdir}/Symfony5/Component/Console/autoload.php', @@ -175,11 +188,6 @@ require_once __DIR__.'/functions.php';          '%{phpdir}/Symfony3/Component/VarDumper/autoload.php',          '%{phpdir}/Symfony/Component/VarDumper/autoload.php',      ], -    [ -        '%{phpdir}/PhpParser4/autoload.php', -        '%{phpdir}/PhpParser3/autoload.php', -        '%{phpdir}/PhpParser2/autoload.php', -    ],  ]);  AUTOLOAD @@ -212,6 +220,23 @@ sed 's/function testFormat/function SKIP_testFormat/' \      -i test/Formatter/CodeFormatterTest.php  sed 's/function testWriteReturnValue/function SKIP_testWriteReturnValue/' \      -i test/ShellTest.php +sed 's/function testMoreUnclosedStatements/function SKIP_testMoreUnclosedStatements/' \ +    -i test/CodeCleanerTest.php +sed 's/function testEnumerateUserFunctions/function SKIP_testEnumerateUserFunctions/' \ +    -i test/Command/ListCommand/FunctionEnumeratorTest.php +sed 's/function testEnumerate/function SKIP_testEnumerate/' \ +    -i test/Command/ListCommand/GlobalVariableEnumeratorTest.php +sed 's/function testEnumerateEnumerates/function SKIP_testEnumerateEnumerates/' \ +    -i test/Command/ListCommand/VariableEnumeratorTest.php +sed 's/function testEnumerateAllEnumeratesEvenMore/function SKIP_testEnumerateAllEnumeratesEvenMore/' \ +    -i test/Command/ListCommand/VariableEnumeratorTest.php +: Skip test failing with php 7.3 +sed -e 's/function testConfigurationFromInput/function SKIP_testConfigurationFromInput/' \ +    -e 's/function testConfigurationFromInputSpecificity/function SKIP_testConfigurationFromInputSpecificity/' \ +    -e 's/function testConfigurationFromInputVerbosityLevels/function SKIP_testConfigurationFromInputVerbosityLevels/' \ +    -e 's/function testConfigurationFromInputShortOptions/function SKIP_testConfigurationFromInputShortOptions/' \ +    -i test/ConfigurationTest.php +  : Drop unneeded test as readline is always there  rm test/Readline/HoaConsoleTest.php @@ -241,6 +266,13 @@ exit $RETURN_CODE  %changelog +* Sun Aug 16 2020 Shawn Iwinski <shawn@iwin.ski> - 0.10.4-1 +- Update to 0.10.4 (RHBZ #1782258) +- Fix FTBFS (RHBZ #1865260) +- Conditionally use range dependencies +- Conditionally drop Symfony 2 interoperability +- Force "nikic/php-parser" minimum version 4 +  * Sun Dec 01 2019 Shawn Iwinski <shawn@iwin.ski> - 0.9.11-1  - Update to 0.9.11 (RHBZ #1529814) | 
