summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-02-25 13:43:45 +0100
committerRemi Collet <fedora@famillecollet.com>2016-02-25 13:43:45 +0100
commitdf1b0128614e8cfd80160df5672f7be852c2c215 (patch)
tree965872d5e033e36b253f6a85dfb6a970d7c91e0f
parent538ebdd991c0012fa85acdc2883d997e059f45be (diff)
php-pear: file triggers (F24+)
-rw-r--r--macros-f24.pear36
-rw-r--r--php-pear.spec42
2 files changed, 77 insertions, 1 deletions
diff --git a/macros-f24.pear b/macros-f24.pear
new file mode 100644
index 0000000..75143d2
--- /dev/null
+++ b/macros-f24.pear
@@ -0,0 +1,36 @@
+#
+# Define full path to pear/pecl commands to be used in scriptlets:
+#
+%@SCL@__pear @BINDIR@/pear
+%@SCL@__pecl @BINDIR@/pecl
+
+#
+# Define PEAR directories used in php-pear-* spec files
+#
+%pear_phpdir %(%{__pear} config-get php_dir 2> /dev/null || echo @PREFIX@/share/pear)
+%pear_docdir %(%{__pear} config-get doc_dir 2> /dev/null || echo @PREFIX@/share/doc/pear)
+%pear_testdir %(%{__pear} config-get test_dir 2> /dev/null || echo @PREFIX@/share/tests/pear)
+%pear_datadir %(%{__pear} config-get data_dir 2> /dev/null || echo @PREFIX@/share/pear-data)
+%pear_cfgdir %(%{__pear} config-get cfg_dir 2> /dev/null || echo @ETCDIR@/pear)
+%pear_wwwdir %(%{__pear} config-get www_dir 2> /dev/null || echo @VARDIR@/www/html)
+%@SCL@pear_metadir %(%{__pear} config-get metadata_dir 2> /dev/null || echo @VARDIR@/lib/pear)
+
+#
+# Define PECL directories used in php-pecl-* spec files:
+#
+%pecl_phpdir %(%{__pecl} config-get php_dir 2> /dev/null || echo @PREFIX@/share/pear)
+%pecl_docdir %(%{__pecl} config-get doc_dir 2> /dev/null || echo @PREFIX@/share/doc/pecl)
+%pecl_testdir %(%{__pecl} config-get test_dir 2> /dev/null || echo @PREFIX@/share/tests/pecl)
+%pecl_datadir %(%{__pecl} config-get data_dir 2> /dev/null || echo @PREFIX@/share/pear-data)
+
+#
+# Define XML directories to store PEAR package registration information:
+# pecl_xmldir is now defined in macros.php (from php-devel)
+#
+%@SCL@pear_xmldir @VARDIR@/lib/pear/pkgxml
+
+#
+# Define noop macros for old scriplets used in php-pecl-* spec files:
+#
+%pecl_install :
+%pecl_uninstall :
diff --git a/php-pear.spec b/php-pear.spec
index 9af4239..96c04a6 100644
--- a/php-pear.spec
+++ b/php-pear.spec
@@ -30,12 +30,14 @@
%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_root_sysconfdir}/rpm; echo $d)
+%{!?pecl_xmldir: %global pecl_xmldir %{_sharedstatedir}/php/peclxml}
+
#global pearprever dev3
Summary: PHP Extension and Application Repository framework
Name: %{?scl_prefix}php-pear
Version: 1.10.1
-Release: 1%{?dist}
+Release: 3%{?dist}
Epoch: 1
# PEAR, PEAR_Manpages, Archive_Tar, XML_Util, Console_Getopt are BSD
# Structures_Graph is LGPLv3+
@@ -50,6 +52,7 @@ Source10: pear.sh
Source11: pecl.sh
Source12: peardev.sh
Source13: macros.pear
+Source14: macros-f24.pear
Source21: http://pear.php.net/get/Archive_Tar-%{arctarver}.tgz
Source22: http://pear.php.net/get/Console_Getopt-%{getoptver}.tgz
Source23: http://pear.php.net/get/Structures_Graph-%{structver}.tgz
@@ -62,6 +65,8 @@ BuildRequires: %{?scl_prefix}php(language) > 5.4
BuildRequires: %{?scl_prefix}php-cli
BuildRequires: %{?scl_prefix}php-xml
BuildRequires: gnupg
+# For pecl_xmldir macro
+BuildRequires: php-devel
%if %{with_tests}
BuildRequires: %{_bindir}/phpunit
%endif
@@ -155,7 +160,11 @@ sed -e 's/@SCL@/%{?scl:%{scl}_}/' \
-e 's:@BINDIR@:%{_bindir}:' \
-e 's:@ETCDIR@:%{_sysconfdir}:' \
-e 's:@PREFIX@:%{_prefix}:' \
+%if 0%{?fedora} >= 24
+ %{SOURCE14} | tee macros.pear
+%else
%{SOURCE13} | tee macros.pear
+%endif
%build
@@ -282,6 +291,33 @@ echo 'Test suite disabled (missing "--with tests" option)'
%endif
+%if 0%{?fedora} >= 24
+## 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
+%endif
+
+
%clean
rm -rf $RPM_BUILD_ROOT
rm new-pear.conf
@@ -380,6 +416,10 @@ fi
%changelog
+* Wed Feb 10 2016 Remi Collet <remi@fedoraproject.org> 1:1.10.1-3
+- use file triggers for pecl extensions (un)registration
+- define %%pecl_install and %%pecl_uninstall as noop macro
+
* Sat Oct 17 2015 Remi Collet <remi@fedoraproject.org> 1:1.10.1-1
- update PEAR to 1.10.1