From 43a3dfa944725625b5c8b12760713fc55def99f7 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Jan 25 2016 15:31:15 +0000 Subject: use file triggers for pecl extensions (un)registration --- diff --git a/macros.pear b/macros.pear index 471c28d..04bda3a 100644 --- a/macros.pear +++ b/macros.pear @@ -27,10 +27,10 @@ # Define XML directories to store package registration information: # %pear_xmldir @LIBDIR@/pear/pkgxml -%pecl_xmldir @LIBDIR@/pear/pkgxml +%pecl_xmldir @LIBDIR@/php/peclxml # # Define macros to be used in scriplets for php-pecl-* spec files: # -%pecl_install %{__pecl} install --nodeps --soft --force --register-only --nobuild -%pecl_uninstall %{__pecl} uninstall --nodeps --ignore-errors --register-only +%pecl_install : +%pecl_uninstall : diff --git a/php-pear.spec b/php-pear.spec index 2bbf3b8..977a098 100644 --- a/php-pear.spec +++ b/php-pear.spec @@ -25,7 +25,7 @@ Summary: PHP Extension and Application Repository framework Name: php-pear Version: 1.10.1 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 1 # PEAR, PEAR_Manpages, Archive_Tar, XML_Util, Console_Getopt are BSD # Structures_Graph is LGPLv3+ @@ -235,6 +235,29 @@ echo 'Test suite disabled (missing "--with tests" option)' %endif +# Register newly installed PECL packages +%transfiletriggerin -- %{_localstatedir}/lib/php/peclxml +while read file; do + %{_bindir}/pecl install --nodeps --soft --force --register-only --nobuild $file || : +done + +# Unregister to be removed PECL packages +# Reading the xml file to retrieve channel and package name +%filetriggerun -- %{_localstatedir}/lib/php/peclxml +%{_bindir}/php -r ' +while ($file=fgets(STDIN)) { + $file = trim($file); + $xml = simplexml_load_file($file); + if (isset($xml->channel) && isset($xml->name)) { + printf("%s/%s\n", $xml->channel, $xml->name); + } else { + fputs(STDERR, "Bad pecl package file ($file)\n"); + } +}' | while read name; do + %{_bindir}/pecl uninstall --nodeps --ignore-errors --register-only $name || : +done + + %clean rm -rf $RPM_BUILD_ROOT rm new-pear.conf @@ -327,6 +350,10 @@ fi %changelog +* Mon Jan 25 2015 Remi Collet 1:1.10.1-2 +- use file triggers for pecl extensions (un)registration +- define %%pecl_install and %%pecl_uninstall as noop macro + * Sat Oct 17 2015 Remi Collet 1:1.10.1-1 - update PEAR to 1.10.1