PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » PEAR » PEAR » Bug #5959

patch: pear makerpm produces RPMs that do not uninstall/upgrade cleanly

Details

Submitted2005-11-14 14:25 UTC
Frombugs at timj dot co dot uk
Assignedcellog
StatusClosed
PackagePEAR
PHP Version5.0.4
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2005-11-14 14:25 UTC] bugs at timj dot co dot uk

Description:
------------
$ pear -V
PEAR Version: 1.4.4
PHP Version: 5.0.4
Zend Engine Version: 2.0.4-dev

After building packages made with "pear makerpm", the installed package can neither be upgraded nor erased cleanly.

This is not the same as bug #4354.

Test script:
---------------
Examples done using HTTP 1.3.5/1.3.6

Example 1: Erasing

# rpm -i PEAR\:\:HTTP-1.3.5-1.noarch.rpm
# rpm -e PEAR::HTTP

Example 2: Upgrading
# rpm -i PEAR\:\:HTTP-1.3.5-1.noarch.rpm
# rpm -U PEAR\:\:HTTP-1.3.6-1.noarch.rpm

Patch:
# diff -u template.spec.orig template.spec
--- template.spec.orig
+++ template.spec
@@ -31,11 +31,18 @@
echo BuildRoot=%{buildroot}

%postun
-pear uninstall --nodeps -r @possible_channel@@package@
-rm @rpm_xml_dir@/@package@.xml
+# if refcount = 0 then package has been removed (not upgraded)
+if [ "$1" -eq "0" ]; then
+ pear uninstall --nodeps -r @possible_channel@@package@
+fi

%post
-pear install --nodeps -r @rpm_xml_dir@/@package@.xml
+# if refcount = 2 then package has been upgraded
+if [ "$1" -ge "2" ]; then
+ pear upgrade --nodeps -r @rpm_xml_dir@/@package@.xml
+else
+ pear install --nodeps -r @rpm_xml_dir@/@package@.xml
+fi

%install
pear -c %{buildroot}/pearrc install --nodeps -R %{buildroot} \

Expected result:
----------------
(this is the result after applying above patch)

Example 1 output:
[install]
install ok: channel://pear.php.net/HTTP-1.3.5
[uninstall]
uninstall ok: channel://pear.php.net/HTTP-1.3.5

Example 2 output:

[install]
install ok: channel://pear.php.net/HTTP-1.3.5
[upgrade]
upgrade ok: channel://pear.php.net/HTTP-1.3.6

Actual result:
--------------
Example 1 output:
[install]
install ok: channel://pear.php.net/HTTP-1.3.5
[uninstall]
pear/HTTP not installed
rm: cannot remove `/var/lib/pear/HTTP.xml': No such file or directory
error: %postun(PEAR::HTTP-1.3.5-1.noarch) scriptlet failed, exit status 1

Example 2 output:
[install]
install ok: channel://pear.php.net/HTTP-1.3.5
[upgrade]
Skipping package "pear/HTTP", already installed as version 1.3.5
No valid packages found
install failed
error: %post(PEAR::HTTP-1.3.6-1.noarch) scriptlet failed, exit status 1