add mandatory dependency on one PHPUnit version
add phpunitgoodpractices/traits 1.5.1 fix autoloader #1594663
This commit is contained in:
parent
6bcb32ba4a
commit
b6d9446cba
4 changed files with 77 additions and 15 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
/php-phpunitgoodpractices-polyfill-1.0.0-3968a1f.tgz
|
||||
/php-phpunitgoodpractices-polyfill-1.1.0-f7c9b77.tgz
|
||||
/php-phpunitgoodpractices-traits-1.5.1-10d22ad.tgz
|
||||
|
|
|
|||
26
makesrc.sh
26
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."
|
||||
|
|
|
|||
|
|
@ -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,15 @@ 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)
|
||||
Requires: (phpunit7 or phpunit6 or php-phpunit-PHPUnit)
|
||||
# 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 +71,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
|
||||
<?php
|
||||
/* autoloader for %{name} */
|
||||
|
||||
\Fedora\Autoloader\Autoload::addPsr4('PhpCsFixer\\AccessibleObject\\', __DIR__);
|
||||
\Fedora\Autoloader\Dependencies::required([
|
||||
__DIR__ . '/aliases.php',
|
||||
]);
|
||||
require_once '%{php_home}/Fedora/Autoloader/autoload.php';
|
||||
if (!class_exists('PHPUnit\\Framework\\TestCase')) { // Call outside of phpunit command
|
||||
\Fedora\Autoloader\Dependencies::required([
|
||||
[
|
||||
'%{php_home}/PHPUnit7/autoload.php',
|
||||
'%{php_home}/PHPUnit6/autoload.php',
|
||||
'%{php_home}/PHPUnit/Autoload.php',
|
||||
],
|
||||
]);
|
||||
}
|
||||
\Fedora\Autoloader\Autoload::addPsr4('PHPUnitGoodPractices\\Polyfill\\', __DIR__);
|
||||
\Fedora\Autoloader\Autoload::addPsr4('PHPUnitGoodPractices\\Traits\\', dirname(__DIR__) . '/Traits');
|
||||
require_once __DIR__ . '/aliases.php';
|
||||
EOF
|
||||
|
||||
|
||||
|
|
@ -83,17 +105,25 @@ EOF
|
|||
|
||||
%install
|
||||
: Library
|
||||
mkdir -p %{buildroot}%{php_home}/%{ns_vendor}
|
||||
cp -pr src %{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}
|
||||
mkdir -p %{buildroot}%{php_home}/%{ns_vendor}
|
||||
cp -pr src %{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}
|
||||
cp -pr src2 %{buildroot}%{php_home}/%{ns_vendor}/Traits
|
||||
|
||||
|
||||
%check
|
||||
%if %{with_tests}
|
||||
: Minimal check for our autoloader
|
||||
php -r '
|
||||
require "%{php_home}/PHPUnit/Autoload.php";
|
||||
require "%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php";
|
||||
var_dump(PHPUnit\Runner\Version::id());
|
||||
if (!trait_exists("PHPUnitGoodPractices\\Polyfill\\PolyfillTrait")) {
|
||||
echo("PolyfillTrait missing\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!class_exists("PHPUnitGoodPractices\\Traits\\PHPUnitVersionRetriever")) {
|
||||
echo("PHPUnitVersionRetriever missing\n");
|
||||
exit(1);
|
||||
}
|
||||
'
|
||||
%else
|
||||
: Test suite disabled
|
||||
|
|
@ -102,13 +132,19 @@ var_dump(PHPUnit\Runner\Version::id());
|
|||
|
||||
%files
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license LICENSE
|
||||
%doc composer.json
|
||||
%license LICENSE-*
|
||||
%doc composer-*.json
|
||||
%dir %{php_home}/%{ns_vendor}
|
||||
%{php_home}/%{ns_vendor}/%{ns_project}
|
||||
%{php_home}/%{ns_vendor}/Traits
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jun 25 2018 Remi Collet <remi@remirepo.net> - 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 <remi@remirepo.net> - 1.1.0-1
|
||||
- update to 1.1.0 (no change)
|
||||
- add LICENSE file
|
||||
|
|
|
|||
3
sources
3
sources
|
|
@ -1 +1,2 @@
|
|||
SHA512 (php-phpunitgoodpractices-polyfill-1.1.0-f7c9b77.tgz) = c1bfff8f110ef65e5d0913db38f36a812a096e6f1bf38741e195ee1c9fa4a3e5359a4090d9ac4976950c8e4563dd591741deac67c34c7d5ca7e8cd7e578ca453
|
||||
SHA512 (php-phpunitgoodpractices-polyfill-1.1.0-f7c9b77.tgz) = f6d536bbace9762d3a20129854caef4cddca450f7f07a767989f1d39a5df7a7faa9b08acdf4554882ed9748ce419327451ff6fa244da6e3855d8a9a7a1a5d64a
|
||||
SHA512 (php-phpunitgoodpractices-traits-1.5.1-10d22ad.tgz) = 155778546bc78cdc416a882c672ab1a827623e2534fbb7e7d6ff67552ec40ee04b7fb397ca35c54457bd82a0b0785b304e9d9b872f09326cfd4a8b57fa0166ad
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue