[pkg-php-pear] [Pkg-php-pear] On PEAR packaging

Gunnar Wrobel wrobel at horde.org
Fri Jun 17 15:40:32 UTC 2011


Hi Mathieu,

finally got back to this though I wanted to have this done so much  
earlier. Ah, well...

Quoting Mathieu Parent <math.parent at gmail.com>:

>> Hi Mathieu,
>>
>> > Comments, suggestions, feedback ... ?
>>
>> Works! ;)
>
> Good.
>
>>
>> At least to a large extent. Thanks for providing the build helper.
>>
>> I generated a first set of Horde4 packages here:
>>
>> http://files.pardus.de/horde4-debian-20110607/
>
> Great! Can you also provide the sources?

Yes, I can. What is the best format for that though? I'm also not 100%  
certain it makes a lot of sense to provide the sources in this case as  
I autogenerate these.

The command line on my side looks like this:

php -c php.ini horde/components/bin/horde-components Horde_Role  
distribute --allow-remote -t horde/components/data/distribute/debian/  
-D tmp/distribute-test

This calls the "components/bin/horde-components" script and instructs  
it to build a distributable ("distribute") package for "Horde_Role".  
The templates used for the process are in  
"components/data/distribute/debian/" and the output goes to  
"tmp/distribute-test". The "--allow-remote" switch allows the first  
argument to be the name of a package on pear.horde.org rather than a  
path to a local source checkout from the git repo.

Does it make sense to provide sources even if those are automatically  
generated?

>
>> These are not yet complete and installable. This is currently just a
>> smoke test for the build machinery but it should evolve into something
>> installable rather soon.
>>
>> Feedback from this first build run:
>>
>>   - I had a problem with the "download_dir" not being writeable and
>> added '"-d", "download_dir=/tmp",' in the phppear.pm file. I still
>> need to check why this happened.
>
> What is the content of your /etc/pear/pear.conf file?

... s:12:"download_dir";s:44:"/build/buildd/php5-5.3.2/pear-build-download"...

and the package building fails with

Warning: Invalid argument supplied for foreach() in  
PEAR/Downloader/Package.php on line 168
PHP Warning:  Invalid argument supplied for foreach() in  
/usr/share/php/PEAR/Downloader/Package.php on line 168
PHP Stack trace:
PHP   1. {main}() /usr/share/php/pearcmd.php:0
PHP   2. PEAR_Command_Common->run() /usr/share/php/pearcmd.php:305
PHP   3. PEAR_Command_Install->doInstall()  
/usr/share/php/PEAR/Command/Common.php:271
PHP   4. PEAR_Downloader->download()  
/usr/share/php/PEAR/Command/Install.php:661
PHP   5. PEAR_Downloader_Package->initialize()  
/usr/share/php/PEAR/Downloader.php:278
download directory "/build/buildd/php5-5.3.2/pear-build-download" is  
not writeable.  Change download_dir config variable to a writeable dir
Cannot download non-local package "./Horde_Role-1.0.0/package.xml"
install failed

> I thought that the download_dir was not used (because the tarball is  
> already here).

A reasonable assumption - don't get me started on PEAR code :)

Even for packages already downloaded the PEAR installer will call  
PEAR_Downloader_Package->download() for each of them. When entering  
that function the code will exit early noticing that the package is  
already local. Nevertheless PEAR_Downloader_Package->initialize() will  
be called before that and that is where the download directory is  
checked for write permissions. And this is what fails here.

So it would be sufficient to create a dummy download directory during  
the build, specify it as download_dir, and remove it after the  
installation call.

For now I used the debian/pearrc file to set the download_dir which  
also works but I guess shouldn't be necessary.

>
>>   - Horde_Role: This package failed to build as '$pf =
>> $pkg->fromAnyFile($packagefilename, PEAR_VALIDATE_NORMAL);' failed in
>> phppkginfo. I believe '$pf = $pkg->fromAnyFile($packagefilename,
>> PEAR_VALIDATE_DOWNLOADING);' is sufficient and fixed the problem here.
>
> Perhaps "0" is event better. Can you try the following command from  
> the unzipped source (with PEAR_VALIDATE_NORMAL) :
>  /usr/share/pkg-php-tools/scripts/phppkginfo -d . package
>
> The -d should print any error message.

