From 430e5b8878a13fc868ddaffa3dea2ef2d64d691e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 8 Mar 2021 07:26:26 +0100 Subject: Update to 1.5.0RC2 drop patch merged upstream --- PHPINFO | 2 +- REFLECTION | 2 +- gnupg-build.patch | 73 ------------------ gnupgt.inc | 211 ---------------------------------------------------- php-pecl-gnupg.spec | 13 ++-- vars.inc | 69 ----------------- 6 files changed, 7 insertions(+), 363 deletions(-) delete mode 100644 gnupg-build.patch delete mode 100644 gnupgt.inc delete mode 100644 vars.inc diff --git a/PHPINFO b/PHPINFO index c81c7ec..72821df 100644 --- a/PHPINFO +++ b/PHPINFO @@ -3,4 +3,4 @@ gnupg gnupg support => enabled GPGme Version => 1.14.0 -Extension Version => 1.5.0RC1 +Extension Version => 1.5.0RC2 diff --git a/REFLECTION b/REFLECTION index 33e0a7e..360d160 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #120 gnupg version 1.5.0RC1 ] { +Extension [ extension #119 gnupg version 1.5.0RC2 ] { - Constants [36] { Constant [ int GNUPG_SIG_MODE_NORMAL ] { 0 } diff --git a/gnupg-build.patch b/gnupg-build.patch deleted file mode 100644 index cedea9f..0000000 --- a/gnupg-build.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 618e7ffc698f948dfe4feef38258e42a7c24130e Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Mon, 15 Feb 2021 08:04:31 +0100 -Subject: [PATCH] fix build with libgpgme 1.3 - ---- - gnupg.c | 12 ++++-------- - 1 file changed, 4 insertions(+), 8 deletions(-) - -diff --git a/gnupg.c b/gnupg.c -index 3ec2f07..67e8c7f 100644 ---- a/gnupg.c -+++ b/gnupg.c -@@ -170,7 +170,9 @@ static void php_gnupg_this_make(PHPC_THIS_DECLARE(gnupg), zval *options TSRMLS_D - ctx, GPGME_PROTOCOL_OpenPGP, file_name, home_dir); - } - gpgme_set_armor(ctx, 1); -+#if GPGME_VERSION_NUMBER >= 0x010400 /* GPGME >= 1.4.0 */ - gpgme_set_pinentry_mode(ctx, GPGME_PINENTRY_MODE_LOOPBACK); -+#endif - } - } - /* }}} */ -@@ -591,10 +593,8 @@ PHP_MINIT_FUNCTION(gnupg) - #if GPGME_VERSION_NUMBER >= 0x010500 /* GPGME >= 1.5.0 */ - PHP_GNUPG_SET_CLASS_CONST("PK_ECC", GPGME_PK_ECC); - #endif /* gpgme >= 1.5.0 */ --#if GPGME_VERSION_NUMBER >= 0x010300 /* GPGME >= 1.3.0 */ - PHP_GNUPG_SET_CLASS_CONST("PK_ECDSA", GPGME_PK_ECDSA); - PHP_GNUPG_SET_CLASS_CONST("PK_ECDH", GPGME_PK_ECDH); --#endif /* gpgme >= 1.3.0 */ - #if GPGME_VERSION_NUMBER >= 0x010700 /* GPGME >= 1.7.0 */ - PHP_GNUPG_SET_CLASS_CONST("PK_EDDSA", GPGME_PK_EDDSA); - #endif /* gpgme >= 1.7.0 */ -@@ -633,10 +633,8 @@ PHP_MINIT_FUNCTION(gnupg) - #if GPGME_VERSION_NUMBER >= 0x010500 /* GPGME >= 1.5.0 */ - PHP_GNUPG_REG_CONST("GNUPG_PK_ECC", GPGME_PK_ECC); - #endif /* gpgme >= 1.5.0 */ --#if GPGME_VERSION_NUMBER >= 0x010300 /* GPGME >= 1.3.0 */ - PHP_GNUPG_REG_CONST("GNUPG_PK_ECDSA", GPGME_PK_ECDSA); - PHP_GNUPG_REG_CONST("GNUPG_PK_ECDH", GPGME_PK_ECDH); --#endif /* gpgme >= 1.3.0 */ - #if GPGME_VERSION_NUMBER >= 0x010700 /* GPGME >= 1.7.0 */ - PHP_GNUPG_REG_CONST("GNUPG_PK_EDDSA", GPGME_PK_EDDSA); - #endif /* gpgme >= 1.7.0 */ -@@ -1099,9 +1097,7 @@ PHP_FUNCTION(gnupg_keyinfo) - PHP_GNUPG_ARRAY_ADD_ASSOC_BOOL(subkey, revoked, gpgme_subkey); - PHP_GNUPG_ARRAY_ADD_ASSOC_BOOL(subkey, can_certify, gpgme_subkey); - PHP_GNUPG_ARRAY_ADD_ASSOC_BOOL(subkey, can_authenticate, gpgme_subkey); --#if GPGME_VERSION_NUMBER >= 0x010100 /* GPGME >= 1.1.0 */ - PHP_GNUPG_ARRAY_ADD_ASSOC_BOOL(subkey, is_qualified, gpgme_subkey); --#endif /* gpgme >= 1.1.0 */ - #if GPGME_VERSION_NUMBER >= 0x010900 /* GPGME >= 1.9.0 */ - PHP_GNUPG_ARRAY_ADD_ASSOC_BOOL(subkey, is_de_vs, gpgme_subkey); - #endif /* gpgme >= 1.9.0 */ -@@ -1117,15 +1113,15 @@ PHP_FUNCTION(gnupg_keyinfo) - PHP_GNUPG_ARRAY_ADD_ASSOC_CSTR(subkey, keygrip, gpgme_subkey); - } - #endif /* gpgme >= 1.7.0 */ --#if GPGME_VERSION_NUMBER >= 0x010200 /* GPGME >= 1.2.0 */ - PHP_GNUPG_ARRAY_ADD_ASSOC_BOOL(subkey, is_cardkey, gpgme_subkey); - if (gpgme_subkey->card_number) { - PHP_GNUPG_ARRAY_ADD_ASSOC_CSTR(subkey, card_number, gpgme_subkey); - } --#endif /* gpgme >= 1.2.0 */ -+#if GPGME_VERSION_NUMBER >= 0x010403 /* GPGME >= 1.4.3 */ - if (gpgme_subkey->curve) { - PHP_GNUPG_ARRAY_ADD_ASSOC_CSTR(subkey, curve, gpgme_subkey); - } -+#endif - - PHPC_ARRAY_ADD_NEXT_INDEX_ZVAL( - PHPC_VAL_CAST_TO_PZVAL(subkeys), diff --git a/gnupgt.inc b/gnupgt.inc deleted file mode 100644 index c31415d..0000000 --- a/gnupgt.inc +++ /dev/null @@ -1,211 +0,0 @@ -import($testkey); - } - - /** - * Delete all keys. - * @param null|string $homeDir - */ - static public function delete_key($homeDir = null) - { - if (is_null($homeDir)) { - $homeDir = self::get_home_dir(); - } - if (!is_dir($homeDir)) { - return; - } - foreach (glob($homeDir . '/*') as $filename) { - if (!is_dir($filename)) { - unlink($filename); - } - } - $privKeyDir = self::get_priv_key_dir($homeDir); - if (is_dir($privKeyDir)) { - foreach (glob($privKeyDir . '/*') as $key) { - unlink($key); - } - rmdir($privKeyDir); - } - rmdir($homeDir); - } - - /** - * Initialize key directory. - */ - static public function init_key_dir() - { - mkdir(self::get_home_dir()); - mkdir(self::get_priv_key_dir(), 0700); - } - - /** - * Reset all keys. - */ - static public function reset_key() - { - self::delete_key(); - self::init_key_dir(); - } - - /** - * Get home directory. - * - * @return string - */ - static private function get_home_dir() - { - return __DIR__ . '/home'; - } - - /** - * Get private key directory (for GPG2). - * @param null|string $homeDir - * @return string - */ - static private function get_priv_key_dir($homeDir = null) - { - if (is_null($homeDir)) { - $homeDir = self::get_home_dir(); - } - return $homeDir . '/private-keys-v1.d'; - } - - /** - * Print error message and return false. - * - * @param string $msg - * @return bool - */ - static private function error($msg) - { - echo "ERROR: " . $msg; - return false; - } - - /** - * Check single array value. - * - * @param mixed $expected - * @param array $a - * @param string $key1 - * @return bool - */ - static public function check_array($expected, $a, $key1) - { - $args = func_get_args(); - $keys = array_splice($args, 2); - $value = $a; - foreach ($keys as $key) { - if (!isset($value[$key])) { - return self::error("key $key not found in the array"); - } - $value = $value[$key]; - } - if ($value !== $expected) { - - return self::error( - sprintf( - "key %s value %s does not match expected %s\n", - $key, - var_export($value, true), - var_export($expected, true) - ) - ); - } - - return true; - } - - /** - * Check single array value but only for GpgME version higher than supplied. - * - * @param mixed $expected - * @param array $a - * @param string $key1 - * @return bool - */ - static public function check_array_from_version($version, $expected, $a, $key1) - { - if (version_compare(GNUPG_GPGME_VERSION, $version) < 0) { - return true; - } - - $args = func_get_args(); - return call_user_func_array('gnupgt::check_array', array_splice($args, 1)); - } - - /** - * Check keyinfo for var key - * - * @param $ret - * @param $secret_only - */ - static public function check_keyinfo($ret, $secret_only) { - self::check_array(false, $ret, 0, 'disabled'); - self::check_array(false, $ret, 0, 'expired'); - self::check_array(false, $ret, 0, 'revoked'); - self::check_array($secret_only, $ret, 0, 'is_secret'); - self::check_array(true, $ret, 0, 'can_sign'); - self::check_array(true, $ret, 0, 'can_encrypt'); - // uid - self::check_array('PHP GnuPG', $ret, 0, 'uids', 0, 'name'); - self::check_array('', $ret, 0, 'uids', 0, 'comment'); - self::check_array('gnupg@php.net', $ret, 0, 'uids', 0, 'email'); - self::check_array('PHP GnuPG ', $ret, 0, 'uids', 0, 'uid'); - self::check_array(false, $ret, 0, 'uids', 0, 'revoked'); - self::check_array(false, $ret, 0, 'uids', 0, 'invalid'); - self::check_array(false, $ret, 0, 'uids', 0, 'invalid'); - // subkey 1 - self::check_array("2DF0DD02DC9B70B7F64F572E669E775E0A6284B3", $ret, 0, 'subkeys', 0, 'fingerprint'); - self::check_array("669E775E0A6284B3", $ret, 0, 'subkeys', 0, 'keyid'); - self::check_array(1567958444, $ret, 0, 'subkeys', 0, 'timestamp'); - self::check_array(0, $ret, 0, 'subkeys', 0, 'expires'); - self::check_array($secret_only, $ret, 0, 'subkeys', 0, 'is_secret'); - self::check_array(false, $ret, 0, 'subkeys', 0, 'can_encrypt'); - self::check_array(true, $ret, 0, 'subkeys', 0, 'can_sign'); - self::check_array(false, $ret, 0, 'subkeys', 0, 'disabled'); - self::check_array(false, $ret, 0, 'subkeys', 0, 'expired'); - self::check_array(false, $ret, 0, 'subkeys', 0, 'revoked'); - self::check_array(true, $ret, 0, 'subkeys', 0, 'can_certify'); - self::check_array(false, $ret, 0, 'subkeys', 0, 'can_authenticate'); - self::check_array(false, $ret, 0, 'subkeys', 0, 'is_qualified'); - // TODO: The is_de_vs seems to differ between gpg2 (true) and gpg1 (false) - differenatiate the test - //self::check_array_from_version('1.9.0', true, $ret, 0, 'subkeys', 0, 'is_de_vs'); - self::check_array(GNUPG_PK_RSA, $ret, 0, 'subkeys', 0, 'pubkey_algo'); - self::check_array(2048, $ret, 0, 'subkeys', 0, 'length'); - self::check_array_from_version('1.7.0', false, $ret, 0, 'subkeys', 0, 'is_cardkey'); - // subkey 2 - self::check_array("9E84AE800874DFF647B6062B46DCA9B3662C7DFC", $ret, 0, 'subkeys', 1, 'fingerprint'); - self::check_array("46DCA9B3662C7DFC", $ret, 0, 'subkeys', 1, 'keyid'); - self::check_array(1567958444, $ret, 0, 'subkeys', 1, 'timestamp'); - self::check_array(0, $ret, 0, 'subkeys', 1, 'expires'); - self::check_array($secret_only, $ret, 0, 'subkeys', 1, 'is_secret'); - self::check_array(true, $ret, 0, 'subkeys', 1, 'can_encrypt'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'can_sign'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'disabled'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'expired'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'revoked'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'can_certify'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'can_authenticate'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'is_qualified'); - // TODO: The is_de_vs seems to differ between gpg2 (true) and gpg1 (false) - differenatiate the test - // self::check_array_from_version('1.9.0', true, $ret, 0, 'subkeys', 1, 'is_de_vs'); - self::check_array(GNUPG_PK_RSA, $ret, 0, 'subkeys', 1, 'pubkey_algo'); - self::check_array(2048, $ret, 0, 'subkeys', 1, 'length'); - self::check_array_from_version('1.7.0', false, $ret, 0, 'subkeys', 1, 'is_cardkey'); - } -} diff --git a/php-pecl-gnupg.spec b/php-pecl-gnupg.spec index f3624ea..428b201 100644 --- a/php-pecl-gnupg.spec +++ b/php-pecl-gnupg.spec @@ -20,7 +20,7 @@ %global ini_name 40-%{pecl_name}.ini %endif %global upstream_version 1.5.0 -%global upstream_prever RC1 +%global upstream_prever RC2 Summary: Wrapper around the gpgme library Name: %{?sub_prefix}php-pecl-gnupg @@ -31,10 +31,6 @@ License: BSD URL: https://pecl.php.net/package/gnupg Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz -Source1: https://raw.githubusercontent.com/php-gnupg/php-gnupg/master/tests/gnupgt.inc -Source2: https://raw.githubusercontent.com/php-gnupg/php-gnupg/master/tests/vars.inc -Patch0: gnupg-build.patch - BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel @@ -103,9 +99,6 @@ EOF mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS cd NTS -cp %{SOURCE1} %{SOURCE2} tests/ -%patch0 -p1 - # Check extension version extver=$(sed -n '/#define PHP_GNUPG_VERSION/{s/.* "//;s/".*$//;p}' php_gnupg.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then @@ -242,6 +235,10 @@ cd ../ZTS %changelog +* Mon Mar 8 2021 Remi Collet - 1.5.0~RC2-1 +- Update to 1.5.0RC2 +- drop patch merged upstream + * Mon Feb 15 2021 Remi Collet - 1.5.0~RC1-1 - Update to 1.5.0RC1 - open https://github.com/php-gnupg/php-gnupg/pull/25 diff --git a/vars.inc b/vars.inc deleted file mode 100644 index 02d2819..0000000 --- a/vars.inc +++ /dev/null @@ -1,69 +0,0 @@ - -- cgit