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

Mathieu Parent math.parent at gmail.com
Thu Jun 23 20:49:32 UTC 2011


Hi,

I have fixed some of the problems and pushed to git.debian.org. Some
are still present:

2011/6/17 Gunnar Wrobel <wrobel at horde.org>:
> $ /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.
>
This problem should probably be solved in the helper itself. Don't
know exactly how yet (check for package.xml in every subdirs?).


2011/6/20 Gunnar Wrobel <wrobel at horde.org>:
> Hi Mathieu,
>
> my second sweep of the Horde 4 packages should install now:

(...)
> 2) Installation via
>
> apt-get install pear-horde-channel php-horde-role php-horde-webmail

Why is pear-horde-channel still needed (I have disabled validation) ?
This package will go away with horde3.

>
> 3) Set PEAR configuration via
>
> pear config-set horde_dir /usr/share/horde4

This should probably go in php-horde-role postinst.

> 4) Initial Horde configuration setup:
>
> webmail-install


>
> There are still some obvious (...)
>  - "http://files.pardus.de/horde4-debian-20110617" should be

>  - The dependencies "pear-horde-channel" and "php-horde-role" still need to
> be added to the horde packages as required.

Shouldn't this be done on the pear side?

>  - "pear config-set horde_dir /usr/share/horde4" needs to happen
> automatically with the installation of the php-horde-role package

yes, see above (=This should probably go in php-horde-role postinst).

>  - "webmail-install" might be executed automatically after installation of
> php-horde-webmail

Is this script always run just after the installation, or can we
change config (like use another database backend) and then run it?


>  - A default apache configuration should be delivered.
Yes.

>  - The package dependencies need to be checked again.
>
> In addition to what I reported in my last mail concerning pkg-php-tools
> there are also some problems with dependencies. One thing I noticed are
> dependencies on PHP extensions. If a PEAR package requires a PHP extension
> that is already provided by the base Debian PHP package it cannot be added
> as an additional dependency. I think it makes sense to add this knowledge to
> phppkginfo. I used this code section for "extension" deps:
>
> case "extension":
>  if (!in_array($infos["name"], array('ctype', 'dom', 'filter', 'hash',
> 'gettext', 'openssl', 'SimpleXML', 'xml'))) {
>    $package = "php5-".$infos["name"];
>  }
>  break;

I have done this with an extended list.

> The second issue I hit are the naming of package dependencies. The current
> code in "phppkginfo" assumes for dependencies of type "package" that the
> Debian package name is
>
> "php-".strtr(strtolower($infos["name"]), '_', '-');
>
> So "Horde_Date" will be mapped to "php-horde-date" which is fine. The
> "horde" PEAR package available on pear.horde.org will be "php-horde" which
> may still be okay, but I'm not so certain that mapping the "imp" package
> from pear.horde.org to "php-imp" is really what we want to do. So far I
> hacked the code so that the applications are mapped using
>
> "php-horde-".strtr(strtolower($infos["name"]), '_', '-');
>
> The Horde project did prefix the framework packages with "Horde_" because
> there was no way to avoid namespace clashes given the functionality of the
> current PEAR installer. With PEAR2 this might be different but that is not
> yet available. It was necessary to ensure that the files from "Horde_Db" did
> not clash with the "Db" package from PEAR and vice versa. Initially we did
> want to drop the "Horde_" prefix but dropped that idea at some point. But
> there are also other project that do not use such a prefix. At the moment
> the use of PEAR packaging seems to increase so I could imagine that there
> would be name conflicts at some point as long as the channel name plays no
> role in the Debian package name.
>
> At the moment I'd be tempted to use the following rule:
>
> The Debian package name is "php-" + the short name of the channel (e.g.
> "horde" or "phpunit") unless that one is pear.php.net + name of the package
> in lowercase and "_" replaced by "-" BUT with a prefix replaced if it
> matches the channel short name (e.g. "-date" instead of "-horde-date"). Does
> that make sense?

Good idea. but what is "the short name of the channel", how is it
constructed from the url?

Here is a proposal, but is it sufficient?
(NB: my coding is bad, feel free to rewrite)


<?php
$url = "pear.horde.org";
$package = "horde-kolab-format";

// split channel url by dots:
$urlc = explode(".", $url);
// split package name by hyphens
$packagec = explode("-", $package);
// drop last part of url:
array_pop($urlc);
// drop first part of url if equal to pear
if (isset($urlc[0]) && ($urlc[0] == "pear")) {
	array_shift($urlc);
}
// drop first part of url if equal to php
if (isset($urlc[0]) && ($urlc[0] == "php")) {
	array_shift($urlc);
}
// drop first part of package if equal to last part of url (should be
done several times?)
if (end($urlc) == $packagec[0]) {
	array_shift($packagec);
}
//merge the result
$result = implode('-', array_merge($urlc, $packagec));

echo $result;

?>



> Of course one could also avoid the automatic dependency conversion and do it
> manually in case it fails but I'd like to have a method that works in most
> cases. Of course fixing the package names might not be that easy for Debian.
>
>
> Quoting Mathieu Parent <math.parent at gmail.com>:
>
>>> I generated a first set of Horde4 packages here:
>>>
>>> http://files.pardus.de/horde4-debian-20110607/
>>
>> Great! Can you also provide the sources?
>
> I realized in my second oackaging run, that I indeed need to do that as
> there are packages now that need some special treatment and cannot be
> immediately autogenerated (about 95% of them are however). So I would like
> to find a decent way that does not involve massive amounts of manual work to
> make the sources available. Any suggestions?
>
> And sorry if there are any gaps. I'm trying to do too many things at the
> same time after loosing last week ;)

Don't be sorry. Being busy is better than being bored ;-)

-- 
Mathieu



More information about the pkg-php-pear mailing list