From 3fb797aff4520a0c492e895c8f9264bf8d44b685 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 17 Dec 2020 11:36:57 +0100 Subject: update to 3.0.0 rename to php-phpseclib3 install in /usr/share/php/phpseclib3 raise dependency on PHP 5.6 add dependency on paragonie/constant_time_encoding add dependency on paragonie/random_compat --- composer.json | 8 +++-- makesrc.sh | 32 ++++++++++-------- php-phpseclib3-autoload.php | 7 ++-- php-phpseclib3.spec | 79 +++++++++++++++++++++++++++++++-------------- 4 files changed, 83 insertions(+), 43 deletions(-) diff --git a/composer.json b/composer.json index 08b9c7c..c1b517a 100644 --- a/composer.json +++ b/composer.json @@ -51,11 +51,13 @@ } ], "require": { - "php": ">=5.3.3" + "paragonie/constant_time_encoding": "^1|^2", + "paragonie/random_compat": "^1.4|^2.0", + "php": ">=5.6.1" }, "require-dev": { "phing/phing": "~2.7", - "phpunit/phpunit": "^4.8.35|^5.7|^6.0|^9.4", + "phpunit/phpunit": "^5.7|^6.0|^9.4", "squizlabs/php_codesniffer": "~2.0" }, "suggest": { @@ -69,7 +71,7 @@ "phpseclib/bootstrap.php" ], "psr-4": { - "phpseclib\\": "phpseclib/" + "phpseclib3\\": "phpseclib/" } } } diff --git a/makesrc.sh b/makesrc.sh index 4abe187..fea0ef6 100755 --- a/makesrc.sh +++ b/makesrc.sh @@ -7,22 +7,26 @@ VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec) COMMIT=$(sed -n '/^%global github_commit/{s/.* //;p}' $NAME.spec) SHORT=${COMMIT:0:7} -echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n" +if [ -f $NAME-$VERSION-$SHORT.tgz ]; then + echo "Already done" +else + echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n" -echo "Cloning..." -rm -rf $PROJECT-$COMMIT -git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + echo "Cloning..." + rm -rf $PROJECT-$COMMIT + git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT -echo "Getting commit..." -pushd $PROJECT-$COMMIT -git checkout $COMMIT -cp composer.json ../composer.json -popd + 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 .git $PROJECT-$COMMIT + echo "Archiving..." + tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT -echo "Cleaning..." -rm -rf $PROJECT-$COMMIT + echo "Cleaning..." + rm -rf $PROJECT-$COMMIT -echo "Done." + echo "Done." +fi diff --git a/php-phpseclib3-autoload.php b/php-phpseclib3-autoload.php index 93e0f67..2c63ba1 100644 --- a/php-phpseclib3-autoload.php +++ b/php-phpseclib3-autoload.php @@ -7,5 +7,8 @@ require_once "/usr/share/php/Fedora/Autoloader/autoload.php"; // composer.json: "autoload": { "files": [ "phpseclib/bootstrap.php" ], "psr-4": { "phpseclib\\": "phpseclib/" } require_once __DIR__ . '/bootstrap.php'; -\Fedora\Autoloader\Autoload::addPsr4('phpseclib\\', __DIR__); - +\Fedora\Autoloader\Autoload::addPsr4('phpseclib3\\', __DIR__); +\Fedora\Autoloader\Dependencies::required([ + '/usr/share/php/ParagonIE/ConstantTime/autoload.php', + '/usr/share/php/random_compat/autoload.php', +]); diff --git a/php-phpseclib3.spec b/php-phpseclib3.spec index 715d79d..ea9b953 100644 --- a/php-phpseclib3.spec +++ b/php-phpseclib3.spec @@ -3,12 +3,14 @@ %global github_owner phpseclib %global github_name phpseclib -%global github_commit 136b9ca7eebef78be14abf90d65c5e57b6bc5d36 +%global github_commit fe62c85e0203503231d489af95d0ac053b7d3575 %global github_short %(c=%{github_commit}; echo ${c:0:7}) +%global major 3 + %bcond_without tests -Name: php-%{composer_vendor} -Version: 2.0.30 +Name: php-%{composer_vendor}%{major} +Version: 3.0.0 Release: 1%{?dist} Summary: PHP Secure Communications Library License: MIT @@ -26,15 +28,18 @@ Source2: makesrc.sh BuildArch: noarch %if %{with tests} +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires:(php-composer(paragonie/constant_time_encoding) >= 2 with php-composer(paragonie/constant_time_encoding) < 3) +BuildRequires:(php-composer(paragonie/random_compat) >= 2 with php-composer(paragonie/random_compat) < 3) +%else +BuildRequires: php-paragonie-constant-time-encoding +BuildRequires: php-paragonie-random-compat +%endif BuildRequires: php-composer(fedora/autoloader) %if 0%{?fedora} >= 32 || 0%{?rhel} >= 9 %global phpunit %{_bindir}/phpunit9 %else -%if 0%{?fedora} >= 26 || 0%{?rhel} >= 8 %global phpunit %{_bindir}/phpunit6 -%else -%global phpunit %{_bindir}/phpunit -%endif %endif BuildRequires: %{phpunit} BuildRequires: %{_bindir}/phpab @@ -43,7 +48,19 @@ BuildRequires: php-bcmath BuildRequires: php-gmp %endif -Requires: php(language) >= 5.3.3 +# from composer.json, "require": { +# "paragonie/constant_time_encoding": "^1|^2", +# "paragonie/random_compat": "^1.4|^2.0", +# "php": ">=5.6.1" +# +Requires: php(language) >= 5.6.1 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +Requires: (php-composer(paragonie/constant_time_encoding) >= 2 with php-composer(paragonie/constant_time_encoding) < 3) +Requires: (php-composer(paragonie/random_compat) >= 2 with php-composer(paragonie/random_compat) < 3) +%else +Requires: php-paragonie-constant-time-encoding +Requires: php-paragonie-random-compat +%endif Requires: php-bcmath Requires: php-date Requires: php-gmp @@ -61,8 +78,10 @@ Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description MIT-licensed pure-PHP implementations of an arbitrary-precision integer -arithmetic library, fully PKCS#1 (v2.1) compliant RSA, DES, 3DES, RC4, -Rijndael, AES, Blowfish, Twofish, SSH-1, SSH-2, SFTP, and X.509 +arithmetic library, Ed25519 / Ed449 / Curve25519 / Curve449, ECDSA / ECDH +(with support for 66 curves), RSA (PKCS#1 v2.2 compliant), DSA / DH, +DES / 3DES / RC4 / Rijndael / AES / Blowfish / Twofish / Salsa20 / ChaCha20, +GCM / Poly1305. %prep @@ -75,20 +94,25 @@ cp %{SOURCE1} %{composer_vendor}/autoload.php %install mkdir -p %{buildroot}%{_datadir}/php -cp -pr %{composer_vendor} %{buildroot}%{_datadir}/php +cp -pr %{composer_vendor} %{buildroot}%{_datadir}/php/%{composer_vendor}%{major} %if %{with tests} %check -%{_bindir}/phpab --output tests/bootstrap.php tests -cat << 'EOF' | tee -a tests/bootstrap.php -if (class_exists("PHPUnit_Framework_TestCase") && !class_exists("PHPUnit\\Framework\\TestCase")) { - class_alias("PHPUnit_Framework_TestCase", "PHPUnit\\Framework\\TestCase"); -} -require "%{buildroot}%{_datadir}/php/%{composer_vendor}/autoload.php"; +cat << 'EOF' | tee tests/bootstrap.php + - 3.0.0-1 +- update to 3.0.0 +- rename to php-phpseclib3 +- install in /usr/share/php/phpseclib3 +- raise dependency on PHP 5.6 +- add dependency on paragonie/constant_time_encoding +- add dependency on paragonie/random_compat + * Thu Dec 17 2020 Remi Collet - 2.0.30-1 - update to 2.0.30 - switch to phpunit9 on Fedora -- cgit