%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}} %global pear_name File_Util # Tests are only run with rpmbuild --with tests # Can't be run in mock because of circular dependencies %global with_tests %{?_with_tests:1}%{!?_with_tests:0} Name: php-pear-File-Util Version: 1.0.0 Release: 2%{?dist} Summary: Common file and directory utility functions Group: Development/Libraries License: PHP URL: http://pear.php.net/package/File_Util Source0: http://pear.php.net/get/%{pear_name}-%{version}.tgz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php-pear(PEAR) >= 1.7.0 %if %{with_tests} BuildRequires: php-pear(File) >= 1.4.0 %endif Requires(post): %{__pear} Requires(postun): %{__pear} Requires: php-pear(PEAR) >= 1.7.0 Requires: php-pear(File) >= 1.4.0 Provides: php-pear(%{pear_name}) = %{version} %description Common file and directory utility functions. Path handling, temp dir/file, sorting of files, listDirs, isIncludable and more. %prep %setup -q -c cd %{pear_name}-%{version} # Package is V2 mv ../package.xml %{name}.xml %build cd %{pear_name}-%{version} # Empty build section, most likely nothing required. %install cd %{pear_name}-%{version} rm -rf %{buildroot} docdir %{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml # Clean up unnecessary files rm -rf %{buildroot}%{pear_phpdir}/.??* # Install XML package description mkdir -p %{buildroot}%{pear_xmldir} install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir} %check cd %{pear_name}-%{version} %if %{with_tests} %{__pear} \ run-tests \ --recur \ --ini "-d include_path=%{buildroot}%{pear_phpdir}:%{pear_phpdir}" \ tests | tee ../tests.log grep "FAILED TESTS" ../tests.log && exit 1 %else echo 'Test suite disabled (missing "--with test" option)' %endif %clean rm -rf %{buildroot} %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 %defattr(-,root,root,-) %{pear_xmldir}/%{name}.xml %{pear_phpdir}/File/Util.php %{pear_testdir}/File_Util %changelog * Mon Mar 05 2012 Remi Collet - 1.0.0-2 - spec cleanups * Sat Mar 19 2011 Remi Collet - 1.0.0-1 - initial package