diff options
| -rw-r--r-- | composer.json | 9 | ||||
| -rwxr-xr-x | makesrc.sh | 32 | ||||
| -rw-r--r-- | php-swiftmailer6.spec | 76 | 
3 files changed, 85 insertions, 32 deletions
diff --git a/composer.json b/composer.json index a996e21..d66dc4c 100644 --- a/composer.json +++ b/composer.json @@ -16,18 +16,17 @@      ],      "require": {          "php": ">=7.0.0", -        "egulias/email-validator": "~2.0", +        "egulias/email-validator": "^2.0",          "symfony/polyfill-iconv": "^1.0",          "symfony/polyfill-mbstring": "^1.0",          "symfony/polyfill-intl-idn": "^1.10"      },      "require-dev": { -        "mockery/mockery": "~0.9.1", -        "symfony/phpunit-bridge": "^3.4.19|^4.1.8" +        "mockery/mockery": "^1.0", +        "symfony/phpunit-bridge": "^4.4|^5.0"      },      "suggest": { -        "ext-intl": "Needed to support internationalized email addresses", -        "true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed" +        "ext-intl": "Needed to support internationalized email addresses"      },      "autoload": {          "files": ["lib/swift_required.php"] diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..f403d5e --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +NAME=$(basename $PWD) +OWNER=$(sed   -n '/^%global gh_owner/{s/.* //;p}'   $NAME.spec) +PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec) +VERSION=$(sed -n '/^Version:/{s/.* //;p}'           $NAME.spec) +COMMIT=$(sed  -n '/^%global gh_commit/{s/.* //;p}'  $NAME.spec) +SHORT=${COMMIT:0:7} + +if [ -f $NAME-$VERSION-$SHORT.tgz ]; then +	echo "skip $NAME-$VERSION-$SHORT.tgz already here" +else +	echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION, Commit=$COMMIT\n" + +	echo "Cloning..." +	git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + +	echo "Getting commit..." +	pushd $PROJECT-$COMMIT +		git checkout $COMMIT || exit 1 +	cp composer.json ../composer.json +	popd + +	echo "Archiving..." +	tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs $PROJECT-$COMMIT + +	echo "Cleaning..." +	rm -rf $PROJECT-$COMMIT +fi + +echo "Done." + diff --git a/php-swiftmailer6.spec b/php-swiftmailer6.spec index 42327f6..ce6428d 100644 --- a/php-swiftmailer6.spec +++ b/php-swiftmailer6.spec @@ -6,31 +6,30 @@  #  # Please preserve changelog entries  # -%global gh_commit    149cfdf118b169f7840bbe3ef0d4bc795d1780c9 + +%bcond_without       tests + +%global gh_commit    56f0ab23f54c4ccbb0d5dcc67ff8552e0c98d59e  %global gh_short     %(c=%{gh_commit}; echo ${c:0:7})  %global gh_owner     swiftmailer  %global gh_project   swiftmailer  # don't change major version used in package name  %global major        6 -%if 0%{?fedora} >= 32 || 0%{?rhel} >= 8 -# disable test by default, without mockery < 1 -%global with_tests   0%{?_with_tests:1} -%else -%global with_tests   0%{!?_without_tests:1} -%endif  %global php_home     %{_datadir}/php  Name:           php-%{gh_project}%{major} -Version:        6.2.3 -Release:        3%{?dist} +Version:        6.2.4 +Release:        1%{?dist}  Summary:        Free Feature-rich PHP Mailer  License:        MIT  URL:            https://swiftmailer.symfony.com/ -Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz +# git snapshot to retrieve test suite +Source0:        %{name}-%{version}-%{gh_short}.tgz +Source1:        makesrc.sh  BuildArch:      noarch -%if %{with_tests} +%if %{with tests}  BuildRequires:  php(language) >= 7.0.0  # remirepo:1  %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 @@ -52,25 +51,30 @@ BuildRequires:  php-mhash  BuildRequires:  php-openssl  BuildRequires:  php-pcre  BuildRequires:  php-spl -BuildRequires:  phpunit6  # From composer.json, "require-dev": { -#        "mockery/mockery": "~0.9.1", -#        "symfony/phpunit-bridge": "^3.4.19|^4.1.8" +#        "mockery/mockery": "^1.0", +#        "symfony/phpunit-bridge": "^4.4|^5.0"  # remirepo:1  %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 -BuildRequires: (php-composer(mockery/mockery) >= 0.9.1         with php-composer(mockery/mockery) <  1) -BuildRequires: (php-composer(symfony/phpunit-bridge) >= 3.4.19 with php-composer(symfony/phpunit-bridge) <  4) +BuildRequires: (php-composer(mockery/mockery)        >= 1.0    with php-composer(mockery/mockery)        < 2) +#BuildRequires:(php-composer(symfony/phpunit-bridge) >= 4.4    with php-composer(symfony/phpunit-bridge) < 5)  # remirepo:4  %else -BuildRequires:  php-deepend-Mockery >= 0.9.1 -BuildRequires:  php-symfony3-phpunit-bridge >= 3.4.19 +BuildRequires:  php-mockery +#BuildRequires: php-symfony4-phpunit-bridge  %endif +%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9 +%global phpunit %{_bindir}/phpunit9 +%else +%global phpunit %{_bindir}/phpunit8 +%endif +BuildRequires:  %{phpunit}  %endif  BuildRequires:  php-fedora-autoloader-devel  # From composer.json, "require": {  #        "php": ">=7.0.0", -#        "egulias/email-validator": "~2.0", +#        "egulias/email-validator": "^2.0",  #        "symfony/polyfill-iconv": "^1.0",  #        "symfony/polyfill-mbstring": "^1.0",  #        "symfony/polyfill-intl-idn": "^1.10" @@ -82,8 +86,7 @@ Requires:      (php-composer(egulias/email-validator) >= 2.0  with php-composer(  Requires:       php-egulias-email-validator2  %endif  # From composer.json,     "suggest": { -#        "ext-intl": "Needed to support internationalized email addresses", -#        "true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed" +#        "ext-intl": "Needed to support internationalized email addresses"  Requires:       php-intl  # from phpcompatinfo report on version 6.2.0  Requires:       php-reflection @@ -134,14 +137,14 @@ cp -pr lib/dependency_maps %{buildroot}/%{php_home}/Swift%{major}/  %check -%if %{with_tests} +%if %{with tests}  : Use installed tree and autoloader  mkdir vendor  %{_bindir}/phpab --format fedora --output vendor/autoload.php tests  cat << 'EOF' | tee -a vendor/autoload.php  require_once '%{buildroot}/%{php_home}/Swift%{major}/autoload.php'; -require_once '%{php_home}/Mockery/autoload.php'; -\Fedora\Autoloader\Autoload::addPsr4('Symfony\\Bridge\\PhpUnit\\', '%{php_home}/Symfony3/Bridge/PhpUnit'); +require_once '%{php_home}/Mockery1/autoload.php'; +//require_once '%{php_home}/Symfony4/Bridge/PhpUnit/autoload.php';  EOF  : Avoid duplicated classes @@ -153,11 +156,25 @@ cat << EOF | tee tests/acceptance.conf.php  define('SWIFT_TMP_DIR', '$TMPDIR');  EOF +: for phpunit8/9 +find tests -name \*.php \ +  -exec sed \ +    -e 's/assertMatchesRegularExpression/assertRegExp/' \ +    -e 's/assertDoesNotMatchRegularExpression/assertNotRegExp/' \ +    -e 's/function setUp()/function setUp():void/' \ +    -e 's/function tearDown()/function tearDown():void/' \ +    -i {} \; + +: get rid of symfony/phpunit-bridge +sed -e '/listener/d' phpunit.xml.dist > phpunit.xml +  : Run upstream test suite  ret=0 -for cmd in php php71 php72 php73; do -  if which $cmd; then -    $cmd %{_bindir}/phpunit6 --exclude smoke --verbose || ret=1 +# TODO php 8 "Method ReflectionParameter::getClass() is deprecated" +for cmdarg in "php %{phpunit}" "php72 %{_bindir}/phpunit8" php73 php74 php80; do +  if which $cmdarg; then +    set $cmdarg +    $1 ${2:-%{_bindir}/phpunit9} --exclude smoke --verbose || ret=1    fi  done  rm -r $TMPDIR @@ -176,6 +193,11 @@ exit $ret  %changelog +* Wed Dec  9 2020 Remi Collet <remi@remirepo.net> - 6.2.4-1 +- update to 6.2.4 +- sources from git snapshot +- switch to phpunit9 and php-mockery +  * Mon Feb 24 2020 Remi Collet <remi@remirepo.net> - 6.2.3-3  - disable test suite where mockery < 1 is broken  | 
