From c95f7c1745ea4df58f5a282bd9b9f0e1e3c89e04 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 25 Jun 2018 11:30:04 +0200 Subject: add mandatory dependency on one PHPUnit version add phpunitgoodpractices/traits 1.5.1 fix autoloader #1594663 --- composer-polyfill.json | 30 +++++++++++++++ composer-traits.json | 32 ++++++++++++++++ composer.json | 30 --------------- makesrc.sh | 26 ++++++++++++- php-phpunitgoodpractices-polyfill.spec | 68 +++++++++++++++++++++++++++------- 5 files changed, 142 insertions(+), 44 deletions(-) create mode 100644 composer-polyfill.json create mode 100644 composer-traits.json delete mode 100644 composer.json diff --git a/composer-polyfill.json b/composer-polyfill.json new file mode 100644 index 0000000..f26f435 --- /dev/null +++ b/composer-polyfill.json @@ -0,0 +1,30 @@ +{ + "name": "phpunitgoodpractices/polyfill", + "type": "library", + "description": "Lacking future-compat polyfills for PHPUnit.", + "license": "MIT", + "authors": [ + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "require": { + "php": "^5.5 || ^7.0", + "phpunit/phpunit": "^4.0 || ^5.3 || ^6.0 || ^7.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.12" + }, + "conflict": { + "hhvm": "*" + }, + "config": { + "optimize-autoloader": true, + "sort-packages": true + }, + "autoload": { + "files": [ "src/aliases.php" ], + "psr-4": { "PHPUnitGoodPractices\\Polyfill\\": "src/" } + } +} diff --git a/composer-traits.json b/composer-traits.json new file mode 100644 index 0000000..4275245 --- /dev/null +++ b/composer-traits.json @@ -0,0 +1,32 @@ +{ + "name": "phpunitgoodpractices/traits", + "type": "library", + "description": "Highly opinionated PHPUnit good practices enforcer.", + "license": "MIT", + "authors": [ + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "require": { + "php": "^5.5 || ^7.0", + "phpunit/phpunit": "~4.0.0 || ~4.1.0 || ~4.2.0 || ~4.3.0 || ~4.4.0 || ~4.5.0 || ~4.6.0 || ~4.8.0 || ~5.3.0 || ~5.4.0 || ~5.5.0 || ~5.6.0 || ~5.7.0 || ~6.0.0 || ~6.1.0 || ~6.2.0 || ~6.3.0 || ~6.4.0 || ~6.5.0 || ~7.0.0 || ~7.1.0 || ~7.2.6" + }, + "require-dev": { + "phpunitgoodpractices/polyfill": "^1.1" + }, + "conflict": { + "hhvm": "*" + }, + "config": { + "optimize-autoloader": true, + "sort-packages": true + }, + "autoload": { + "psr-4": { "PHPUnitGoodPractices\\Traits\\": "src/" } + }, + "autoload-dev": { + "psr-4": { "PHPUnitGoodPractices\\Traits\\Tests\\": "tests/" } + } +} diff --git a/composer.json b/composer.json deleted file mode 100644 index f26f435..0000000 --- a/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "phpunitgoodpractices/polyfill", - "type": "library", - "description": "Lacking future-compat polyfills for PHPUnit.", - "license": "MIT", - "authors": [ - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - } - ], - "require": { - "php": "^5.5 || ^7.0", - "phpunit/phpunit": "^4.0 || ^5.3 || ^6.0 || ^7.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.12" - }, - "conflict": { - "hhvm": "*" - }, - "config": { - "optimize-autoloader": true, - "sort-packages": true - }, - "autoload": { - "files": [ "src/aliases.php" ], - "psr-4": { "PHPUnitGoodPractices\\Polyfill\\": "src/" } - } -} diff --git a/makesrc.sh b/makesrc.sh index dfd5c2a..62e19db 100755 --- a/makesrc.sh +++ b/makesrc.sh @@ -15,7 +15,7 @@ git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT echo "Getting commit..." pushd $PROJECT-$COMMIT git checkout $COMMIT -cp composer.json ../composer.json +cp composer.json ../composer-polyfill.json popd echo "Archiving..." @@ -24,4 +24,28 @@ tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT echo "Cleaning..." rm -rf $PROJECT-$COMMIT +PROJECT=Traits +VERSION=$(sed -n '/^%global tr_version/{s/.* //;p}' $NAME.spec) +COMMIT=$(sed -n '/^%global tr_commit/{s/.* //;p}' $NAME.spec) +SHORT=${COMMIT:0:7} +NAME=php-phpunitgoodpractices-traits + +echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\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-traits.json +popd + +echo "Archiving..." +tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT + +echo "Cleaning..." +rm -rf $PROJECT-$COMMIT + + echo "Done." diff --git a/php-phpunitgoodpractices-polyfill.spec b/php-phpunitgoodpractices-polyfill.spec index 3eb9c65..d930443 100644 --- a/php-phpunitgoodpractices-polyfill.spec +++ b/php-phpunitgoodpractices-polyfill.spec @@ -20,10 +20,14 @@ %global ns_project Polyfill %global php_home %{_datadir}/php %global with_tests 0%{!?_without_tests:1} +# Traits +%global tr_commit 10d22ad5e222b5e5eae6941aac91c068397b5127 +%global tr_short %(c=%{tr_commit}; echo ${c:0:7}) +%global tr_version 1.5.1 Name: php-%{pk_vendor}-%{pk_project} Version: 1.1.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Lacking future-compat polyfills for PHPUnit Group: Development/Tools @@ -31,7 +35,8 @@ License: MIT URL: https://github.com/%{gh_owner}/%{gh_project} # git snapshot to get upstream test suite (none for now) Source0: %{name}-%{version}-%{gh_short}.tgz -Source1: makesrc.sh +Source1: php-%{pk_vendor}-traits-%{tr_version}-%{tr_short}.tgz +Source2: makesrc.sh BuildArch: noarch %if %{with_tests} @@ -48,13 +53,21 @@ BuildRequires: php-fedora-autoloader-devel # "php": "^5.5 || ^7.0", # "phpunit/phpunit": "^4.0 || ^5.3 || ^6.0 || ^7.0" Requires: php(language) >= 5.5 -# ignore phpunit dep, package using it will run the proper phpunit command (and autoloader) +# remirepo:1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +Requires: (phpunit7 or phpunit6 or php-phpunit-PHPUnit) +# remirepo:3 +%else +Requires: php-phpunit-PHPUnit +%endif # From phpcompatinfo report for version 1.0.0 # nothing # Autoloader Requires: php-composer(fedora/autoloader) Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version} +Provides: php-%{pk_vendor}-traits = %{tr_version} +Provides: php-composer(%{pk_vendor}/traits) = %{tr_version} %description @@ -64,16 +77,31 @@ Autoloader: %{php_home}/%{ns_vendor}/%{ns_project}/autoload.php %prep -%setup -q -n %{gh_project}-%{gh_commit} +%setup -q -n %{gh_project}-%{gh_commit} -a 1 +mv composer.json composer-polyfill.json +mv LICENSE LICENSE-polyfill + +mv Traits-%{tr_commit}/src src2 +mv Traits-%{tr_commit}/composer.json composer-traits.json +mv Traits-%{tr_commit}/LICENSE LICENSE-traits cat << 'EOF' | tee src/autoload.php - 1.1.0-2 +- add mandatory dependency on one PHPUnit version +- add phpunitgoodpractices/traits 1.5.1 +- fix autoloader #1594663 + * Mon Jun 11 2018 Remi Collet - 1.1.0-1 - update to 1.1.0 (no change) - add LICENSE file -- cgit