php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24166 pear makerpm is broken
Submitted: 2003-06-13 02:11 UTC Modified: 2003-06-16 12:59 UTC
From: jmcastagnetto@php.net Assigned: cox (profile)
Status: Closed Package: PEAR related
PHP Version: 4.3.2 OS: Suse Linux 8.2
Private report: No CVE-ID: None
 [2003-06-13 02:11 UTC] jmcastagnetto@php.net
Description:
------------
As a test, I tried to generat a spec file for building an  
rpm. I used one of my released packages (Math_TrigOp) for  
this test.  
  
When I tried using 'pear makerpm', I got an error:  
  
$ pear makerpm ../SOURCES/Math_TrigOp-1.0.tgz  
no package.xml found in ../SOURCES/Math_TrigOp-1.0.tgz  
  
To confirm the existence of a package.xml in the tarball:  
  
$ tar ztvf ../SOURCES/Math_TrigOp-1.0.tgz  
-rw-r--r-- 500/100        1489 2003-06-12 23:35:37  
package.xml  
-rw-r--r-- 500/100        5555 2003-01-04 03:55:40  
Math_TrigOp-1.0/TrigOp.php  
  
Problem might be in Archive_Tar, as PEAR_Command_Package  
seems OK on a cursory look of the code.  
  
For reference: 
 
$ pear list-all | grep Archive 
Archive_Tar              1.1        1.1 
 
$ pear list-all | grep PEAR | grep -v Info 
PEAR                     1.1        1.1 
PEAR_Frontend_Gtk        0.3        0.3 
PEAR_Frontend_Web        0.3        0.3 
 
Which are the latest releases of the packages used by the 
pear package manager for this command. 
 

Reproduce code:
---------------
If you do not have a checkout of pear locally, then do first:

$ cvs co pear/Math_TrigOp

Then:

$ cd pear/Math_TrigOp
$ mkdir SPECS SOURCES
$ pear package
$ mv Math_TrigOp-1.0.tgz SOURCES
$ cd SPECS
$ pear makerpm ../SOURCES/Math_TrigOp-1.0.tgz

Expected result:
----------------
Obtain a valid spec file, of course ;-) 

Actual result:
--------------
An error message an no spec file. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-13 04:09 UTC] cox@php.net
Fixed in CVS, Jesus.
 [2003-06-13 18:37 UTC] jmcastagnetto@php.net
What file was changed? I do not see any commits to pear/Archive_Tar or the php4/pear/PEAR/?

I am asking because I would like to test this functionality ;-)
 [2003-06-14 11:58 UTC] cox@php.net
Oops, there was a conflict with my patch that I overpassed, it's commited now. The affected file is php4/pear/PEAR/Command/Package.php

Thanks again :-)
 [2003-06-15 01:10 UTC] jmcastagnetto@php.net
The patch did not work. The one below does: 
 
--- Package.php-orig    2003-06-14 18:27:24.000000000 
-0700 
+++ Package.php 2003-06-14 18:26:37.000000000 -0700 
@@ -585,7 +585,7 @@ 
         $pkgdir = "$info[package]-$info[version]"; 
         $info['rpm_xml_dir'] = '/var/lib/pear'; 
         $this->config->set('verbose', $tmp); 
