Re: going away present
| From: | Greg Beaver | Date: | Sun, 03 Oct 2004 18:11:32 +0000 |
| Subject: | Re: going away present | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-33630@lists.php.net to get a copy of this message | ||
Daniel Convissor wrote:
Hi Greg, et al: On Sat, Oct 02, 2004 at 02:08:49AM -0400, Greg Beaver wrote:<tasks:replace from="@version@" to="version" type="package-info"/>One feature of the new system that would be very helpful is to have the ability to do some replacements at packaging time instead of install time. For example, the version number. all package-info replacements can be done at package-time, this can be implemented, methinks, with a package-time check on whether the task can be executed.
This provides two benefits. First, people who just decompress/untar a package file will have the correct information in it. Second, the validation hashes, which are computed at package time, can be performed after the replacement, so the validation hashes will provide useful information -- as opposed to the current situation where the hash is always incorrect due to replacements having happened after the hash was generated. This still won't work for php-const and pear-config replacements, which will vary from machine to machine. The solution, if you would like a package that uses these replacements to work just being unzipped, is to put them all in a single file.<?php if ('@data-dir@' == '@' . 'data-dir@') {
$GLOBALS['_PACKAGENAME_DATADIR'] = '@data-dir@' . DIRECTORY_SEPARATOR .
'Packagename' . DIRECTORY_SEPARATOR . 'data';
} else {
$GLOBALS['_PACKAGENAME_DATADIR'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'data';} ?> Then, use $GLOBALS['_PACKAGENAME_DATADIR'] instead of a replacement.
These benefits will be magnified if/when we accept the new Header Comment Block RFC, which asks all packages to have a version number replacement in each class' docblock. --Dan PS: And if the version number replacements were automatic instead of having to be manually declared for each file via package.xml, life would be VERY good.We can't do this for package.xml 1.0 without some serious side effects, but it would be simple to do it for package.xml 2.0, as people have to change a lot of things anyways (required deps are installed by default with package.xml 2.0, for instance) Greg P.S. have a good week all.