From 8c40c858743892e39ac38767b1979fca8bd42e82 Mon Sep 17 00:00:00 2001 From: Shawn Iwinski Date: Sat, 18 Sep 2021 13:50:50 -0400 Subject: [PATCH] Update to 1.2.0 (RHBZ #1674220) - Fix "FTBFS in Fedora rawhide/f35" (RHBZ #1987840) --- .gitignore | 1 + composer.json | 14 ++-- ...cramius-code-generator-utils-get-source.sh | 73 +++++++++++++++++++ php-ocramius-code-generator-utils.spec | 67 +++++++++-------- sources | 2 +- 5 files changed, 121 insertions(+), 36 deletions(-) create mode 100755 php-ocramius-code-generator-utils-get-source.sh diff --git a/.gitignore b/.gitignore index bb1c5c3..1ca792f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ clog /php-ocramius-code-generator-utils-0.3.2-0e2f6c593fc82801cbb5c8fa90559d923bd1445c.tar.gz /php-ocramius-code-generator-utils-0.4.0-7dc0be1dec3376d95ba094688f0d84f7cf95f300.tar.gz /php-ocramius-code-generator-utils-0.4.1-862c03de42475fe039e7d0f47966c25ac40a58a8.tar.gz +/php-ocramius-code-generator-utils-1.2.0-02aab6ab303c93f60915d0f6d4ffaf0381a6671b.tar.gz diff --git a/composer.json b/composer.json index dd7fd57..6d767ab 100644 --- a/composer.json +++ b/composer.json @@ -19,12 +19,16 @@ } ], "require": { - "php": "~7.0", - "nikic/php-parser": "~2.0|~3.0" + "php": "^8.0", + "nikic/php-parser": "^4.10.4" }, "require-dev": { - "phpunit/phpunit": "~5.0", - "squizlabs/php_codesniffer": "~2.0" + "doctrine/coding-standard": "^8.2.0", + "phpunit/phpunit": "^9.5.1", + "psalm/plugin-phpunit": "^0.15.0", + "roave/infection-static-analysis-plugin": "^1.7", + "squizlabs/php_codesniffer": "^3.5.8", + "vimeo/psalm": "^4.4.1" }, "autoload": { "psr-4": { @@ -33,7 +37,7 @@ }, "autoload-dev": { "psr-4": { - "CodeGenerationUtilsTests\\": "tests/CodeGenerationUtilsTests", + "CodeGenerationUtilsTests\\": "tests/CodeGenerationUtilsTest", "CodeGenerationUtilsTestAsset\\": "tests/CodeGenerationUtilsTestAsset" } }, diff --git a/php-ocramius-code-generator-utils-get-source.sh b/php-ocramius-code-generator-utils-get-source.sh new file mode 100755 index 0000000..b2ac62b --- /dev/null +++ b/php-ocramius-code-generator-utils-get-source.sh @@ -0,0 +1,73 @@ +#/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 + 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 diff --git a/php-ocramius-code-generator-utils.spec b/php-ocramius-code-generator-utils.spec index e5a1c35..fee3c0f 100644 --- a/php-ocramius-code-generator-utils.spec +++ b/php-ocramius-code-generator-utils.spec @@ -1,7 +1,7 @@ # # Fedora spec file for php-ocramius-code-generator-utils # -# Copyright (c) 2014-2016 Shawn Iwinski +# Copyright (c) 2014-2021 Shawn Iwinski # # License: MIT # http://opensource.org/licenses/MIT @@ -11,40 +11,43 @@ %global github_owner Ocramius %global github_name CodeGenerationUtils -%global github_version 0.4.1 -%global github_commit 862c03de42475fe039e7d0f47966c25ac40a58a8 +%global github_version 1.2.0 +%global github_commit 02aab6ab303c93f60915d0f6d4ffaf0381a6671b %global composer_vendor ocramius %global composer_project code-generator-utils -# "php": "~7.0" -%global php_min_ver 7.0 -# "nikic/php-parser": "~2.0|~3.0" -%global php_parser_min_ver 2.0 -%global php_parser_max_ver 4 +# "php": "^8.0" +%global php_min_ver 8.0 +# "nikic/php-parser": "^4.10.4" +%global php_parser_min_ver 4.10.4 +%global php_parser_max_ver 5 # Build using "--without tests" to disable tests -%global with_tests 0%{!?_without_tests:1} +%bcond_without tests %{!?phpdir: %global phpdir %{_datadir}/php} Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 10%{?github_release}%{?dist} +Release: 1%{?github_release}%{?dist} Summary: A set of code generator utilities built on top of PHP-Parsers License: MIT URL: https://github.com/%{github_owner}/%{github_name} -Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz + +# GitHub export does not include tests. +# Run php-ocramius-code-generator-utils-get-source.sh to create full source. +Source0: %{name}-%{github_version}-%{github_commit}.tar.gz +Source1: %{name}-get-source.sh BuildArch: noarch -%if %{with_tests} +%if %{with tests} # composer.json BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-composer(nikic/php-parser) < %{php_parser_max_ver} -BuildRequires: php-composer(nikic/php-parser) >= %{php_parser_min_ver} -BuildRequires: php-composer(phpunit/phpunit) >= 5.0 -# phpcompatinfo (computed from version 0.4.0) +BuildRequires: phpunit9 +BuildRequires: (php-composer(nikic/php-parser) >= %{php_parser_min_ver} with php-composer(nikic/php-parser) < %{php_parser_max_ver}) +# phpcompatinfo (computed from version 1.2.0) BuildRequires: php-pcre BuildRequires: php-reflection BuildRequires: php-spl @@ -54,10 +57,10 @@ BuildRequires: php-composer(fedora/autoloader) # composer.json Requires: php(language) >= %{php_min_ver} -Requires: php-composer(nikic/php-parser) < %{php_parser_max_ver} -Requires: php-composer(nikic/php-parser) >= %{php_parser_min_ver} -# phpcompatinfo (computed from version 0.4.0) +Requires: (php-composer(nikic/php-parser) >= %{php_parser_min_ver} with php-composer(nikic/php-parser) < %{php_parser_max_ver}) +# phpcompatinfo (computed from version 1.2.0) Requires: php-pcre +Requires: php-reflection Requires: php-spl # Autoloader Requires: php-composer(fedora/autoloader) @@ -90,11 +93,9 @@ cat <<'AUTOLOAD' | tee src/CodeGenerationUtils/autoload.php require_once '/usr/share/php/Fedora/Autoloader/autoload.php'; \Fedora\Autoloader\Autoload::addPsr4('CodeGenerationUtils\\', __DIR__); + \Fedora\Autoloader\Dependencies::required([ - [ - '%{phpdir}/PhpParser3/autoload.php', - '%{phpdir}/PhpParser2/autoload.php', - ], + '%{phpdir}/PhpParser4/autoload.php', ]); AUTOLOAD @@ -105,7 +106,7 @@ cp -rp src/CodeGenerationUtils %{buildroot}%{phpdir}/ %check -%if %{with_tests} +%if %{with tests} : Create tests bootstrap cat <<'BOOTSTRAP' | tee bootstrap.php - 1.2.0-1 +- Update to 1.2.0 (RHBZ #1674220) +- Fix "FTBFS in Fedora rawhide/f35" (RHBZ #1987840) + * Fri Jul 23 2021 Fedora Release Engineering - 0.4.1-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index d7c6aa4..875ea8a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (php-ocramius-code-generator-utils-0.4.1-862c03de42475fe039e7d0f47966c25ac40a58a8.tar.gz) = 06205f284aa1345e0081595b2fd6068c4de14aefb99dd4fedaf4e634dec60a0c63a08e03d1ebce84f59cfe247f40a8ea8d5ff2c6baeaf964f50f81c92e3d2431 +SHA512 (php-ocramius-code-generator-utils-1.2.0-02aab6ab303c93f60915d0f6d4ffaf0381a6671b.tar.gz) = 1caeda4e233c0556239e7caa5b9cf2ae35dd0c0b32d738ddfb588b4111f08daeec9d606b2465e66bc8cd59763abbf9a774a9ccdb50c071a4c670200a70e771a1