$ /usr/share/pkg-php-tools/scripts/phppkginfo -d . package
[pear_error: message="Parsing of package.xml from file  
"/home/wrobel/environment/horde-glue/tmp/distribute-test/php-horde-role-1.0.0/package.xml" failed" code=2 mode=return level=notice prefix=""  
info="Array"]

The real error looks like this:

   ["message"]=>
   string(130) "Parsing of package.xml from file  
"/home/wrobel/environment/horde-glue/tmp/distribute-test/php-horde-role-1.0.0/package.xml"  
failed"
   ["userinfo"]=>
   array(1) {
     [0]=>
     array(7) {
       ["code"]=>
       string(12) "_invalidTask"
       ["params"]=>
       array(3) {
         ["reason"]=>
         string(75) "Post-install script "Horde/Role.php" could not be  
retrieved for processing!"
         ["task"]=>
         string(23) "tasks:postinstallscript"
         ["file"]=>
         string(14) "Horde/Role.php"
       }
       ["package"]=>
       string(19) "PEAR_PackageFile_v2"

The problem is that the package.xml resides outside of the  
Horde_Role-1.0.0 directory (php-horde-role-1.0.0/package.xml). When  
running "/usr/share/pkg-php-tools/scripts/phppkginfo -d . package"  
within "php-horde-role-1.0.0/Horde_Role-1.0.0" it works fine. But that  
seems to be option in the build helper as you need the phppkginfo data  
to build the "Horde_Role-1.0.0" directory path.

> Perhaps "0" is event better.

Yup, works as well. I would say this is a decent solution then as I  
see no reason why validation would be of any help here. The  
package.xml is most likely revalidated during the install procedure  
anyway (though I didn't check that now).

>
>>   - Files in "horde_dir": The purpose of Horde_Role is to add a new
>> PEAR configuration variable "horde_dir". This one specifies the target
>> location for files that need to be served by the web server. For now I
>> hacked this by adding '"-d", "horde_dir=/usr/share/horde4",' in the
>> phppear.pm file. Definitely not the way to solve the underlying
>> problem and I assume the way how this might work on Debian still needs
>> discussion.
>
> Yes, this should probably be set on php-horde-role installation. And  
> Horde apps should builddep on it.

The build dependency is no problem. And setting "horde_dir" in  
debian/pearrc works fine.

I didn't really grasp debian/pearrc last time but understood its  
purpose now. What was the specific reason you marked this as TODO? Not  
having this file turned out to be no problem for me.


One thing I forgot last time:

--- lib/perl/Debian/Debhelper/Buildsystem/phppear.pm	2011-06-06  
11:35:52.000000000 +0200
+++  
/usr/share/perl5/Debian/Debhelper/Buildsystem/phppear.pm	2011-06-17  
17:31:46.000000000 +0200
@@ -97,6 +97,7 @@
  	$this->doit_in_sourcedir("rm", "-f",  
$destdir."/usr/share/doc/".$this->_get_mainpackage()."/".$this->{phppkginfo_package}."/COPYING");

  	# add package.xml
+	$this->doit_in_sourcedir("mkdir", "-p",  
$destdir."/usr/share/doc/".$this->_get_mainpackage());
  	$this->doit_in_sourcedir("cp", "package.xml",  
$destdir."/usr/share/doc/".$this->_get_mainpackage());
  }

For some packages this target directory was missing. Does this make  
sense or should I investigate the error source further? I don't  
remember which packages showed this particular problem.

>
>> What is required to get this process moving along? So far both
>> pkg-php-pear and pkg-horde-hackers have been very, very quiet.
>
> Sadly, yes. Let's assume there are no objection. I'm preparing a  
> release of pkg-php-tools. I will upload it to Debian once your  
> remarks have been solved.

Great.

Cheers,

Gunnar

>
>> Cheers,
>>
>> Gunnar
>>
>
> Cheers
>
> Mathieu

-- 
Core Developer
The Horde Project

e: wrobel at horde.org
t: +49 700 6245 0000
w: http://www.horde.org

pgp: 9703 43BE
tweets: http://twitter.com/pardus_de
blog: http://log.pardus.de




More information about the pkg-php-pear mailing list