-        if (!$tar->extractList("$pkgdir/package.xml", 
$instroot, $pkgdir)) { 
+        if (!$tar->extractList("package.xml", $instroot)) 
{ 
             return $this->raiseError("failed to extract 
$params[0]"); 
         } 
         if (!file_exists("$instroot/package.xml")) { 
 
Also, the spec file might need some more work. The files 
end up being installed on a place highly dependent on the 
config of the person generating the RPM, 
 
For example. I have PHP installed in '/home/server/php', 
but most people have it in '/usr/local'. 
 
The postinstall part does not seem to be working. No 
matter what the local config is (tried on a machine where 
PHP is installed in /usr/local), and the RPM still tried 
to install it in '/home/server/php'. That is not the 
correct behaviour. 
 
Re-openning as this command still generates something the 
is (albeit indirectly) broken. 
 
I think that the '@doc_dir@' and '@files@' vars in the 
'template.spec' might need to be reworked to generate a 
good non-pacakager-system dependent RPM. 
 
 [2003-06-15 11:32 UTC] cox@php.net
Sorry, I commited a wrong version of my original patch, was a casuality to have a package.xml in my current dir, that's why it worked for me :-/

Btw, I've made a new file list, using the RPM vars. I haven't built rpms since many time, perhaps it's not correct. Could you test it?

Thanks!
 [2003-06-15 23:41 UTC] cox@php.net
I'll change the way to unpack/install files. Let me some time to test it better.
 [2003-06-16 00:19 UTC] jmcastagnetto@php.net
The latest patches generate a spec file, but there is a 
problem with the building. My local config points to 
/home/server/php as the root for PHP installation, which 
is messing up the asumed /usr/local/ (see below). 
 
Perhaps we should use the 'Prefix:' tag in the RPM spec to 
allow for relocatable RPMs? 
 
I agree that if would be best to let 'pear' to figure out 
the appropriate places, and use the RPM as a delivery 
format to put the stuff in a temp place that 'pear' can 
use. 
 
My experience w/ RPM is limited. Found some good info at: 
 
http://www.rpm.org/max-rpm/index.html 
 
Example of error while creating the rpm: 
 
$ rpm -bb PEAR\:\:Math_TrigOp-1.0.spec 
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.64345 
+ umask 022 
+ cd /usr/src/packages/BUILD 
+ cd /usr/src/packages/BUILD 
+ /bin/gzip -dc 
/usr/src/packages/SOURCES/Math_TrigOp-1.0.tgz 
+ tar -xf - 
+ STATUS=0 
+ '[' 0 -ne 0 ']' 
+ cd Math_TrigOp-1.0 
++ /usr/bin/id -u 
+ '[' 500 = 0 ']' 
++ /usr/bin/id -u 
+ '[' 500 = 0 ']' 
+ /bin/chmod -Rf a+rX,g-w,o-w . 
+ mv ../package.xml . 
+ exit 0 
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.64345 
+ umask 022 
+ cd /usr/src/packages/BUILD 
+ cd Math_TrigOp-1.0 
+ echo BuildRoot=/var/tmp/PEAR::Math_TrigOp-root 
BuildRoot=/var/tmp/PEAR::Math_TrigOp-root 
+ exit 0 
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.64345 
+ umask 022 
+ cd /usr/src/packages/BUILD 
+ cd Math_TrigOp-1.0 
+ rm -rf /var/tmp/PEAR::Math_TrigOp-root/home 
/var/tmp/PEAR::Math_TrigOp-root/var 
+ pear -q install -R /var/tmp/PEAR::Math_TrigOp-root -n 
package.xml 
+ mkdir -p /var/tmp/PEAR::Math_TrigOp-root/var/lib/pear 
+ cp -p package.xml 
/var/tmp/PEAR::Math_TrigOp-root/var/lib/pear/Math_TrigOp.xml 
+ RPM_BUILD_ROOT=/var/tmp/PEAR::Math_TrigOp-root 
+ export RPM_BUILD_ROOT 
+ test -x /usr/sbin/Check -a 500 = 0 -o -x /usr/sbin/Check 
-a '!' -z /var/tmp/PEAR::Math_TrigOp-root 
+ echo 'I call /usr/sbin/Check...' 
I call /usr/sbin/Check... 
+ /usr/sbin/Check 
+ /usr/lib/rpm/brp-compress 
Processing files: PEAR::Math_TrigOp-1.0-1 
File not found: 
/var/tmp/PEAR::Math_TrigOp-root/usr/lib/php/pear/TrigOp.php 
PreReq: /bin/sh 
 
 [2003-06-16 03:31 UTC] cox@php.net
Finally read some Maximum RPM, and commited a patch. You'll need to cvs update php4/pear/PEAR/Installer.php and php4/pear/template.spec.

Please test it. Thanks.
 [2003-06-16 10:19 UTC] jmcastagnetto@php.net
The spec looks better, but I still get errors: 
 
$ pear makerpm ../SOURCES/Math_TrigOp-1.0.tgz 
Wrote RPM spec file PEAR::Math_TrigOp-1.0.spec 
 
$ rpm -bb PEAR\:\:Math_TrigOp-1.0.spec 
... 
Processing files: PEAR::Math_TrigOp-1.0-1 
Finding  Provides: (using /usr/lib/rpm/find-provides)... 
Finding  Requires: (using /usr/lib/rpm/find-requires)... 
PreReq: /bin/sh 
Wrote: 
/usr/src/packages/RPMS/noarch/PEAR::Math_TrigOp-1.0-1.noarch.rpm 
 
So far so good. But it produces when doing the 
installation, even though the class ends up being 
installed in '/usr/lib/php/pear/Math/TrigOp.php' (did not 
use the relocatable option) 
 
$ sudo rpm -ivvh 
/usr/src/packages/RPMS/noarch/PEAR::Math_TrigOp-1.0-1.noarch.rpm 
D: counting packages to install 
D: found 1 packages 
D: looking for packages to download 
D: retrieved 0 packages 
D: New Header signature 
D: Signature size: 68 
D: Signature pad : 4 
D: sigsize         : 72 
D: Header + Archive: 3724 
D: expected size   : 3724 
D: opening database mode 0x42 in /var/lib/rpm 
D: found 0 source and 1 binary packages 
D:  requires: /bin/sh   satisfied by db file lists. 
D: installing binary packages 
D: getting list of mounted filesystems 
D: New Header signature 
D: Signature size: 68 
D: Signature pad : 4 
D: sigsize         : 72 
D: Header + Archive: 3724 
D: expected size   : 3724 
D: package: PEAR::Math_TrigOp-1.0-1 files test = 0 
D:    file: / action: create 
D:    file: /usr action: create 
D:    file: /usr/lib action: create 
D:    file: /usr/lib/php action: create 
D:    file: /usr/lib/php/pear action: create 
D:    file: /usr/lib/php/pear/Math action: create 
D:    file: /usr/lib/php/pear/Math/TrigOp.php action: 
create 
D:    file: /var action: create 
D:    file: /var/lib action: create 
D:    file: /var/lib/pear action: create 
D:    file: /var/lib/pear/Math_TrigOp.xml action: create 
D: running preinstall script (if any) 
PEAR::Math_TrigOp           
#################################################GZDIO:       
2 reads,     8548 total bytes in 0.000 secs 
# 
D: running postinstall scripts (if any) 
+ pear install --nodeps -r /var/lib/pear/Math_TrigOp.xml 
var/tmp/rpm-tmp.47633: line 2: pear: command not found 
execution of PEAR::Math_TrigOp-1.0-1 script failed, exit 
status 127 
 
 
Somehow the 'pear' command is not found, although it is in 
my PATH: 
 
$ which pear 
/usr/local/bin/pear 
 
Is there a fixed set of bin dirs that the rpm uses?  
 
A less problematic option might be to: 
 
- Put the classes in the same tarball structure, including 
the package.xml into a temp dir 
- chdir there 
- pear install package.xml 
 
But then, that would not be better than just using 'pear 
install packagename'. 
 
It is cool that the rpm is generated and puts the stuff on 
a canonical or user defined place, the problem is that it 
does not get registered in the pear registry. That might 
not be that bad, for people that depend on RPMs only. 
 
 [2003-06-16 12:59 UTC] cox@php.net
AFAIS it uses: /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin, but it's supposed that you installed the pear cmd from a RPM too, so the pear cmd will get installed under %{_bindir}.

For the registry problem you mention, see the %post macro:
pear install --nodeps -r /var/lib/pear/Math_TrigOp.xml

This macro it's executed after rpm -i, and does register the package in the pear registry (-r means register only).

Let me know further issues with the command, for the moment I'll close this bug.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 23:01:34 2024 UTC