cvs: pear /PEAR_PackageFileManager PackageFileManager.php package.php package.xml /PEAR_PackageFileManager/tests/importOptions test_valid.phpt
| From: | Greg Beaver | Date: | Wed, 06 Apr 2005 22:21:23 +0000 |
| Subject: | cvs: pear /PEAR_PackageFileManager PackageFileManager.php package.php package.xml /PEAR_PackageFileManager/tests/importOptions test_valid.phpt | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-30995@lists.php.net to get a copy of this message | ||
cellog Wed Apr 6 18:21:23 2005 EDT
Modified files:
/pear/PEAR_PackageFileManager PackageFileManager.php package.php
package.xml
/pear/PEAR_PackageFileManager/tests/importOptions test_valid.phpt
Log:
fix Bug #4003 importOptions() won't work until setOptions() is called
http://cvs.php.net/diff.php/pear/PEAR_PackageFileManager/PackageFileManager.php?r1=1.41&r2=1.42&ty=u Index: pear/PEAR_PackageFileManager/PackageFileManager.php diff -u pear/PEAR_PackageFileManager/PackageFileManager.php:1.41 pear/PEAR_PackageFileManager/PackageFileManager.php:1.42 --- pear/PEAR_PackageFileManager/PackageFileManager.php:1.41 Mon Mar 28 01:52:48 2005 +++ pear/PEAR_PackageFileManager/PackageFileManager.php Wed Apr 6 18:21:20 2005 @@ -16,7 +16,7 @@ // | Web http://www.phpdoc.org | // | Mirror http://phpdocu.sourceforge.net/ | // +------------------------------------------------------------------------+ -// $Id: PackageFileManager.php,v 1.41 2005/03/28 06:52:48 cellog Exp $ +// $Id: PackageFileManager.php,v 1.42 2005/04/06 22:21:20 cellog Exp $ // /** @@ -466,17 +466,19 @@ * @throws PEAR_PACKAGEFILEMANAGER_GENERATOR_NOTFOUND * @param array */ - function setOptions($options = array()) + function setOptions($options = array(), $internal = false) { - if (!isset($options['state'])) { - return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOSTATE); - } - if (!isset($options['version'])) { - return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOVERSION); + if (!$internal) { + if (!isset($options['state'])) { + return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOSTATE); + } + if (!isset($options['version'])) { + return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOVERSION); + } } - if (!isset($options['packagedirectory'])) { + if (!isset($options['packagedirectory']) && !$internal) { return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOPKGDIR); - } else { + } elseif (isset($options['packagedirectory'])) { $options['packagedirectory'] = str_replace(DIRECTORY_SEPARATOR, '/', realpath($options['packagedirectory'])); @@ -492,7 +494,7 @@ $options['pathtopackagefile'] .= '/'; } } - if (!isset($options['baseinstalldir'])) { + if (!isset($options['baseinstalldir']) && !$internal) { return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOBASEDIR); } $this->_options = array_merge($this->_options, $options); @@ -512,14 +514,20 @@ } $path = ($this->_options['pathtopackagefile'] ? $this->_options['pathtopackagefile'] : $this->_options['packagedirectory']); - $this->_options['filelistgenerator'] = ucfirst(strtolower($this->_options['filelistgenerator'])); - if (PEAR::isError($res = $this->_getExistingPackageXML($path, $this->_options['packagefile']))) { - return $res; + $this->_options['filelistgenerator'] = + ucfirst(strtolower($this->_options['filelistgenerator'])); + if (!$internal) { + if (PEAR::isError($res = + $this->_getExistingPackageXML($path, $this->_options['packagefile']))) { + return $res; + } } if (!class_exists('PEAR_PackageFileManager_' . $this->_options['filelistgenerator'])) { // attempt to load the interface from the standard PEAR location - if ($this->isIncludeable('PEAR/PackageFileManager/' . $this->_options['filelistgenerator'] . '.php')) { - include_once('PEAR/PackageFileManager/' . $this->_options['filelistgenerator'] . '.php'); + if ($this->isIncludeable('PEAR/PackageFileManager/' . + $this->_options['filelistgenerator'] . '.php')) { + include_once('PEAR/PackageFileManager/' . + $this->_options['filelistgenerator'] . '.php'); } elseif (isset($this->_options['usergeneratordir'])) { // attempt to load from a user-specified directory if (is_dir(realpath($this->_options['usergeneratordir']))) { @@ -527,7 +535,8 @@ str_replace(DIRECTORY_SEPARATOR, '/', realpath($this->_options['usergeneratordir'])); - if ($this->_options['usergeneratordir']{strlen($this->_options['usergeneratordir']) - 1} != '/') { + if ($this->_options['usergeneratordir']{strlen($this->_options['usergeneratordir']) + - 1} != '/') { $this->_options['usergeneratordir'] .= '/'; } } else { @@ -556,11 +565,10 @@ * * @return true|PEAR_Error */ - function importOptions($packagefile) + function importOptions($packagefile, $options = array()) { - $this->_options['cleardependencies'] = false; - $this->_options['deps'] = false; - $this->_options['maintainers'] = false; + $options['cleardependencies'] = $options['deps'] = $options['maintainers'] = false; + $this->setOptions($options, true); if (PEAR::isError($res = $this->_getExistingPackageXML(dirname($packagefile) . DIRECTORY_SEPARATOR, basename($packagefile)))) { return $res; http://cvs.php.net/diff.php/pear/PEAR_PackageFileManager/package.php?r1=1.3&r2=1.4&ty=u Index: pear/PEAR_PackageFileManager/package.php diff -u pear/PEAR_PackageFileManager/package.php:1.3 pear/PEAR_PackageFileManager/package.php:1.4 --- pear/PEAR_PackageFileManager/package.php:1.3 Mon Mar 28 01:56:02 2005 +++ pear/PEAR_PackageFileManager/package.php Wed Apr 6 18:21:20 2005 @@ -4,16 +4,11 @@ PEAR::setErrorHandling(PEAR_ERROR_DIE); $pf->setOptions(array( 'state' => 'stable', -'version' => '1.5.0', +'version' => '1.5.1', 'license' => 'PHP License', -'notes' => 'New features and bugfixes -* fix Bug #3696 PHP SAPI check in debugPackageFile() not reliable, use php_sapi_name() instead -* implement Request #3747 getOptions() method -* Migrate all unit tests to .phpt, run - "pear run-tests -p PEAR_PackageFileManager" in PEAR 1.4.0 to run tests - post-installation -* add dependency on XML_Tree (used by SVN driver) -* add package2.xml to the list of auto-ignored files', +'notes' => 'Bugfix release +* fix Bug #4003 importOptions() won\'t work until setOptions() is called +', 'packagedirectory' => dirname(__FILE__), 'baseinstalldir' => 'PEAR', 'filelistgenerator' => 'CVS', http://cvs.php.net/diff.php/pear/PEAR_PackageFileManager/package.xml?r1=1.57&r2=1.58&ty=u Index: pear/PEAR_PackageFileManager/package.xml diff -u pear/PEAR_PackageFileManager/package.xml:1.57 pear/PEAR_PackageFileManager/package.xml:1.58 --- pear/PEAR_PackageFileManager/package.xml:1.57 Mon Mar 28 01:56:35 2005 +++ pear/PEAR_PackageFileManager/package.xml Wed Apr 6 18:21:20 2005 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0" packagerversion="1.4.0a9"> +<package version="1.0" packagerversion="1.4.0a10"> <name>PEAR_PackageFileManager</name> <summary>PEAR_PackageFileManager takes an existing package.xml file and updates it with a new filelist and changelog</summary> <description>This package revolutionizes the maintenance of PEAR packages. With a few parameters, @@ -37,18 +37,12 @@ </maintainer> </maintainers> <release> - <version>1.5.0</version> - <date>2005-03-28</date> + <version>1.5.1</version> + <date>2005-04-06</date> <license>PHP License</license> <state>stable</state> - <notes>New features and bugfixes -* fix Bug #3696 PHP SAPI check in debugPackageFile() not reliable, use php_sapi_name() instead -* implement Request #3747 getOptions() method -* Migrate all unit tests to .phpt, run - "pear run-tests -p PEAR_PackageFileManager" in PEAR 1.4.0 to run tests - post-installation -* add dependency on XML_Tree (used by SVN driver) -* add package2.xml to the list of auto-ignored files + <notes>Bugfix release +* fix Bug #4003 importOptions() won't work until setOptions() is called </notes> <deps> <dep type="pkg" rel="ge" version="1.1" optional="no">PEAR</dep> @@ -525,5 +519,14 @@ * add package2.xml to the list of auto-ignored files </notes> </release> + <release> + <version>1.5.1</version> + <date>2005-04-06</date> + <license>PHP License</license> + <state>stable</state> + <notes>Bugfix release +* fix Bug #4003 importOptions() won't work until setOptions() is called + </notes> + </release> </changelog> </package> http://cvs.php.net/diff.php/pear/PEAR_PackageFileManager/tests/importOptions/test_valid.phpt?r1=1.1&r2=1.2&ty=u Index: pear/PEAR_PackageFileManager/tests/importOptions/test_valid.phpt diff -u pear/PEAR_PackageFileManager/tests/importOptions/test_valid.phpt:1.1 pear/PEAR_PackageFileManager/tests/importOptions/test_valid.phpt:1.2 --- pear/PEAR_PackageFileManager/tests/importOptions/test_valid.phpt:1.1 Mon Mar 28 01:53:05 2005 +++ pear/PEAR_PackageFileManager/tests/importOptions/test_valid.phpt Wed Apr 6 18:21:23 2005 @@ -4,13 +4,12 @@ --FILE-- <?php require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'setup.php.inc'; -$packagexml->_options['pearcommonclass'] = 'PEAR_Common'; $res = $packagexml->importOptions(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'test1_package.xml'); $phpunit->assertTrue($res, 'return'); $phpunit->assertEquals(array ( 'packagefile' => 'package.xml', 'doctype' => 'http://pear.php.net/dtd/package-1.0', - 'filelistgenerator' => 'file', + 'filelistgenerator' => 'File', 'license' => 'PHP License', 'changelogoldtonew' => true, 'roles' =>
http://cvs.php.net/diff.php/pear/PEAR_PackageFileManager/PackageFileManager.php?r1=1.41&r2=1.42&ty=u Index: pear/PEAR_PackageFileManager/PackageFileManager.php diff -u pear/PEAR_PackageFileManager/PackageFileManager.php:1.41 pear/PEAR_PackageFileManager/PackageFileManager.php:1.42 --- pear/PEAR_PackageFileManager/PackageFileManager.php:1.41 Mon Mar 28 01:52:48 2005 +++ pear/PEAR_PackageFileManager/PackageFileManager.php Wed Apr 6 18:21:20 2005 @@ -16,7 +16,7 @@ // | Web http://www.phpdoc.org | // | Mirror http://phpdocu.sourceforge.net/ | // +------------------------------------------------------------------------+ -// $Id: PackageFileManager.php,v 1.41 2005/03/28 06:52:48 cellog Exp $ +// $Id: PackageFileManager.php,v 1.42 2005/04/06 22:21:20 cellog Exp $ // /** @@ -466,17 +466,19 @@ * @throws PEAR_PACKAGEFILEMANAGER_GENERATOR_NOTFOUND * @param array */ - function setOptions($options = array()) + function setOptions($options = array(), $internal = false) { - if (!isset($options['state'])) { - return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOSTATE); - } - if (!isset($options['version'])) { - return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOVERSION); + if (!$internal) { + if (!isset($options['state'])) { + return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOSTATE); + } + if (!isset($options['version'])) { + return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOVERSION); + } } - if (!isset($options['packagedirectory'])) { + if (!isset($options['packagedirectory']) && !$internal) { return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOPKGDIR); - } else { + } elseif (isset($options['packagedirectory'])) { $options['packagedirectory'] = str_replace(DIRECTORY_SEPARATOR, '/', realpath($options['packagedirectory'])); @@ -492,7 +494,7 @@ $options['pathtopackagefile'] .= '/'; } } - if (!isset($options['baseinstalldir'])) { + if (!isset($options['baseinstalldir']) && !$internal) { return $this->raiseError(PEAR_PACKAGEFILEMANAGER_NOBASEDIR); } $this->_options = array_merge($this->_options, $options); @@ -512,14 +514,20 @@ } $path = ($this->_options['pathtopackagefile'] ? $this->_options['pathtopackagefile'] : $this->_options['packagedirectory']); - $this->_options['filelistgenerator'] = ucfirst(strtolower($this->_options['filelistgenerator'])); - if (PEAR::isError($res = $this->_getExistingPackageXML($path, $this->_options['packagefile']))) { - return $res; + $this->_options['filelistgenerator'] = + ucfirst(strtolower($this->_options['filelistgenerator'])); + if (!$internal) { + if (PEAR::isError($res = + $this->_getExistingPackageXML($path, $this->_options['packagefile']))) { + return $res; + } } if (!class_exists('PEAR_PackageFileManager_' . $this->_options['filelistgenerator'])) { // attempt to load the interface from the standard PEAR location - if ($this->isIncludeable('PEAR/PackageFileManager/' . $this->_options['filelistgenerator'] . '.php')) { - include_once('PEAR/PackageFileManager/' . $this->_options['filelistgenerator'] . '.php'); + if ($this->isIncludeable('PEAR/PackageFileManager/' . + $this->_options['filelistgenerator'] . '.php')) { + include_once('PEAR/PackageFileManager/' . + $this->_options['filelistgenerator'] . '.php'); } elseif (isset($this->_options['usergeneratordir'])) { // attempt to load from a user-specified directory if (is_dir(realpath($this->_options['usergeneratordir']))) { @@ -527,7 +535,8 @@ str_replace(DIRECTORY_SEPARATOR, '/', realpath($this->_options['usergeneratordir'])); - if ($this->_options['usergeneratordir']{strlen($this->_options['usergeneratordir']) - 1} != '/') { + if ($this->_options['usergeneratordir']{strlen($this->_options['usergeneratordir']) + - 1} != '/') { $this->_options['usergeneratordir'] .= '/'; } } else { @@ -556,11 +565,10 @@ * * @return true|PEAR_Error */ - function importOptions($packagefile) + function importOptions($packagefile, $options = array()) { - $this->_options['cleardependencies'] = false; - $this->_options['deps'] = false; - $this->_options['maintainers'] = false; + $options['cleardependencies'] = $options['deps'] = $options['maintainers'] = false; + $this->setOptions($options, true); if (PEAR::isError($res = $this->_getExistingPackageXML(dirname($packagefile) . DIRECTORY_SEPARATOR, basename($packagefile)))) { return $res; http://cvs.php.net/diff.php/pear/PEAR_PackageFileManager/package.php?r1=1.3&r2=1.4&ty=u Index: pear/PEAR_PackageFileManager/package.php diff -u pear/PEAR_PackageFileManager/package.php:1.3 pear/PEAR_PackageFileManager/package.php:1.4 --- pear/PEAR_PackageFileManager/package.php:1.3 Mon Mar 28 01:56:02 2005 +++ pear/PEAR_PackageFileManager/package.php Wed Apr 6 18:21:20 2005 @@ -4,16 +4,11 @@ PEAR::setErrorHandling(PEAR_ERROR_DIE); $pf->setOptions(array( 'state' => 'stable', -'version' => '1.5.0', +'version' => '1.5.1', 'license' => 'PHP License', -'notes' => 'New features and bugfixes -* fix Bug #3696 PHP SAPI check in debugPackageFile() not reliable, use php_sapi_name() instead -* implement Request #3747 getOptions() method -* Migrate all unit tests to .phpt, run - "pear run-tests -p PEAR_PackageFileManager" in PEAR 1.4.0 to run tests - post-installation -* add dependency on XML_Tree (used by SVN driver) -* add package2.xml to the list of auto-ignored files', +'notes' => 'Bugfix release +* fix Bug #4003 importOptions() won\'t work until setOptions() is called +', 'packagedirectory' => dirname(__FILE__), 'baseinstalldir' => 'PEAR', 'filelistgenerator' => 'CVS', http://cvs.php.net/diff.php/pear/PEAR_PackageFileManager/package.xml?r1=1.57&r2=1.58&ty=u Index: pear/PEAR_PackageFileManager/package.xml diff -u pear/PEAR_PackageFileManager/package.xml:1.57 pear/PEAR_PackageFileManager/package.xml:1.58 --- pear/PEAR_PackageFileManager/package.xml:1.57 Mon Mar 28 01:56:35 2005 +++ pear/PEAR_PackageFileManager/package.xml Wed Apr 6 18:21:20 2005 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> -<package version="1.0" packagerversion="1.4.0a9"> +<package version="1.0" packagerversion="1.4.0a10"> <name>PEAR_PackageFileManager</name> <summary>PEAR_PackageFileManager takes an existing package.xml file and updates it with a new filelist and changelog</summary> <description>This package revolutionizes the maintenance of PEAR packages. With a few parameters, @@ -37,18 +37,12 @@ </maintainer> </maintainers> <release> - <version>1.5.0</version> - <date>2005-03-28</date> + <version>1.5.1</version> + <date>2005-04-06</date> <license>PHP License</license> <state>stable</state> - <notes>New features and bugfixes -* fix Bug #3696 PHP SAPI check in debugPackageFile() not reliable, use php_sapi_name() instead -* implement Request #3747 getOptions() method -* Migrate all unit tests to .phpt, run - "pear run-tests -p PEAR_PackageFileManager" in PEAR 1.4.0 to run tests - post-installation -* add dependency on XML_Tree (used by SVN driver) -* add package2.xml to the list of auto-ignored files + <notes>Bugfix release +* fix Bug #4003 importOptions() won't work until setOptions() is called </notes> <deps> <dep type="pkg" rel="ge" version="1.1" optional="no">PEAR</dep> @@ -525,5 +519,14 @@ * add package2.xml to the list of auto-ignored files </notes> </release> + <release> + <version>1.5.1</version> + <date>2005-04-06</date> + <license>PHP License</license> + <state>stable</state> + <notes>Bugfix release +* fix Bug #4003 importOptions() won't work until setOptions() is called + </notes> + </release> </changelog> </package> http://cvs.php.net/diff.php/pear/PEAR_PackageFileManager/tests/importOptions/test_valid.phpt?r1=1.1&r2=1.2&ty=u Index: pear/PEAR_PackageFileManager/tests/importOptions/test_valid.phpt diff -u pear/PEAR_PackageFileManager/tests/importOptions/test_valid.phpt:1.1 pear/PEAR_PackageFileManager/tests/importOptions/test_valid.phpt:1.2 --- pear/PEAR_PackageFileManager/tests/importOptions/test_valid.phpt:1.1 Mon Mar 28 01:53:05 2005 +++ pear/PEAR_PackageFileManager/tests/importOptions/test_valid.phpt Wed Apr 6 18:21:23 2005 @@ -4,13 +4,12 @@ --FILE-- <?php require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'setup.php.inc'; -$packagexml->_options['pearcommonclass'] = 'PEAR_Common'; $res = $packagexml->importOptions(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'test1_package.xml'); $phpunit->assertTrue($res, 'return'); $phpunit->assertEquals(array ( 'packagefile' => 'package.xml', 'doctype' => 'http://pear.php.net/dtd/package-1.0', - 'filelistgenerator' => 'file', + 'filelistgenerator' => 'File', 'license' => 'PHP License', 'changelogoldtonew' => true, 'roles' =>