[packages/php/PHP_5_3] use alternatives for phar links
glen
glen at pld-linux.org
Sun Jan 31 19:06:05 CET 2016
commit 36f6fa718a87d0c0a2e3916331ea758e4b3e2acb
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sun Jan 31 15:15:14 2016 +0200
use alternatives for phar links
php.spec | 37 ++++++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
---
diff --git a/php.spec b/php.spec
index efdbb6b..8edf05a 100644
--- a/php.spec
+++ b/php.spec
@@ -1490,6 +1490,7 @@ Group: Libraries
URL: http://www.php.net/manual/en/book.phar.php
Requires: %{name}-common = %{epoch}:%{version}-%{release}
Requires: %{name}-spl = %{epoch}:%{version}-%{release}
+Requires: alternatives
Suggests: %{name}-cli
# zlib is required by phar program, but as phar cli is optional should the dep be too
Suggests: %{name}-zlib
@@ -2558,8 +2559,9 @@ cp -pf Makefile.cli Makefile
# version the .phar files
mv $RPM_BUILD_ROOT%{_bindir}/phar{,%{ver_suffix}}.phar
-# make link relative
-ln -sfn phar%{ver_suffix}.phar $RPM_BUILD_ROOT%{_bindir}/phar
+# touch for ghost
+%{__rm} $RPM_BUILD_ROOT%{_bindir}/phar
+touch $RPM_BUILD_ROOT%{_bindir}/phar
# version suffix
v=$(echo %{version} | cut -d. -f1-2)
@@ -2805,16 +2807,24 @@ sed -i -e 's#modules/libphp5.so#modules/mod_php.so#g' /etc/apache/conf.d/*_mod_p
sed -i -e 's#modules/libphp[57].so#modules/mod_php.so#g' /etc/httpd/conf.d/*_mod_php.conf
# common macros called at extension post/postun scriptlet
-%define extension_scripts() \
-%post %1 \
+%define ext_post \
if [ "$1" = "1" ]; then \
%php_webserver_restart \
fi \
-\
-%postun %1 \
+%{nil}
+
+%define ext_postun \
if [ "$1" = "0" ]; then \
%php_webserver_restart \
-fi
+fi \
+%{nil}
+
+%define extension_scripts() \
+%post %1 \
+%ext_post \
+\
+%postun %1 \
+%ext_postun
%{nil}
# extension scripts defines
@@ -2859,7 +2869,6 @@ fi
%extension_scripts pdo-pgsql
%extension_scripts pdo-sqlite
%extension_scripts pgsql
-%extension_scripts phar
%extension_scripts pcntl
%extension_scripts posix
%extension_scripts pspell
@@ -2888,6 +2897,16 @@ fi
%extension_scripts zip
%extension_scripts zlib
+%post phar
+%ext_post
+update-alternatives --install %{_bindir}/phar phar %{_bindir}/phar%{ver_suffix}.phar %{ver_suffix} || :
+
+%postun phar
+%ext_postun
+if [ $1 -eq 0 ]; then
+ update-alternatives --remove phar %{_bindir}/phar || :
+fi
+
%if %{with apache1}
%files -n apache1-mod_%{name}
%defattr(644,root,root,755)
@@ -3286,8 +3305,8 @@ fi
%doc ext/phar/{CREDITS,TODO}
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/conf.d/phar.ini
%attr(755,root,root) %{php_extensiondir}/phar.so
-%attr(755,root,root) %{_bindir}/phar
%attr(755,root,root) %{_bindir}/phar%{ver_suffix}.phar
+%ghost %{_bindir}/phar
%endif
%files posix
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/php.git/commitdiff/36f6fa718a87d0c0a2e3916331ea758e4b3e2acb
More information about the pld-cvs-commit
mailing list