Bug #16406 [Com]: addReplacement does not look for files in packagedirectory
| From: | tonybibbs | Date: | Fri, 29 Oct 2010 18:02:33 +0000 |
| Subject: | Bug #16406 [Com]: addReplacement does not look for files in packagedirectory | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-5005@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=16406&edit=1
ID: 16406
Comment by: tonybibbs
Reported By: tony at tonybibbs dot com
Summary: addReplacement does not look for files in
packagedirectory
Status: Verified
Type: Bug
Package: PEAR_PackageFileManager2
Operating System: Linux
Package Version: 1.0.0
PHP Version: 5.2.5
New Comment:
Same exact problem MacOSX 10.6 PHP 5.3.2 and PEAR 1.9.1.
The patch (supplied over 15 months ago) works.
Previous Comments:
------------------------------------------------------------------------
[2010-02-03 23:23:35] cweiske
<div id="changeset">
<span class="removed">-Status: Open</span>
<span class="added">+Status: Verified</span>
</div>
------------------------------------------------------------------------
[2009-10-10 13:09:02] sunejensen
Are you going to implement this patch?
------------------------------------------------------------------------
[2009-07-16 09:18:12] sunejensen
The working directory is restored in the attached patch with the use of
line 1 and 4:
1: $current_dir = getcwd();
2: chdir($this->_options['packagedirectory']);
3: $glob = defined('GLOB_BRACE') ? glob($path, GLOB_BRACE) :
glob($path);
4: chdir($current_dir);
------------------------------------------------------------------------
[2009-07-16 09:15:58] sunejensen
Testing addReplacement when packagedirectory is set
Create this file structure:
./testAddReplacementWorksWithWorkingDir.php
./src/Class.php (empty file)
-- test script: testAddReplacementWorksWithWorkingDir.php --
<?php
require_once 'PEAR/PackageFileManager2.php';
$pfm = new PEAR_PackageFileManager2();
$pfm->setOptions(
array(
'baseinstalldir' => '/',
'filelistgenerator' => 'file',
'packagedirectory' => 'src',
'packagefile' => 'package.xml'
)
);
$pfm->setPackage('Test');
$pfm->setSummary('Test');
$pfm->setDescription('Test');
$pfm->setUri('__uri');
$pfm->setLicense('LGPL License',
'http://www.gnu.org/licenses/lgpl.html');
$pfm->addMaintainer('lead', 'sunetjensen', 'Sune Jensen',
'sune@intraface.dk');
$pfm->setPackageType('php');
$pfm->setAPIVersion('0.0.1');
$pfm->setReleaseVersion('0.0.1');
$pfm->setAPIStability('alpha');
$pfm->setReleaseStability('alpha');
$pfm->setNotes('release');
$pfm->addRelease();
$pfm->clearDeps();
$pfm->setPhpDep('5.2.0');
$pfm->setPearinstallerDep('1.8.1');
// Add replacement relative to package directory
$pfm->addReplacement('Class.php', 'pear-config', '@php-dir@',
'php_dir');
$pfm->generateContents();
$pfm->writePackageFile();
$res = $pfm->debugPackageFile();
if(PEAR::isError($res)) {
echo $res->toString()."\n";
}
-- expected result --
[ZIP]
<contents>
<dir baseinstalldir="/" name="/">
<file baseinstalldir="/" md5sum="d41d8cd98f00b204e9800998ecf8427e"
name="Class.php" role="php">
<tasks:replace from="@php-dir@" to="php_dir" type="pear-config"
/>
</file>
</dir>
</contents>
[ZIP]
-- actual result --
[ZIP]
<contents>
<dir baseinstalldir="/" name="/">
<file baseinstalldir="/" md5sum="d41d8cd98f00b204e9800998ecf8427e"
name="Class.php" role="php">
</file>
</dir>
</contents>
[ZIP]
------------------------------------------------------------------------
[2009-07-16 01:32:35] doconnor
The patch you've provided changed the current working directory and
never restores it.
Can you correct that, and also add test coverage?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://pear.php.net/bugs/bug.php?id=16406
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=16406&edit=1