Re: PEAR Installer, package.xml, baseinstalldir for doc, test, data
| From: | Greg Beaver | Date: | Mon, 21 Feb 2005 16:36:53 +0000 |
| Subject: | Re: PEAR Installer, package.xml, baseinstalldir for doc, test, data | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-36290@lists.php.net to get a copy of this message | ||
Manuel Holtgrewe wrote:
Hi I am experimenting with the pear package installer and it seems that is has come a long way since I last had a look at it - congratulations. I'm one of the binarycloud [1] developers and we would like to use the pear package manager for the distribution infrastructure. However, there is a problem that I have found with the PEAR Installer: I'd like to be able to set the "baseinstalldir" attribute for files and directories of data, doc and test roles and have this evaluated by the PEAR installer. This does not work currently - the baseinstalldir attribute is not interpreted and even "unset()" by the PEAR Installer (see PEAR_Installer, lines 184ff). I could contribute a patch so that the baseinstalldir is evaluated here and even make it depending on a configuration value if you are interested in this. I really need this feature.What problem are you trying to solve by using baseinstalldir? Are you trying to affect the installation location of existing PEAR packages, or set the baseinstalldir attribute via package.xml? If the location that data, doc and test files are installed is not OK, the best way to change this is to specify a different location using configuration values on install-time. However, if this does not satisfy the conditions you have, because binarycloud needs special handling, the next-best solution is in PEAR 1.4.0 (coming this week), with custom installer roles. This feature is not yet documented except in the code, but if you would like to get an idea of how this works, take a look at PEAR_Installer::_installFile2(), and the contents of PEAR/Installer/Role in HEAD of pear-core CVS. Basically, you would copy PEAR/Installer/Role/Data.php to something like PEAR/Installer/Role/Phingdata.php and change the code to something like: <?php require_once 'PEAR/Installer/Role/Data.php'; class PEAR_Installer_Role_Phingdata extends PEAR_Installer_Role_Data {
var $_setup =
array(
'releasetypes' => array('php', 'extsrc', 'extbin'),
'installable' => true,
'locationconfig' => 'data_dir',
'honorsbaseinstall' => true,
'phpfile' => false,
'executable' => false,
'phpextension' => false,
);
function getInfo()
{
return array(
'releasetypes' => array('php', 'extsrc', 'extbin'),
'installable' => true,
'locationconfig' => 'data_dir',
'honorsbaseinstall' => true,
'phpfile' => false,
'executable' => false,
'phpextension' => false,
);
}
}
Then, use this role in your files:
<file role="phingdata" baseinstalldir="blah" name="blah.dta" />
Note that you would want to release the Phingdata role as a package that can be installed by your users, and it would need to be installed prior to attempting to install the package that uses the phingdata role, because otherwise validation will complain that phingdata is an unknown role.
Greg