Hannes Magnusson a écrit :
On Sat, Dec 20, 2008 at 14:40, Laurent Laville <p...@laurent-laville.org> wrote:
Hannes Magnusson a écrit :
Sure, I know package.xml support platform dependent dependencies, but
it cannot be combined with PHP version check.
Yes here I agree with you at 100%. It may be a new request to a future
PEAR_PackageFileManager version.
I'm confused. What does all this have to do with PEAR_PackageFileManager?
The package.xml format simply doesn't support this. Even if there was
such support in that package it would generate invalid package.xml
which we couldn't use anytway.
It should be a feature request to the actual package.xml format.
-Hannes
Hannes,
When I talked about PEAR_PackageFileManager, you should understand that
I talked about PEAR_PackageFileManager2 (PFM) that is the version that
handle the package xml v2.0
Previous version handle only package xml v1.0
I don't know if you use it to prepare a new release of PhD or if you do
it by hand. Myself I prefer to use PFM.
I have take a little time to refresh my knowledge about PFM, and I
will propose a solution to catch the conditionnal installation of a
package under Windows.
But as I've a doubt , I've CC Greg Beaver to see with him if its
correct. After all PFM is the baby of Greg !
On current version 0.4.2. of PhD you have
<dependencies>
<required>
<php>
<min>5.2.3</min>
</php>
<pearinstaller>
<min>1.4.0</min>
</pearinstaller>
<extension>
<name>libxml</name>
</extension>
<extension>
<name>xmlreader</name>
</extension>
<extension>
<name>dom</name>
</extension>
</required>
....
And I propose to add the package Console_CommandLine , to all other
platform that the one specified ==> install only on Windows
$p2->addOsDep('unix', true);
http://pear.laurent-laville.org/PEAR_PackageFileManager/docs/TDG/en/re13.html#guide.developers.package2.dependencies.os
That give this result :
<dependencies>
<required>
<php>
<min>5.2.3</min>
</php>
<pearinstaller>
<min>1.4.0</min>
</pearinstaller>
<package>
<name>Console_CommandLine</name>
<channel>pear.php.net</channel>
<min>1.0.5</min>
</package>
<extension>
<name>libxml</name>
</extension>
<extension>
<name>xmlreader</name>
</extension>
<extension>
<name>dom</name>
</extension>
<os>
<name>unix</name>
<conflicts />
</os>
</required>
Personally, to provide such result I've used this script
<?php
require_once 'PEAR/PackageFileManager2.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$packagefile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'package.xml';
$options = array('filelistgenerator' => 'file',
'packagefile' => 'package.xml',
'baseinstalldir' => 'phd',
'simpleoutput' => false,
'clearcontents' => false,
'changelogoldtonew' => false,
'ignore' => array(__FILE__)
);
$p2 = &PEAR_PackageFileManager2::importOptions($packagefile, $options);
$p2->setPackageType('php');
$p2->generateContents();
$p2->addRelease();
$p2->addPackageDepWithChannel('required', 'Console_CommandLine',
'pear.php.net', '1.0.5');
$p2->addOsDep('unix', true);
$p2->setReleaseVersion('0.4.3');
$p2->setAPIVersion('0.4.0');
$p2->setReleaseStability('beta');
$p2->setAPIStability('beta');
$p2->setNotes('blah blah');
if (isset($_GET['make']) ||
(isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) {
$p2->writePackageFile();
} else {
$p2->debugPackageFile();
}
?>
Warning; there is a bug in PFM when using importOptions with
<phprelease> tag and <installconditions>
While all others tags are reused/imported, installconditions are simple
dropped.
Laurent
PS: I will be away in next hour; I'll reply if necessary when I come
back tomorrow