summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-10-19 15:46:01 +0200
committerRemi Collet <remi@remirepo.net>2018-10-19 15:46:01 +0200
commitee2036154437a870171b9391e2f5773485f823b9 (patch)
tree1be0577f4259d04f0c9f089bef14d6f7f91168d7
parentdc939fa62b29326db69a77c48b9b1e5a43129926 (diff)
fix autoloader, use PSR-4 to avoid duplicated definition
prepend autoloader to ensure we use current version in tests fix FTBFS #1605449
-rw-r--r--php-webmozart-assert.spec35
1 files changed, 26 insertions, 9 deletions
diff --git a/php-webmozart-assert.spec b/php-webmozart-assert.spec
index 0f955b3..91b047e 100644
--- a/php-webmozart-assert.spec
+++ b/php-webmozart-assert.spec
@@ -10,6 +10,8 @@
# Please preserve changelog entries
#
+# enable bootstrap when need to provide a new autoloader
+%global bootstrap 0
%global github_owner webmozart
%global github_name assert
%global github_version 1.3.0
@@ -21,14 +23,19 @@
# "php": "^5.3.3 || ^7.0"
%global php_min_ver 5.3.3
+%if %{bootstrap}
+# Build using "--with tests" to enable tests
+%global with_tests 0%{?_with_tests:1}
+%else
# Build using "--without tests" to disable tests
%global with_tests 0%{!?_without_tests:1}
+%endif
%{!?phpdir: %global phpdir %{_datadir}/php}
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
-Release: 1%{?github_release}%{?dist}
+Release: 3%{?github_release}%{?dist}
Summary: Assertions to validate method input/output with nice error messages
Group: Development/Libraries
@@ -89,13 +96,10 @@ cat <<'AUTOLOAD' | tee src/autoload.php
<?php
/**
* Autoloader for %{name} and its' dependencies
- * (created by %{name}-%{version}-%{release}).
*/
require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
-\Fedora\Autoloader\Dependencies::required(array(
- __DIR__.'/Assert.php',
-));
+\Fedora\Autoloader\Autoload::addPsr4('Webmozart\\Assert\\', __DIR__);
AUTOLOAD
@@ -109,17 +113,19 @@ cp -rp src %{buildroot}%{phpdir}/Webmozart/Assert
: Create tests bootstrap
cat <<'BOOTSTRAP' | tee bootstrap.php
<?php
-require_once '%{buildroot}%{phpdir}/Webmozart/Assert/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('Webmozart\\Assert\\Tests\\', __DIR__.'/tests');
BOOTSTRAP
: Upstream tests
RETURN_CODE=0
PHPUNIT=$(which phpunit)
-for PHP_EXEC in "" %{?rhel:php54 php55 php56} php70 php71 php72; do
+for PHP_EXEC in php %{?rhel:php54 php55 php56} php70 php71 php72 php73; do
if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
- $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php \
- || RETURN_CODE=1
+ $PHP_EXEC \
+ -d auto_prepend_file=%{buildroot}%{phpdir}/Webmozart/Assert/autoload.php \
+ $PHPUNIT \
+ --bootstrap bootstrap.php \
+ --verbose || RETURN_CODE=1
fi
done
exit $RETURN_CODE
@@ -138,6 +144,17 @@ exit $RETURN_CODE
%changelog
+* Fri Oct 19 2018 Remi Collet <remi@remirepo.net> - 1.3.0-3
+- fix autoloader, use PSR-4 to avoid duplicated definition
+- prepend autoloader to ensure we use current version in tests
+- fix FTBFS #1605449
+
+* Fri Oct 19 2018 Remi Collet <remi@remirepo.net> - 1.3.0-2
+- fix autoloader, use PSR-4 to avoid duplicated definition
+- prepend autoloader to ensure we use current version in tests
+- fix FTBFS #1605449
+- bootstrap build
+
* Sun Apr 22 2018 Shawn Iwinski <shawn@iwin.ski> - 1.3.0-1
- Update to 1.3.0 (RHBZ #1539946)
- Add get source script