summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2025-04-08 17:15:24 +0200
committerRemi Collet <remi@php.net>2025-04-08 17:15:24 +0200
commite89bd3557b568cd8b48b859bbc74642b439f0c2a (patch)
tree5bc5590008fc4b62d382787abd4929da707efa80
parent7114203ef3846709f24d74d037b7832feb07edec (diff)
add option to run tests with gpg1 instead og gpg2HEADmaster
-rw-r--r--gnupg-tests.patch27
-rw-r--r--php-pecl-gnupg.spec20
2 files changed, 41 insertions, 6 deletions
diff --git a/gnupg-tests.patch b/gnupg-tests.patch
index 17a858c..1bb6e4a 100644
--- a/gnupg-tests.patch
+++ b/gnupg-tests.patch
@@ -20,3 +20,30 @@ index 2b8aa08..7b06a0a 100644
}
/**
+From ce9e56099fa619f368676ccaa6b005c8d69f6f12 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 8 Apr 2025 16:59:40 +0200
+Subject: [PATCH] clean hidden files
+
+---
+ tests/gnupgt.inc | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/tests/gnupgt.inc b/tests/gnupgt.inc
+index 2b8aa08..7191ec1 100644
+--- a/tests/gnupgt.inc
++++ b/tests/gnupgt.inc
+@@ -90,9 +90,10 @@ class gnupgt {
+ if (!is_dir($homeDir)) {
+ return;
+ }
+- foreach (glob($homeDir . '/*') as $filename) {
+- if (!is_dir($filename)) {
+- unlink($filename);
++ $dir = opendir($homeDir);
++ while ($filename = readdir($dir)) {
++ if (!is_dir("$homeDir/$filename")) {
++ unlink("$homeDir/$filename");
+ }
+ }
+ $privKeyDir = self::get_priv_key_dir($homeDir);
diff --git a/php-pecl-gnupg.spec b/php-pecl-gnupg.spec
index 8397c34..9e71a64 100644
--- a/php-pecl-gnupg.spec
+++ b/php-pecl-gnupg.spec
@@ -15,6 +15,8 @@
%else
%bcond_without tests
%endif
+# to run test with GnuPG v1 instead of GnuPG v2
+%bcond_with gpg1
%global pecl_name gnupg
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
@@ -45,7 +47,9 @@ BuildRequires: gnupg
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
-# We force use of /usr/bin/gpg as gpg2 is unusable in non-interactive mode
+%if %{with gpg1}
+Requires: gnupg1
+%endif
Requires: gnupg
Provides: %{?scl_prefix}php-%{pecl_name} = %{version}
@@ -94,13 +98,18 @@ mkdir NTS
mkdir ZTS
%endif
+%if %{with gpg1}
+%{_bindir}/gpg1 --version
+%else
+%{_bindir}/gpg --version
+%endif
+
%build
%{?dtsenable}
export PHP_RPATH=no
export CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64"
-gpg --version
peclbuild() {
%configure \
@@ -149,6 +158,9 @@ done
%check
cd %{sources}
unset GPG_AGENT_INFO
+%if %{with gpg1}
+export GNUPGFILENAME=%{_bindir}/gpg1
+%endif
: Check if build NTS extension can be loaded
%{__php} -n -q \
@@ -162,12 +174,8 @@ REPORT_EXIT_STATUS=1 \
%{__php} -n run-tests.php \
-n -q \
-d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
-%if 0%{?fedora} >= 41
- --show-diff || : ignore failure
-%else
--show-diff
%endif
-%endif
%if %{with_zts}
: Check if build ZTS extension can be loaded