From c90210188627d351d3d3c40788cc4a85e616ac04 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Feb 10 2016 07:32:44 +0000 Subject: - use file triggers for pecl extensions (un)registration - define %pecl_install and %pecl_uninstall as noop macro --- diff --git a/macros.pear b/macros.pear index 471c28d..83fad9d 100644 --- a/macros.pear +++ b/macros.pear @@ -24,13 +24,13 @@ %pecl_datadir %(%{__pecl} config-get data_dir 2> /dev/null || echo undefined) # -# Define XML directories to store package registration information: +# Define XML directories to store PEAR package registration information: +# pecl_xmldir is now defined in macros.php (from php-devel) # %pear_xmldir @LIBDIR@/pear/pkgxml -%pecl_xmldir @LIBDIR@/pear/pkgxml # -# Define macros to be used in scriplets for php-pecl-* spec files: +# Define noop macros for old scriplets used in 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 f9a7653..3daa16e 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: 2%{?dist} +Release: 3%{?dist} Epoch: 1 # PEAR, PEAR_Manpages, Archive_Tar, XML_Util, Console_Getopt are BSD # Structures_Graph is LGPLv3+ @@ -52,6 +52,8 @@ BuildRequires: php(language) > 5.4 BuildRequires: php-cli BuildRequires: php-xml BuildRequires: gnupg +# For pecl_xmldir macro +BuildRequires: php-devel %if %{with_tests} BuildRequires: %{_bindir}/phpunit %endif @@ -234,6 +236,30 @@ exit $ret echo 'Test suite disabled (missing "--with tests" option)' %endif +## TODO: silent the pecl commands + +# Register newly installed PECL packages +%transfiletriggerin -- %{pecl_xmldir} +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 +%transfiletriggerun -- %{pecl_xmldir} +%{_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 @@ -327,6 +353,10 @@ fi %changelog +* Wed Feb 10 2016 Remi Collet 1:1.10.1-3 +- use file triggers for pecl extensions (un)registration +- define %%pecl_install and %%pecl_uninstall as noop macro + * Thu Feb 04 2016 Fedora Release Engineering - 1:1.10.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild