1 |
%define peardir %(pear config-get php_dir 2> /dev/null || echo %{_datadir}/pear) |
2 |
%define xmldir /var/lib/pear |
3 |
%global pear_name Console_GetoptPlus |
4 |
|
5 |
Summary: Command-line option parser - Console Getopt+ (Getopt Plus) |
6 |
Name: php-pear-Console-GetoptPlus |
7 |
Version: 1.0.0RC1 |
8 |
Release: 2%{?dist} |
9 |
License: The BSD License |
10 |
Group: Development/Libraries |
11 |
Source0: http://pear.php.net/get/Console_GetoptPlus-%{version}.tgz |
12 |
BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n) |
13 |
URL: http://pear.php.net/package/Console_GetoptPlus |
14 |
|
15 |
BuildRequires: php-pear(PEAR) >= 1.4.7 |
16 |
Provides: php-pear(%{pear_name}) = %{version} |
17 |
|
18 |
#BuildRequires: PEAR::PEAR >= 1.4.7 |
19 |
|
20 |
BuildArch: noarch |
21 |
|
22 |
%description |
23 |
This package is (1) a PHP5 port/rewrite of Console_Getopt, (2) with added |
24 |
functionalities, and (3) with a Web interface to run getopt-like shell |
25 |
commands through a browser (not implemented yet). |
26 |
|
27 |
(1) Console_getoptPlus:getopt() is a replacement for |
28 |
Console_getopt:getopt(). |
29 |
Same for getopt2() and readPHPArgv(). It returns PEAR_Exception instead of |
30 |
PEAR_Error. Error messages are the same. |
31 |
|
32 |
(2) GetoptPlus:getoptplus uses an array-based description of the command. |
33 |
It can generates the command usage/help automaticly. It can return the |
34 |
parsed options and parameters in an associative array. It can be set to |
35 |
accept option shortcut names. |
36 |
|
37 |
Fully tested with phpUnit. Code coverage test close to 100%. |
38 |
|
39 |
Usage is fully documented in docs/examples files. |
40 |
|
41 |
%prep |
42 |
%setup -c -T |
43 |
pear -v -c pearrc \ |
44 |
-d php_dir=%{peardir} \ |
45 |
-d doc_dir=/docs \ |
46 |
-d bin_dir=%{_bindir} \ |
47 |
-d data_dir=%{peardir}/data \ |
48 |
-d test_dir=%{peardir}/tests \ |
49 |
-d ext_dir=%{_libdir} \ |
50 |
-s |
51 |
|
52 |
%build |
53 |
|
54 |
%install |
55 |
rm -rf %{buildroot} |
56 |
pear -c pearrc install --nodeps --packagingroot %{buildroot} %{SOURCE0} |
57 |
|
58 |
# Clean up unnecessary files |
59 |
rm pearrc |
60 |
rm %{buildroot}/%{peardir}/.filemap |
61 |
rm %{buildroot}/%{peardir}/.lock |
62 |
rm -rf %{buildroot}/%{peardir}/.registry |
63 |
rm -rf %{buildroot}%{peardir}/.channels |
64 |
rm %{buildroot}%{peardir}/.depdb |
65 |
rm %{buildroot}%{peardir}/.depdblock |
66 |
|
67 |
mv %{buildroot}/docs . |
68 |
|
69 |
|
70 |
# Install XML package description |
71 |
mkdir -p %{buildroot}%{xmldir} |
72 |
tar -xzf %{SOURCE0} package.xml |
73 |
cp -p package.xml %{buildroot}%{xmldir}/Console_GetoptPlus.xml |
74 |
|
75 |
%clean |
76 |
rm -rf %{buildroot} |
77 |
|
78 |
%post |
79 |
pear install --nodeps --soft --force --register-only %{xmldir}/Console_GetoptPlus.xml >/dev/null || : |
80 |
|
81 |
%postun |
82 |
if [ "$1" -eq "0" ]; then |
83 |
pear uninstall --nodeps --ignore-errors --register-only pear.php.net/Console_GetoptPlus >/dev/null || : |
84 |
fi |
85 |
|
86 |
%files |
87 |
%defattr(-,root,root) |
88 |
%doc docs/Console_GetoptPlus/* |
89 |
%{peardir}/* |
90 |
%{xmldir}/Console_GetoptPlus.xml |
91 |
|
92 |
%changelog |
93 |
* Mon May 6 2013 John H. Bennett III <bennettj@johnbennettservices.com> - 1.0.0RC1-2 |
94 |
- updated spec file requires section, and left original info remarked. |
95 |
|
96 |
* Sun May 5 2013 John H. Bennett III <bennettj@johnbennettservices.com> - 1.0.0RC1-1 |
97 |
- Original from pear-make-rpm-spec. |
98 |
|