summaryrefslogtreecommitdiffstats
path: root/php-pear-crypt-gpg.spec
blob: 8189b9030cd21bc5983dc83e038af2222d445736 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# remirepo/fedora spec file for php-pear-crypt-gpg
#
# Copyright (c) 2015-2019 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#

%{!?__pear:       %global __pear       %{_bindir}/pear}
%global pear_name Crypt_GPG
%if 0%{?rhel}
# All features require GnuPG v1 (under investigation)
%global with_tests 0%{?_with_tests:1}
%else
%global with_tests 0%{!?_without_tests:1}
%endif
# remirepo:1
%global with_tests 0%{?_with_tests:1}

Name:           php-pear-crypt-gpg
Version:        1.6.3
Release:        3%{?dist}
Summary:        GNU Privacy Guard (GnuPG)

License:        LGPLv2+
URL:            http://pear.php.net/package/%{pear_name}
Source0:        http://pear.php.net/get/%{pear_name}-%{version}.tgz

# Use /usr/bin/gpg1 if available
Patch0:         %{pear_name}-gpg1.patch

BuildArch:      noarch
BuildRequires:  php-pear(PEAR)
%if %{with_tests}
# for tests
BuildRequires:  php-composer(phpunit/phpunit)
%if 0%{?fedora} >= 30
BuildRequires:  %{_bindir}/gpg1
%else
BuildRequires:  %{_bindir}/gpg
%endif
BuildRequires:  %{_bindir}/gpg-agent
# remirepo:1
BuildRequires:  gnupg < 2
BuildRequires:  %{_bindir}/ps
%endif

Requires(post): %{__pear}
Requires(postun): %{__pear}
Requires:       php-pear(PEAR)

%if 0%{?fedora} >= 30
Requires:       %{_bindir}/gpg1
%else
Requires:       %{_bindir}/gpg
%endif
# remirepo:1
Requires:       gnupg < 2
# From package.pear
Requires:       php(language) >= 5.4.8
Requires:       php-pear(Console_CommandLine) >= 1.1.10
Requires:       php-mbstring
# From phpcompatinfo report for version 1.4.1
Requires:       php-ctype
Requires:       php-date
Requires:       php-json
Requires:       php-pcre
Requires:       php-spl
# Optional
Requires:       php-posix

Provides:       php-pear(%{pear_name}) = %{version}
Provides:       php-composer(pear/crypt_gpg) = %{version}


%description
This package provides an object oriented interface to 
GNU Privacy Guard (GnuPG).

Though GnuPG can support symmetric-key cryptography, this package
is intended only to facilitate public-key cryptography.


%prep
%setup -q -c

%{?_licensedir:sed -e '/LICENSE/d' -i package.xml}

cd %{pear_name}-%{version}
if [ -x %{_bindir}/gpg1 ]; then
%patch0 -p1 -b .rpm
sed -e '/Engine.php/s/md5sum="[^"]*"//' \
    -i ../package.xml
fi

mv  ../package.xml %{name}.xml


%build
cd %{pear_name}-%{version}
# Empty build section, most likely nothing required.


%install
cd %{pear_name}-%{version}
%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml

# Clean up unnecessary files
rm -rf %{buildroot}%{pear_metadir}/.??*

# Install XML package description
mkdir -p %{buildroot}%{pear_xmldir}
install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir}


%if %{with_tests}
%check
cd %{pear_name}-%{version}/tests

: Upstream test suite
# PHP 7.2: https://pear.php.net/bugs/bug.php?id=21240
ret=0
for cmd in php php70 php71 php72; do
  if which $cmd; then
    $cmd %{_bindir}/phpunit --verbose . || ret=1
  fi
done
exit $ret
%endif


%post
%{__pear} install --nodeps --soft --force --register-only \
    %{pear_xmldir}/%{name}.xml >/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    %{__pear} uninstall --nodeps --ignore-errors --register-only \
        pear.php.net/%{pear_name} >/dev/null || :
fi


%files
%{?_licensedir:%license %{pear_name}-%{version}/LICENSE}
%doc %{pear_docdir}/%{pear_name}
%{pear_xmldir}/%{name}.xml
%{pear_testdir}/%{pear_name}
%{pear_datadir}/%{pear_name}
%{_bindir}/crypt-gpg-pinentry
%dir %{pear_phpdir}/Crypt
     %{pear_phpdir}/Crypt/GPG*


%changelog
* Tue Feb  5 2019 Remi Collet <remi@remirepo.net> - 1.6.3-3
- fix FTBFS, use gpg1

* Mon Jun  4 2018 Remi Collet <remi@remirepo.net> - 1.6.3-1
- update to 1.6.3

* Mon Sep  4 2017 Remi Collet <remi@remirepo.net> - 1.6.2-1
- Update to 1.6.2
- open https://pear.php.net/bugs/bug.php?id=21240 - PHP 7.2 test failure

* Sun Aug 27 2017 Remi Collet <remi@remirepo.net> - 1.6.1-1
- Update to 1.6.1

* Mon Feb 27 2017 Remi Collet <remi@fedoraproject.org> - 1.6.0-1
- Update to 1.6.0

* Fri Oct 07 2016 Remi Collet <remi@fedoraproject.org> - 1.4.3-1
- Update to 1.4.3

* Mon Jun 20 2016 Remi Collet <remi@fedoraproject.org> - 1.4.2-1
- Update to 1.4.2
- always use gnupg v1

* Sun Apr 17 2016 Remi Collet <remi@fedoraproject.org> - 1.4.1-1
- Update to 1.4.1

* Fri Dec 18 2015 Remi Collet <remi@fedoraproject.org> - 1.4.0-1
- Initial package, version 1.4.0 (stable)
- open https://github.com/pear/Crypt_GPG/pull/19 for fsf address