From 1663d68e6e95a0d41ca0b3c2699e64c16efb0434 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Tue, 21 Aug 2018 18:37:45 +0000 Subject: [PATCH 1/1] - from PLD --- ext-check.patch | 19 +++ php-pear-PEAR-FHS.patch | 13 +++ php-pear-PEAR-sysconfdir.patch | 11 ++ php-pear-PEAR.spec | 205 +++++++++++++++++++++++++++++++++ 4 files changed, 248 insertions(+) create mode 100644 ext-check.patch create mode 100644 php-pear-PEAR-FHS.patch create mode 100644 php-pear-PEAR-sysconfdir.patch create mode 100644 php-pear-PEAR.spec diff --git a/ext-check.patch b/ext-check.patch new file mode 100644 index 0000000..c3f7784 --- /dev/null +++ b/ext-check.patch @@ -0,0 +1,19 @@ +--- PEAR-1.9.4/usr/share/pear/pearcmd.php~ 2014-05-14 19:21:49.000000000 +0300 ++++ PEAR-1.9.4/usr/share/pear/pearcmd.php 2014-05-14 19:21:53.064418441 +0300 +@@ -45,6 +45,16 @@ + + $pear_package_version = "1.9.4"; + ++// before trying anything deep, ensure base extensions are present ++// this avoids debugging problems with bogus error messages, which really are ++// caused by missing extension ++foreach (array('pcre', 'zlib', 'xml') as $ext) { ++ if (!extension_loaded($ext)) { ++ error_log("pear requires PHP extension '$ext' for ".PHP_VERSION); ++ exit(1); ++ } ++} ++ + require_once 'PEAR.php'; + require_once 'PEAR/Frontend.php'; + require_once 'PEAR/Config.php'; diff --git a/php-pear-PEAR-FHS.patch b/php-pear-PEAR-FHS.patch new file mode 100644 index 0000000..f67d9e9 --- /dev/null +++ b/php-pear-PEAR-FHS.patch @@ -0,0 +1,13 @@ +--- /usr/share/pear/PEAR/Registry.php~ 2006-03-02 01:40:24.000000000 +0200 ++++ /usr/share/pear/PEAR/Registry.php 2006-03-02 01:46:34.000000000 +0200 +@@ -143,8 +143,8 @@ + parent::PEAR(); + $ds = DIRECTORY_SEPARATOR; + $this->install_dir = $pear_install_dir; +- $this->channelsdir = $pear_install_dir.$ds.'.channels'; +- $this->statedir = $pear_install_dir.$ds.'.registry'; ++ $this->channelsdir = '/var/lib/pear/channels'; ++ $this->statedir = '/var/lib/pear/registry'; + $this->filemap = $pear_install_dir.$ds.'.filemap'; + $this->lockfile = $pear_install_dir.$ds.'.lock'; + $this->_pearChannel = $pear_channel; diff --git a/php-pear-PEAR-sysconfdir.patch b/php-pear-PEAR-sysconfdir.patch new file mode 100644 index 0000000..33758e9 --- /dev/null +++ b/php-pear-PEAR-sysconfdir.patch @@ -0,0 +1,11 @@ +--- ./usr/share/pear/PEAR/Config.php~ 2005-09-18 10:41:04.000000000 +0300 ++++ ./usr/share/pear/PEAR/Config.php 2005-09-18 10:48:21.000000000 +0300 +@@ -61,7 +61,7 @@ + } elseif (getenv('SystemRoot')) { + define('PEAR_CONFIG_SYSCONFDIR', getenv('SystemRoot')); + } else { +- define('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR); ++ define('PEAR_CONFIG_SYSCONFDIR', '/etc'); + } + + // Default for master_server diff --git a/php-pear-PEAR.spec b/php-pear-PEAR.spec new file mode 100644 index 0000000..f451aaf --- /dev/null +++ b/php-pear-PEAR.spec @@ -0,0 +1,205 @@ +# 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) +# +%define _pearname PEAR +%define _status stable +%define php_name php%{?php_suffix} +%define php_min_version 5.4.0 +%include /usr/lib/rpm/macros.php +Summary: PEAR Base System +Summary(pl.UTF-8): Podstawowy system PEAR +Name: php-pear-%{_pearname} +Version: 1.10.1 +Release: 2 +Epoch: 1 +License: New BSD License +Group: Development/Languages/PHP +Source0: http://pear.php.net/get/%{_pearname}-%{version}.tgz +# Source0-md5: da3f4d00c7415d39cb57848742e09894 +Source1: http://pear.php.net/get/Console_Getopt-1.4.1.tgz +# Source1-md5: a95c86528f910562772274eefb90ca2c +Source2: http://pear.php.net/get/Structures_Graph-1.1.1.tgz +# Source2-md5: f1be7827074c4f51eb1af245f0f7c5c4 +Patch0: %{name}-sysconfdir.patch +Patch1: ext-check.patch +Patch2: %{name}-FHS.patch +URL: http://pear.php.net/package/PEAR +BuildRequires: %{php_name}-pcre +BuildRequires: %{php_name}-xml +BuildRequires: /usr/bin/php +BuildRequires: rpm-php-pearprov >= 4.4.2-30.1 +BuildRequires: rpmbuild(macros) >= 1.654 +Requires: %{name}-core = %{epoch}:%{version}-%{release} +Requires: /usr/bin/php +Requires: php(core) >= %{php_min_version} +Requires: php(pcre) +Requires: php(xml) +Requires: php(zlib) +Requires: php-pear >= 4:1.2-1 +Requires: php-pear-Archive_Tar >= 1.3.11 +Requires: php-pear-Console_Getopt >= 1.2.3 +Requires: php-pear-Structures_Graph >= 1.0.4 +Requires: php-pear-XML_Util >= 1.2.3 +Requires: rpm-whiteout +Suggests: php-pear-Net_FTP +Obsoletes: php-pear-PEAR-Command +Obsoletes: php-pear-PEAR-Frontend_CLI +Obsoletes: php-pear-PEAR-OS +Conflicts: php-pear-PEAR_Frontend_Gtk < 0.4.0 +Conflicts: php-pear-PEAR_Frontend_Web < 0.5.0 +Conflicts: rpm-whiteout < 1.1 +Conflicts: rpmbuild(macros) < 1.563 +BuildArch: noarch +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +# PEAR_Command_Packaging is separate package +# PEAR_FTP is optional +%define _noautoreq_pear PEAR/FTP.php Net/FTP.php XML/RPC.* PEAR/Command/Packaging.php + +%description +The PEAR package contains: +- the PEAR installer, for creating, distributing and installing + packages +- the alpha-quality PEAR_Exception PHP5 error handling mechanism +- the beta-quality PEAR_ErrorStack advanced error handling mechanism +- the PEAR_Error error handling mechanism +- the OS_Guess class for retrieving info about the OS where PHP is + running on +- the System class for quick handling of common operations with files + and directories +- the PEAR base class packages + +In PEAR status of this package is: %{_status}. + +%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 + operacyjnego, +- klasę System do szybkiej obsługi typowych operacji na plikach i + katalogach, +- podstawową klasy PEAR. + +Ta klasa ma w PEAR status: %{_status}. + +%package core +Summary: PEAR core classes +Summary(pl.UTF-8): Główne klasy PEAR-a +Group: Development/Languages/PHP +Requires: php(core) >= %{php_min_version} + +%description core +This package includes PEAR core classes: +- PEAR class and PEAR_Error +- System +- OS_Guess +and classes for PHP 5: +- PEAR_ErrorStack and PEAR_Exception + +%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}/%{_pearname}-%{version}%{?_rc} +%define __php_include_path %{__build_dir}/%{_pearname}-%{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}/%{_pearname}-%{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 +%{?with_FHS:%patch2 -p1} + +find '(' -name '*~' -o -name '*.orig' ')' | xargs -r rm -v + +%build +D=$(pwd) +pearcmd() { + %{__pear} -c ${D}/pearrc "$@" +} +pearcmd config-set doc_dir %{_docdir} +pearcmd config-set data_dir %{php_pear_dir}/data +pearcmd config-set php_dir %{php_pear_dir} +pearcmd config-set test_dir %{php_pear_dir}/tests +pearcmd config-set sig_bin %{_bindir}/gpg +pearcmd config-set cfg_dir %{_sysconfdir}/pear + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT{%{_sysconfdir}/pear,%{php_pear_dir},%{_bindir}} +%pear_package_install +cp -a pearrc $RPM_BUILD_ROOT%{_sysconfdir}/pear.conf + +# -C and -q options were for php-cgi, in php-cli they're enabled by default. +%define php_exec exec /usr/bin/php -dinclude_path=%{php_pear_dir} -doutput_buffering=1 +cat > $RPM_BUILD_ROOT%{_bindir}/pear <<'EOF' +#!/bin/sh +%php_exec -dopen_basedir="" -dmemory_limit=128M %{php_pear_dir}/pearcmd.php "$@" +EOF +cat > $RPM_BUILD_ROOT%{_bindir}/peardev <<'EOF' +#!/bin/sh +%php_exec -dopen_basedir="" -dmemory_limit=-1 %{php_pear_dir}/pearcmd.php "$@" +EOF +# This -dextension=pcre.so works with php-5.1, and patched php-cli >= 4:5.0.5-18.1, php4-cli >= 3:4.4.1-6.1 +# -n is there because devs on #pear said this avoids locking problems when replacing in use libraries. +cat > $RPM_BUILD_ROOT%{_bindir}/pecl <<'EOF' +#!/bin/sh +%php_exec -dmemory_limit=64M -dsafe_mode=0 -n -dextension=xml.so %{php_pear_dir}/peclcmd.php "$@" +EOF +# for rpm to find interpreter +chmod +x $RPM_BUILD_ROOT%{_bindir}/* + +%post +if [ -f %{_docdir}/%{name}-%{version}/optional-packages.txt ]; then + cat %{_docdir}/%{name}-%{version}/optional-packages.txt +fi + +# need to bootstrap for non-root user +if [ ! -f %{php_pear_dir}/.lock ]; then + umask 2 + %{_bindir}/pear list > /dev/null +fi + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(644,root,root,755) +%doc install.log optional-packages.txt +%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pear.conf +%dir %{_sysconfdir}/pear +%attr(755,root,root) %{_bindir}/pear +%attr(755,root,root) %{_bindir}/peardev +%attr(755,root,root) %{_bindir}/pecl +%{php_pear_dir}/.registry/pear.reg +%{php_pear_dir}/pearcmd.php +%{php_pear_dir}/peclcmd.php +%{php_pear_dir}/PEAR/* + +# in -core subpackage +%exclude %{php_pear_dir}/PEAR/ErrorStack.php +%exclude %{php_pear_dir}/PEAR/Exception.php + +%{php_pear_dir}/data/* + +%files core +%defattr(644,root,root,755) +%{php_pear_dir}/PEAR.php +%{php_pear_dir}/System.php +%{php_pear_dir}/OS +%dir %{php_pear_dir}/PEAR +%{php_pear_dir}/PEAR/ErrorStack.php +%{php_pear_dir}/PEAR/Exception.php -- 2.46.0