+# TODO
+# - bootstrap fails if /usr/share/pear/.lock doesn't exist (just create it as 644)
+# - should understand as php extension (php-pear-Auth):
+# pear/Auth can optionally use package "pecl/vpopmail" (version >= 0.2)
+# pear/Auth can optionally use package "pecl/kadm5" (version >= 0.2.3)
+#
+# Conditional build:
+%bcond_with FHS # writable files in /var/lib/pear. NEEDS LOTS OF PATCHING AND CONVINCING UPSTREAM
+#
+# NOTE
+# - macros needed to build this package are in SOURCES/php-pear-build-macros@DEVEL
%define _class PEAR
%define _status stable
%define _pearname %{_class}
#
%include /usr/lib/rpm/macros.php
Summary: PEAR Base System
-Summary(pl): Podstawowy system PEAR
+Summary(pl.UTF-8): Podstawowy system PEAR
Name: php-pear-%{_pearname}
-Version: 1.4.9
-Release: 0.27
+Version: 1.6.2
+Release: 1
Epoch: 1
License: PHP 3.0
Group: Development/Languages/PHP
Source0: http://pear.php.net/get/%{_pearname}-%{version}.tgz
-# Source0-md5: 52257e23987717c474a3da87f161a272
-Source1: http://pear.php.net/get/Console_Getopt-1.2.tgz
-# Source1-md5: 8f9ec8253c04350bc01ee7ca941e24b6
-Source2: %{name}-template.spec
+# Source0-md5: 8658f584d0ba2648b795fe8b1d8998c2
+Source1: http://pear.php.net/get/Console_Getopt-1.2.3.tgz
+# Source1-md5: d7618327f9302a7191893768982de823
+Source2: http://pear.php.net/get/Structures_Graph-1.0.2.tgz
+# Source2-md5: 2664e2d024048f982e12fad4d1bfbb87
Patch0: %{name}-sysconfdir.patch
-Patch1: %{name}-rpmpkgname.patch
-Patch2: %{name}-rpmvars.patch
-Patch3: %{name}-old-api.patch
-Patch4: %{name}-specfile.patch
+Patch1: %{name}-strict.patch
Patch5: %{name}-FHS.patch
URL: http://pear.php.net/package/PEAR
-BuildRequires: php-cli
+BuildRequires: /usr/bin/php
+BuildRequires: php(pcre)
+BuildRequires: php(xml)
BuildRequires: rpm-php-pearprov >= 4.4.2-30.1
-BuildRequires: package-not-usable
+BuildRequires: rpmbuild(macros) >= 1.375
Requires: %{name}-core = %{epoch}:%{version}-%{release}
Requires: /usr/bin/php
-Requires: php-pcre
-Requires: php-pear >= 4:1.0-12.3
+Requires: php(pcre)
+Requires: php(xml)
+Requires: php(zlib)
+Requires: php-pear >= 4:1.0-14
Requires: php-pear-Archive_Tar >= 1.1
Requires: php-pear-Console_Getopt >= 1.2
-Requires: php-pear-XML_RPC >= 1.4.0
-Requires: php-xml
-Requires: php-zlib
+Requires: php-pear-Structures_Graph >= 1.0.2
Obsoletes: php-pear-PEAR-Command
Obsoletes: php-pear-PEAR-Frontend-CLI
Obsoletes: php-pear-PEAR-OS
# PEAR_Command_Packaging is separate package
%define _noautoreq 'pear(PEAR/FTP.php)' 'pear(Net/FTP.php)' 'pear(XML/RPC.*)' 'pear(PEAR/Command/Packaging.php)'
+%if %{with FHS}
%define _statedir /var/lib/pear
-%define pear_registry %{_statedir}/registry
+%define _registrydir %{_statedir}/registry
+%define _channelsdir %{_statedir}/.channels
+%else
+%define _statedir %{php_pear_dir}
+%define _registrydir %{_statedir}/.registry
+%define _channelsdir %{_statedir}/.channels
+%endif
%description
The PEAR package contains:
In PEAR status of this package is: %{_status}.
-%description -l pl
+%description -l pl.UTF-8
Pakiet PEAR zawiara:
-- PEAR installer do tworzenia, dystrybucji i instalowania pakietów,
-- mechanizm PEAR_Exception (w fazie alpha) do obs³ugi b³êdów PHP5,
-- zaawansowany mechanizm PEAR_ErrorStack (w fazie beta) do obs³ugi
- b³êdów,
-- mechanizm obs³ugi b³êdów PEAR_Error,
-- klasê OS_Guess do pozyskiwania informacji na temat systemu
+- PEAR installer do tworzenia, dystrybucji i instalowania pakietów,
+- mechanizm PEAR_Exception (w fazie alpha) do obsługi błędów PHP5,
+- zaawansowany mechanizm PEAR_ErrorStack (w fazie beta) do obsługi
+ błędów,
+- mechanizm obsługi błędów PEAR_Error,
+- klasę OS_Guess do pozyskiwania informacji na temat systemu
operacyjnego,
-- klasê System do szybkiej obs³ugi typowych operacji na plikach i
+- klasę System do szybkiej obsługi typowych operacji na plikach i
katalogach,
-- podstawow± klasy PEAR.
+- podstawową klasy PEAR.
Ta klasa ma w PEAR status: %{_status}.
%package core
Summary: PEAR core classes
-Summary(pl): G³ówne klasy PEAR-a
+Summary(pl.UTF-8): Główne klasy PEAR-a
Group: Development/Languages/PHP
%description core
and classes for PHP 5:
- PEAR_ErrorStack and PEAR_Exception
-%description core -l pl
-Ten pakiet zawiera g³ówne klasy PEAR-a:
-- klasê PEAR i PEAR_Error
+%description core -l pl.UTF-8
+Ten pakiet zawiera główne klasy PEAR-a:
+- klasę PEAR i PEAR_Error
- System
- OS_Gueass
oraz klasy dla PHP 5:
- PEAR_ErrorStack i PEAR_Exception
%prep
-%define __build_dir %{_builddir}/%{_class}-%{version}
-%define __php_include_path %{__build_dir}/%{_class}-%{version}:%{__build_dir}/%(basename %{SOURCE1} .tgz)
-%define __pear php -doutput_buffering=1 -dinclude_path="%__php_include_path" %{__build_dir}/%{_class}-%{version}/scripts/pearcmd.php
-%pear_package_setup -z -a1
+%define __build_dir %{_builddir}/%{_class}-%{version}%{?_rc}
+%define __php_include_path %{__build_dir}/%{_class}-%{version}%{?_rc}:%{__build_dir}/%(basename %{SOURCE1} .tgz):%{__build_dir}/%(basename %{SOURCE2} .tgz)
+%define __pear php -dmemory_limit=-1 -doutput_buffering=1 -dinclude_path="%__php_include_path" %{__build_dir}/%{_class}-%{version}%{?_rc}/scripts/pearcmd.php
+
+%setup -q -c -n %{_pearname}-%{version} -a1 -a2
+%pear_package_setup -z -D -n %{_pearname}-%{version}%{?_rc}
%patch0 -p1
%patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
-%patch5 -p1
+%{?with_FHS:%patch5 -p1}
find '(' -name '*~' -o -name '*.orig' ')' | xargs -r rm -v
-%install
-rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{php_pear_dir},%{_bindir}}
-
+%build
D=$(pwd)
pearcmd() {
%{__pear} -c ${D}/pearrc "$@"
pearcmd config-set php_dir %{php_pear_dir} || exit
pearcmd config-set test_dir %{php_pear_dir}/tests || exit
pearcmd config-set sig_bin %{_bindir}/gpg || exit
-cp $D/pearrc $RPM_BUILD_ROOT%{_sysconfdir}/pear.conf
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{php_pear_dir},%{_bindir}}
%pear_package_install
+cp pearrc $RPM_BUILD_ROOT%{_sysconfdir}/pear.conf
-install -d $RPM_BUILD_ROOT%{_statedir}/channels/.alias
-install -d $RPM_BUILD_ROOT%{pear_registry}/{.channel.{__uri,pecl.php.net},channels/.alias}
+install -d $RPM_BUILD_ROOT%{_channelsdir}/.alias
+install -d $RPM_BUILD_ROOT%{_registrydir}/{.channel.{__uri,pecl.php.net},channels/.alias}
touch $RPM_BUILD_ROOT%{_statedir}/.depdb{,lock}
-touch $RPM_BUILD_ROOT%{_statedir}/channels/{__uri,{pear,pecl}.php.net}.reg
-touch $RPM_BUILD_ROOT%{_statedir}/channels/.alias/{pear,pecl}.txt
+touch $RPM_BUILD_ROOT%{_channelsdir}/{__uri,{pear,pecl}.php.net}.reg
+touch $RPM_BUILD_ROOT%{_channelsdir}/.alias/{pear,pecl}.txt
touch $RPM_BUILD_ROOT%{php_pear_dir}/.filemap
touch $RPM_BUILD_ROOT%{php_pear_dir}/.lock
# for rpm to find interpreter
chmod +x $RPM_BUILD_ROOT%{_bindir}/*
-sed -e '/^\$''Log: /,$d' %{SOURCE2} > $RPM_BUILD_ROOT%{php_pear_dir}/data/%{_class}/template.spec
-echo '$''Log: $' >> $RPM_BUILD_ROOT%{php_pear_dir}/data/%{_class}/template.spec
-
%post
+%if %{with FHS}
if [ ! -L %{php_pear_dir}/.registry ]; then
if [ -d %{php_pear_dir}/.registry ]; then
- install -d %{pear_registry}
- mv -f %{php_pear_dir}/.registry/*.reg %{pear_registry}
+ install -d %{_registrydir}
+ mv -f %{php_pear_dir}/.registry/*.reg %{_registrydir}
rmdir %{php_pear_dir}/.registry/.channel.* 2>/dev/null
rmdir %{php_pear_dir}/.registry/* 2>/dev/null
rmdir %{php_pear_dir}/.registry 2>/dev/null || mv -v %{php_pear_dir}/.registry{,.rpmsave}
fi
- ln -s %{pear_registry} %{php_pear_dir}/.registry
+ ln -s %{_registrydir} %{php_pear_dir}/.registry
fi
+%endif
if [ ! -f %{php_pear_dir}/.lock ]; then
umask 2
%{_bindir}/pear list > /dev/null
fi
+
if [ -f %{_docdir}/%{name}-%{version}/optional-packages.txt ]; then
cat %{_docdir}/%{name}-%{version}/optional-packages.txt
fi
%{php_pear_dir}/data/*
+%if %{with FHS}
%dir %{_statedir}
-%dir %{_statedir}/channels
-%dir %{_statedir}/registry
-%dir %{_statedir}/channels/.alias
-
-%ghost %{_statedir}/channels/.alias/pear.txt
-%ghost %{_statedir}/channels/.alias/pecl.txt
-%ghost %{_statedir}/channels/pear.php.net.reg
-%ghost %{_statedir}/channels/pecl.php.net.reg
-%ghost %{_statedir}/channels/__uri.reg
-%ghost %{_statedir}/registry/.channel.__uri
-%ghost %{_statedir}/registry/.channel.pecl.php.net
+%dir %{_registrydir}
+%ghost %dir %{php_pear_dir}/.registry
+%endif
+%dir %{_channelsdir}
+%dir %{_channelsdir}/.alias
+
+%ghost %{_channelsdir}/.alias/pear.txt
+%ghost %{_channelsdir}/.alias/pecl.txt
+%ghost %{_channelsdir}/pear.php.net.reg
+%ghost %{_channelsdir}/pecl.php.net.reg
+%ghost %{_channelsdir}/__uri.reg
+%ghost %{_registrydir}/.channel.__uri
+%ghost %{_registrydir}/.channel.pecl.php.net
%ghost %{_statedir}/.depdblock
%ghost %{_statedir}/.depdb
%ghost %{php_pear_dir}/.filemap
%ghost %{php_pear_dir}/.lock
-%ghost %dir %{php_pear_dir}/.registry
%files core
%defattr(644,root,root,755)