cellog Mon Mar 28 11:46:07 2005 EDT Modified files: (Branch: PHP_5_0) /php-src/pear/OS Guess.php /php-src/pear PEAR.php package-PEAR.xml package.dtd template.spec /php-src/pear/PEAR Builder.php Common.php Dependency.php ErrorStack.php Exception.php Installer.php Registry.php /php-src/pear/PEAR/Command Package.php /php-src/pear/scripts pearcmd.php Log: merge in PEAR 1.3.5
http://cvs.php.net/diff.php/php-src/pear/OS/Guess.php?r1=1.13&r2=1.13.4.1&ty=u Index: php-src/pear/OS/Guess.php diff -u php-src/pear/OS/Guess.php:1.13 php-src/pear/OS/Guess.php:1.13.4.1 --- php-src/pear/OS/Guess.php:1.13 Thu Jan 8 12:33:11 2004 +++ php-src/pear/OS/Guess.php Mon Mar 28 11:46:06 2005 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Guess.php,v 1.13 2004/01/08 17:33:11 sniper Exp $ +// $Id: Guess.php,v 1.13.4.1 2005/03/28 16:46:06 cellog Exp $ // {{{ uname examples @@ -68,6 +68,11 @@ // SparcStation 20 Solaris 8: // SunOS host.example.com 5.8 Generic_108528-12 sun4m sparc SUNW,SPARCstation-20 // +// Mac OS X (Darwin) +// Darwin home-eden.local 7.5.0 Darwin Kernel Version 7.5.0: Thu Aug 5 19:26:16 PDT 2004; root:xnu/xnu-517.7.21.obj~3/RELEASE_PPC Power Macintosh +// +// Mac OS X early versions +// // }}} @@ -97,11 +102,11 @@ static $sysmap = array( 'HP-UX' => 'hpux', 'IRIX64' => 'irix', - // Darwin? ); static $cpumap = array( 'i586' => 'i386', 'i686' => 'i386', + 'ppc' => 'powerpc', ); if ($uname === null) { $uname = php_uname(); @@ -138,6 +143,24 @@ // use only the first two digits from the kernel version $release = ereg_replace('^([[:digit:]]+\.[[:digit:]]+).*', '\1', $parts[2]); break; + case 'Mac' : + $sysname = 'darwin'; + $nodename = $parts[2]; + $release = $parts[3]; + if ($cpu == 'Macintosh') { + if ($parts[$n - 2] == 'Power') { + $cpu = 'powerpc'; + } + } + break; + case 'Darwin' : + if ($cpu == 'Macintosh') { + if ($parts[$n - 2] == 'Power') { + $cpu = 'powerpc'; + } + } + $release = ereg_replace('^([[:digit:]]+\.[[:digit:]]+).*', '\1', $parts[2]); + break; default: $release = ereg_replace('-.*', '', $parts[2]); break; @@ -255,7 +278,6 @@ } } - /* * Local Variables: * indent-tabs-mode: nil http://cvs.php.net/diff.php/php-src/pear/PEAR.php?r1=1.82&r2=1.82.2.1&ty=u Index: php-src/pear/PEAR.php diff -u php-src/pear/PEAR.php:1.82 php-src/pear/PEAR.php:1.82.2.1 --- php-src/pear/PEAR.php:1.82 Wed Jun 16 12:26:12 2004 +++ php-src/pear/PEAR.php Mon Mar 28 11:46:06 2005 @@ -18,7 +18,7 @@ // | Tomas V.V.Cox <[EMAIL PROTECTED]> | // +--------------------------------------------------------------------+ // -// $Id: PEAR.php,v 1.82 2004/06/16 16:26:12 ssb Exp $ +// $Id: PEAR.php,v 1.82.2.1 2005/03/28 16:46:06 cellog Exp $ // define('PEAR_ERROR_RETURN', 1); @@ -59,7 +59,7 @@ $GLOBALS['_PEAR_shutdown_funcs'] = array(); $GLOBALS['_PEAR_error_handler_stack'] = array(); -ini_set('track_errors', true); [EMAIL PROTECTED]('track_errors', true); /** * Base class for other PEAR classes. Provides rudimentary @@ -152,7 +152,7 @@ */ function PEAR($error_class = null) { - $classname = get_class($this); + $classname = strtolower(get_class($this)); if ($this->_debug) { print "PEAR constructor called, class=$classname\n"; } @@ -164,6 +164,10 @@ if (method_exists($this, $destructor)) { global $_PEAR_destructor_object_list; $_PEAR_destructor_object_list[] = &$this; + if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { + register_shutdown_function("_PEAR_call_destructors"); + $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; + } break; } else { $classname = get_parent_class($classname); @@ -187,7 +191,7 @@ */ function _PEAR() { if ($this->_debug) { - printf("PEAR destructor called, class=%s\n", get_class($this)); + printf("PEAR destructor called, class=%s\n", strtolower(get_class($this))); } } @@ -561,6 +565,77 @@ } // }}} + function staticPushErrorHandling($mode, $options = null) + { + $stack = &$GLOBALS['_PEAR_error_handler_stack']; + $def_mode = &$GLOBALS['_PEAR_default_error_mode']; + $def_options = &$GLOBALS['_PEAR_default_error_options']; + $stack[] = array($def_mode, $def_options); + switch ($mode) { + case PEAR_ERROR_EXCEPTION: + case PEAR_ERROR_RETURN: + case PEAR_ERROR_PRINT: + case PEAR_ERROR_TRIGGER: + case PEAR_ERROR_DIE: + case null: + $def_mode = $mode; + $def_options = $options; + break; + + case PEAR_ERROR_CALLBACK: + $def_mode = $mode; + // class/object method callback + if (is_callable($options)) { + $def_options = $options; + } else { + trigger_error("invalid error callback", E_USER_WARNING); + } + break; + + default: + trigger_error("invalid error mode", E_USER_WARNING); + break; + } + $stack[] = array($mode, $options); + return true; + } + + function staticPopErrorHandling() + { + $stack = &$GLOBALS['_PEAR_error_handler_stack']; + $setmode = &$GLOBALS['_PEAR_default_error_mode']; + $setoptions = &$GLOBALS['_PEAR_default_error_options']; + array_pop($stack); + list($mode, $options) = $stack[sizeof($stack) - 1]; + array_pop($stack); + switch ($mode) { + case PEAR_ERROR_EXCEPTION: + case PEAR_ERROR_RETURN: + case PEAR_ERROR_PRINT: + case PEAR_ERROR_TRIGGER: + case PEAR_ERROR_DIE: + case null: + $setmode = $mode; + $setoptions = $options; + break; + + case PEAR_ERROR_CALLBACK: + $setmode = $mode; + // class/object method callback + if (is_callable($options)) { + $setoptions = $options; + } else { + trigger_error("invalid error callback", E_USER_WARNING); + } + break; + + default: + trigger_error("invalid error mode", E_USER_WARNING); + break; + } + return true; + } + // {{{ pushErrorHandling() /** @@ -665,6 +740,9 @@ sizeof($_PEAR_destructor_object_list)) { reset($_PEAR_destructor_object_list); + if (@PEAR::getStaticProperty('PEAR', 'destructlifo')) { + $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list); + } while (list($k, $objref) = each($_PEAR_destructor_object_list)) { $classname = get_class($objref); while ($classname) { @@ -738,7 +816,9 @@ $this->mode = $mode; $this->userinfo = $userinfo; if (function_exists("debug_backtrace")) { - $this->backtrace = debug_backtrace(); + if (@!PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) { + $this->backtrace = debug_backtrace(); + } } if ($mode & PEAR_ERROR_CALLBACK) { $this->level = E_USER_NOTICE; @@ -929,14 +1009,16 @@ E_USER_ERROR => 'error'); if ($this->mode & PEAR_ERROR_CALLBACK) { if (is_array($this->callback)) { - $callback = get_class($this->callback[0]) . '::' . + $callback = (is_object($this->callback[0]) ? + strtolower(get_class($this->callback[0])) : + $this->callback[0]) . '::' . $this->callback[1]; } else { $callback = $this->callback; } return sprintf('[%s: message="%s" code=%d mode=callback '. 'callback=%s prefix="%s" info="%s"]', - get_class($this), $this->message, $this->code, + strtolower(get_class($this)), $this->message, $this->code, $callback, $this->error_message_prefix, $this->userinfo); } @@ -954,7 +1036,7 @@ } return sprintf('[%s: message="%s" code=%d mode=%s level=%s '. 'prefix="%s" info="%s"]', - get_class($this), $this->message, $this->code, + strtolower(get_class($this)), $this->message, $this->code, implode("|", $modes), $levels[$this->level], $this->error_message_prefix, $this->userinfo); @@ -963,8 +1045,6 @@ // }}} } -register_shutdown_function("_PEAR_call_destructors"); - /* * Local Variables: * mode: php http://cvs.php.net/diff.php/php-src/pear/package-PEAR.xml?r1=1.106.2.1&r2=1.106.2.2&ty=u Index: php-src/pear/package-PEAR.xml diff -u php-src/pear/package-PEAR.xml:1.106.2.1 php-src/pear/package-PEAR.xml:1.106.2.2 --- php-src/pear/package-PEAR.xml:1.106.2.1 Thu Oct 28 15:33:23 2004 +++ php-src/pear/package-PEAR.xml Mon Mar 28 11:46:06 2005 @@ -48,26 +48,15 @@ </maintainer> </maintainers> <release> - <version>1.3.3</version> - <date>2004-10-28</date> + <version>1.3.5</version> + <date>2005-02-18</date> <state>stable</state> <license>PHP License</license> <notes> -Installer: - * fix Bug #1186 raise a notice error on PEAR::Common $_packageName - * fix Bug #1249 display the right state when using --force option - * fix Bug #2189 upgrade-all stops if dependancy fails - * fix Bug #1637 The use of interface causes warnings when packaging with PEAR - * fix Bug #1420 Parser bug for T_DOUBLE_COLON - * fix Request #2220 pear5 build fails on dual php4/php5 system - * fix Bug #1163 pear makerpm fails with packages that supply role="doc" - -Other: - * add PEAR_Exception class for PHP5 users - * fix critical problem in package.xml for linux in 1.3.2 - * fix staticPopCallback() in PEAR_ErrorStack - * fix warning in PEAR_Registry for windows 98 users -</notes> + * fix Bug #3505: pecl can't install PDO + * enhance pear run-tests dramatically + * fix Bug #3506: pear install should export the pear version into the environment + </notes> <provides type="class" name="OS_Guess" /> <provides type="class" name="System" /> <provides type="function" name="md5_file" /> @@ -98,11 +87,14 @@ <file role="php" name="Downloader.php"/> <file role="php" name="Exception.php"/> <file role="php" name="ErrorStack.php"/> - <file role="php" name="Builder.php"/> + <file role="php" name="Builder.php"> + <replace from="@PEAR-VER@" to="version" type="package-info"/> + </file> <file role="php" name="Installer.php"/> <file role="php" name="Packager.php"/> <file role="php" name="Registry.php"/> <file role="php" name="Remote.php"/> + <file role="php" name="RunTest.php"/> </dir> <dir name="scripts" baseinstalldir="/"> <file role="script" install-as="pear" name="pear.sh"> @@ -160,22 +152,49 @@ </notes> </release> <release> - <version>1.3</version> - <date>2004-02-20</date> + <version>1.3.3</version> + <date>2004-10-28</date> <state>stable</state> <notes> -PEAR Installer: - -* Bug #171 --alldeps with a rel="eq" should install the required version, if possible -* Bug #249 installing from an url doesnt work -* Bug #248 --force command does not work as expected -* Bug #293 [Patch] PEAR_Error not calling static method callbacks for error-handler -* Bug #324 pear -G gives Fatal Error (PHP-GTK not installed, but error is at engine level) -* Bug #594 PEAR_Common::analyzeSourceCode fails on string with $var and { -* Bug #521 Incorrect filename in naming warnings -* Moved download code into its own class -* Fully unit tested the installer, packager, downloader, and PEAR_Common +Installer: + * fix Bug #1186 raise a notice error on PEAR::Common $_packageName + * fix Bug #1249 display the right state when using --force option + * fix Bug #2189 upgrade-all stops if dependancy fails + * fix Bug #1637 The use of interface causes warnings when packaging with PEAR + * fix Bug #1420 Parser bug for T_DOUBLE_COLON + * fix Request #2220 pear5 build fails on dual php4/php5 system + * fix Bug #1163 pear makerpm fails with packages that supply role="doc" +Other: + * add PEAR_Exception class for PHP5 users + * fix critical problem in package.xml for linux in 1.3.2 + * fix staticPopCallback() in PEAR_ErrorStack + * fix warning in PEAR_Registry for windows 98 users + </notes> + </release> + <release> + <version>1.3.3.1</version> + <date>2004-11-08</date> + <state>stable</state> + <notes> + add RunTest.php to package.xml, make run-tests display failed tests, and use ui + </notes> + </release> + <release> + <version>1.3.4</version> + <date>2005-01-01</date> + <state>stable</state> + <notes> + * fix a serious problem caused by a bug in all versions of PHP that caused multiple registration + of the shutdown function of PEAR.php + * fix Bug #2861: package.dtd does not define NUMBER + * fix Bug #2946: ini_set warning errors + * fix Bug #3026: Dependency type "ne" is needed, "not" is not handled + properly + * fix Bug #3061: potential warnings in PEAR_Exception + * implement Request #2848: PEAR_ErrorStack logger extends, PEAR_ERRORSTACK_DIE + * implement Request #2914: Dynamic Include Path for run-tests command + * make pear help listing more useful (put how-to-use info at the bottom of the listing) </notes> </release> </changelog> http://cvs.php.net/diff.php/php-src/pear/package.dtd?r1=1.35&r2=1.35.4.1&ty=u Index: php-src/pear/package.dtd diff -u php-src/pear/package.dtd:1.35 php-src/pear/package.dtd:1.35.4.1 --- php-src/pear/package.dtd:1.35 Sun Jan 25 18:36:28 2004 +++ php-src/pear/package.dtd Mon Mar 28 11:46:06 2005 @@ -1,5 +1,5 @@ <!-- - $Id: package.dtd,v 1.35 2004/01/25 23:36:28 pajoye Exp $ + $Id: package.dtd,v 1.35.4.1 2005/03/28 16:46:06 cellog Exp $ This is the PEAR package description, version 1.0. It should be used with the informal public identifier: @@ -20,7 +20,7 @@ Stig S. Bakken <[EMAIL PROTECTED]> --> - +<!ENTITY % NUMBER "CDATA"> <!ELEMENT package (name|summary|description|license|maintainers|release|changelog)+> <!ATTLIST package type (source|binary|empty) "empty" version CDATA #REQUIRED> @@ -65,8 +65,8 @@ <!ATTLIST file role (php|ext|src|test|doc|data|script) 'php' debug (na|on|off) 'na' zts (na|on|off) 'na' - phpapi NUMBER #IMPLIED - zendapi NUMBER #IMPLIED + phpapi %NUMBER; #IMPLIED + zendapi %NUMBER; #IMPLIED format CDATA #IMPLIED baseinstalldir CDATA #IMPLIED platform CDATA #IMPLIED http://cvs.php.net/diff.php/php-src/pear/template.spec?r1=1.3&r2=1.3.4.1&ty=u Index: php-src/pear/template.spec diff -u php-src/pear/template.spec:1.3 php-src/pear/template.spec:1.3.4.1 --- php-src/pear/template.spec:1.3 Mon Jun 16 04:27:47 2003 +++ php-src/pear/template.spec Mon Mar 28 11:46:06 2005 @@ -30,25 +30,29 @@ %build echo BuildRoot=%{buildroot} +%clean +[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot} + %postun pear uninstall --nodeps -r @package@ -rm @rpm_xml_dir@/@[EMAIL PROTECTED] %post pear install --nodeps -r @rpm_xml_dir@/@[EMAIL PROTECTED] %install -pear -c %{buildroot}/pearrc install --nodeps -R %{buildroot} \ - $RPM_SOURCE_DIR/@[EMAIL PROTECTED] +pear -c "%{buildroot}/pearrc" install --nodeps -R "%{buildroot}" \ + "$RPM_SOURCE_DIR/@[EMAIL PROTECTED]" rm %{buildroot}/pearrc rm %{buildroot}/%{_libdir}/php/pear/.filemap rm %{buildroot}/%{_libdir}/php/pear/.lock rm -rf %{buildroot}/%{_libdir}/php/pear/.registry -if [ -d "%{buildroot}/docs/@package@/doc" ]; then - rm -rf $RPM_BUILD_DIR/doc - mv %{buildroot}/docs/@package@/doc $RPM_BUILD_DIR - rm -rf %{buildroot}/docs -fi +for DOCDIR in docs doc examples; do + if [ -d "%{buildroot}/docs/@package@/$DOCDIR" ]; then + rm -rf $RPM_BUILD_DIR/$DOCDIR + mv %{buildroot}/docs/@package@/$DOCDIR $RPM_BUILD_DIR + rm -rf %{buildroot}/docs + fi +done mkdir -p [EMAIL PROTECTED]@ tar -xzf $RPM_SOURCE_DIR/@[EMAIL PROTECTED] package.xml cp -p package.xml [EMAIL PROTECTED]@/@[EMAIL PROTECTED] http://cvs.php.net/diff.php/php-src/pear/PEAR/Builder.php?r1=1.16.2.1&r2=1.16.2.2&ty=u Index: php-src/pear/PEAR/Builder.php diff -u php-src/pear/PEAR/Builder.php:1.16.2.1 php-src/pear/PEAR/Builder.php:1.16.2.2 --- php-src/pear/PEAR/Builder.php:1.16.2.1 Mon Oct 25 13:14:32 2004 +++ php-src/pear/PEAR/Builder.php Mon Mar 28 11:46:06 2005 @@ -16,7 +16,7 @@ // | Authors: Stig Sæther Bakken <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Builder.php,v 1.16.2.1 2004/10/25 17:14:32 cellog Exp $ +// $Id: Builder.php,v 1.16.2.2 2005/03/28 16:46:06 cellog Exp $ require_once 'PEAR/Common.php'; @@ -150,6 +150,49 @@ } // }}} + // {{{ _harventInstDir + /** + * @param string + * @param string + * @param array + * @access private + */ + function _harvestInstDir($dest_prefix, $dirname, &$built_files) + { + $d = opendir($dirname); + if (!$d) + return false; + + $ret = true; + while (($ent = readdir($d)) !== false) { + if ($ent{0} == '.') + continue; + + $full = $dirname . DIRECTORY_SEPARATOR . $ent; + if (is_dir($full)) { + if (!$this->_harvestInstDir( + $dest_prefix . DIRECTORY_SEPARATOR . $ent, + $full, $built_files)) { + $ret = false; + break; + } + } else { + $dest = $dest_prefix . DIRECTORY_SEPARATOR . $ent; + $built_files[] = array( + 'file' => $full, + 'dest' => $dest, + 'php_api' => $this->php_api_version, + 'zend_mod_api' => $this->zend_module_api_no, + 'zend_ext_api' => $this->zend_extension_api_no, + ); + } + } + closedir($d); + return $ret; + } + + // }}} + // {{{ build() /** @@ -231,14 +274,20 @@ } $build_basedir = "/var/tmp/pear-build-$user"; $build_dir = "$build_basedir/$info[package]-$info[version]"; + $inst_dir = "$build_basedir/install-$info[package]-$info[version]"; $this->log(1, "building in $build_dir"); if (is_dir($build_dir)) { - System::rm("-rf $build_dir"); + System::rm(array('-rf', $build_dir)); } - if (!System::mkDir("-p $build_dir")) { + if (!System::mkDir(array('-p', $build_dir))) { return $this->raiseError("could not create build dir: $build_dir"); } $this->addTempFile($build_dir); + if (!System::mkDir(array('-p', $inst_dir))) { + return $this->raiseError("could not create temporary install dir: $inst_dir"); + } + $this->addTempFile($inst_dir); + if (getenv('MAKE')) { $make_command = getenv('MAKE'); } else { @@ -247,10 +296,13 @@ $to_run = array( $configure_command, $make_command, + "$make_command INSTALL_ROOT=\"$inst_dir\" install", + "find \"$inst_dir\" -ls" ); if ([EMAIL PROTECTED]($build_dir)) { return $this->raiseError("could not chdir to $build_dir"); } + putenv('[EMAIL PROTECTED]@'); foreach ($to_run as $cmd) { $err = $this->_runCommand($cmd, $callback); if (PEAR::isError($err)) { @@ -267,26 +319,8 @@ return $this->raiseError("no `modules' directory found"); } $built_files = array(); - while ($ent = readdir($dp)) { - if ($ent{0} == '.' || substr($ent, -3) == '.la') { - continue; - } - // harvest! - if (@copy("modules/$ent", "$dir/$ent")) { - $built_files[] = array( - 'file' => "$dir/$ent", - 'php_api' => $this->php_api_version, - 'zend_mod_api' => $this->zend_module_api_no, - 'zend_ext_api' => $this->zend_extension_api_no, - ); - - $this->log(1, "$ent copied to $dir/$ent"); - } else { - chdir($old_cwd); - return $this->raiseError("failed copying $ent to $dir"); - } - } - closedir($dp); + $prefix = exec("php-config --prefix"); + $this->_harvestInstDir($prefix, $inst_dir . DIRECTORY_SEPARATOR . $prefix, $built_files); chdir($old_cwd); return $built_files; } http://cvs.php.net/diff.php/php-src/pear/PEAR/Common.php?r1=1.126.2.1&r2=1.126.2.2&ty=u Index: php-src/pear/PEAR/Common.php diff -u php-src/pear/PEAR/Common.php:1.126.2.1 php-src/pear/PEAR/Common.php:1.126.2.2 --- php-src/pear/PEAR/Common.php:1.126.2.1 Mon Oct 25 13:14:33 2004 +++ php-src/pear/PEAR/Common.php Mon Mar 28 11:46:06 2005 @@ -17,7 +17,7 @@ // | Tomas V.V.Cox <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.126.2.1 2004/10/25 17:14:33 cellog Exp $ +// $Id: Common.php,v 1.126.2.2 2005/03/28 16:46:06 cellog Exp $ require_once 'PEAR.php'; require_once 'Archive/Tar.php'; @@ -69,7 +69,7 @@ * Valid dependency relations * @var array */ -$GLOBALS['_PEAR_Common_dependency_relations'] = array('has','eq','lt','le','gt','ge','not'); +$GLOBALS['_PEAR_Common_dependency_relations'] = array('has','eq','lt','le','gt','ge','not', 'ne'); /** * Valid file roles @@ -1129,18 +1129,31 @@ if (!empty($d['optional'])) { if (!in_array($d['optional'], array('yes', 'no'))) { $errors[] = "dependency $i: invalid relation optional attribute '$d[optional]', should be one of: yes no"; + } else { + if (($d['rel'] == 'not' || $d['rel'] == 'ne') && $d['optional'] == 'yes') { + $errors[] = "dependency $i: 'not' and 'ne' dependencies cannot be " . + "optional"; + } } } - if ($d['rel'] != 'has' && empty($d['version'])) { + if ($d['rel'] != 'not' && $d['rel'] != 'has' && empty($d['version'])) { $warnings[] = "dependency $i: missing version"; - } elseif ($d['rel'] == 'has' && !empty($d['version'])) { - $warnings[] = "dependency $i: version ignored for `has' dependencies"; + } elseif (($d['rel'] == 'not' || $d['rel'] == 'has') && !empty($d['version'])) { + $warnings[] = "dependency $i: version ignored for `$d[rel]' dependencies"; + } + if ($d['rel'] == 'not' && !empty($d['version'])) { + $warnings[] = "dependency $i: 'not' defines a total conflict, to exclude " . + "specific versions, use 'ne'"; } if ($d['type'] == 'php' && !empty($d['name'])) { $warnings[] = "dependency $i: name ignored for php type dependencies"; } elseif ($d['type'] != 'php' && empty($d['name'])) { $errors[] = "dependency $i: missing name"; } + if ($d['type'] == 'php' && $d['rel'] == 'not') { + $errors[] = "dependency $i: PHP dependencies cannot use 'not' " . + "rel, use 'ne' to exclude versions"; + } $i++; } } http://cvs.php.net/diff.php/php-src/pear/PEAR/Dependency.php?r1=1.36&r2=1.36.4.1&ty=u Index: php-src/pear/PEAR/Dependency.php diff -u php-src/pear/PEAR/Dependency.php:1.36 php-src/pear/PEAR/Dependency.php:1.36.4.1 --- php-src/pear/PEAR/Dependency.php:1.36 Thu Jan 8 12:33:12 2004 +++ php-src/pear/PEAR/Dependency.php Mon Mar 28 11:46:06 2005 @@ -17,7 +17,7 @@ // | Stig Bakken <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Dependency.php,v 1.36 2004/01/08 17:33:12 sniper Exp $ +// $Id: Dependency.php,v 1.36.4.1 2005/03/28 16:46:06 cellog Exp $ require_once "PEAR.php"; @@ -204,7 +204,7 @@ } foreach ($deps as $dep) { if ($dep['type'] == 'pkg' && strcasecmp($dep['name'], $package) == 0) { - if ($dep['rel'] == 'ne') { + if ($dep['rel'] == 'ne' || $dep['rel'] == 'not') { continue; } if (isset($dep['optional']) && $dep['optional'] == 'yes') { @@ -244,7 +244,7 @@ } if (!extension_loaded($name)) { - if ($relation == 'ne') { + if ($relation == 'not') { return false; } if ($opt) { @@ -322,7 +322,8 @@ return false; } if ($relation == 'not') { - $errmsg = "Invalid dependency - 'not' is allowed when specifying PHP, you must run PHP in PHP"; + $errmsg = 'Invalid dependency - "not" is not allowed for php dependencies, ' . + 'php cannot conflict with itself'; return PEAR_DEPENDENCY_BAD_DEPENDENCY; } if (substr($req, 0, 2) == 'v.') { http://cvs.php.net/diff.php/php-src/pear/PEAR/ErrorStack.php?r1=1.7.2.1&r2=1.7.2.2&ty=u Index: php-src/pear/PEAR/ErrorStack.php diff -u php-src/pear/PEAR/ErrorStack.php:1.7.2.1 php-src/pear/PEAR/ErrorStack.php:1.7.2.2 --- php-src/pear/PEAR/ErrorStack.php:1.7.2.1 Mon Oct 25 13:14:33 2004 +++ php-src/pear/PEAR/ErrorStack.php Mon Mar 28 11:46:06 2005 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: ErrorStack.php,v 1.7.2.1 2004/10/25 17:14:33 cellog Exp $ +// $Id: ErrorStack.php,v 1.7.2.2 2005/03/28 16:46:06 cellog Exp $ /** * Error Stack Implementation @@ -122,6 +122,10 @@ * If this is returned, then the error is completely ignored. */ define('PEAR_ERRORSTACK_IGNORE', 4); +/** + * If this is returned, then the error is logged and die() is called. + */ +define('PEAR_ERRORSTACK_DIE', 5); /[EMAIL PROTECTED]/ /** @@ -308,7 +312,11 @@ */ function setDefaultLogger(&$log) { - $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = &$log; + if (is_object($log) && method_exists($log, 'log') ) { + $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = &$log; + } elseif (is_callable($log)) { + $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER'] = &$log; + } } /** @@ -317,7 +325,11 @@ */ function setLogger(&$log) { - $this->_logger = &$log; + if (is_object($log) && method_exists($log, 'log') ) { + $this->_logger = &$log; + } elseif (is_callable($log)) { + $this->_logger = &$log; + } } /** @@ -369,7 +381,7 @@ } /** - * Set an error code => error message mapping callback + * Set a callback that generates context information (location of error) for an error stack * * This method sets the callback that can be used to generate context * information for an error. Passing in NULL will disable context generation @@ -446,10 +458,11 @@ */ function staticPopCallback() { - array_pop($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK']); + $ret = array_pop($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK']); if (!is_array($GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'])) { $GLOBALS['_PEAR_ERRORSTACK_OVERRIDE_CALLBACK'] = array(); } + return $ret; } /** @@ -536,6 +549,7 @@ $err['repackage'] = $repackage; } $push = $log = true; + $die = false; // try the overriding callback first $callback = $this->staticPopCallback(); if ($callback) { @@ -564,6 +578,9 @@ case PEAR_ERRORSTACK_LOG: $push = false; break; + case PEAR_ERRORSTACK_DIE: + $die = true; + break; // anything else returned has the same effect as pushandlog } } @@ -576,6 +593,9 @@ $this->_log($err); } } + if ($die) { + die(); + } if ($this->_compat && $push) { return $this->raiseError($msg, $code, null, null, $err); } @@ -626,7 +646,15 @@ * @param array $levels Error level => Log constant map * @access protected */ - function _log($err, $levels = array( + function _log($err) + { + if ($this->_logger) { + $logger = &$this->_logger; + } else { + $logger = &$GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']; + } + if (is_a($logger, 'Log')) { + $levels = array( 'exception' => PEAR_LOG_CRIT, 'alert' => PEAR_LOG_ALERT, 'critical' => PEAR_LOG_CRIT, @@ -634,17 +662,15 @@ 'warning' => PEAR_LOG_WARNING, 'notice' => PEAR_LOG_NOTICE, 'info' => PEAR_LOG_INFO, - 'debug' => PEAR_LOG_DEBUG)) - { - if (isset($levels[$err['level']])) { - $level = $levels[$err['level']]; - } else { - $level = PEAR_LOG_INFO; - } - if ($this->_logger) { - $this->_logger->log($err['message'], $level, $err); - } else { - $GLOBALS['_PEAR_ERRORSTACK_DEFAULT_LOGGER']->log($err['message'], $level, $err); + 'debug' => PEAR_LOG_DEBUG); + if (isset($levels[$err['level']])) { + $level = $levels[$err['level']]; + } else { + $level = PEAR_LOG_INFO; + } + $logger->log($err['message'], $level, $err); + } else { // support non-standard logs + call_user_func($logger, $err); } } @@ -749,7 +775,8 @@ * @static * @return array */ - function staticGetErrors($purge = false, $level = false, $merge = false, $sortfunc = array('PEAR_ErrorStack', '_sortErrors')) + function staticGetErrors($purge = false, $level = false, $merge = false, + $sortfunc = array('PEAR_ErrorStack', '_sortErrors')) { $ret = array(); if (!is_callable($sortfunc)) { http://cvs.php.net/diff.php/php-src/pear/PEAR/Exception.php?r1=1.4.2.1&r2=1.4.2.2&ty=u Index: php-src/pear/PEAR/Exception.php diff -u php-src/pear/PEAR/Exception.php:1.4.2.1 php-src/pear/PEAR/Exception.php:1.4.2.2 --- php-src/pear/PEAR/Exception.php:1.4.2.1 Mon Oct 25 13:14:33 2004 +++ php-src/pear/PEAR/Exception.php Mon Mar 28 11:46:06 2005 @@ -19,7 +19,7 @@ // | Greg Beaver <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Exception.php,v 1.4.2.1 2004/10/25 17:14:33 cellog Exp $ +// $Id: Exception.php,v 1.4.2.2 2005/03/28 16:46:06 cellog Exp $ /** @@ -90,7 +90,7 @@ * * @since PHP 5 * @package PEAR - * @version $Revision: 1.4.2.1 $ + * @version $Revision: 1.4.2.2 $ * @author Tomas V.V.Cox <[EMAIL PROTECTED]> * @author Hans Lellelid <[EMAIL PROTECTED]> * @author Bertrand Mansion <[EMAIL PROTECTED]> @@ -224,10 +224,16 @@ public function getCauseMessage(&$causes) { $trace = $this->getTraceSafe(); - $causes[] = array('class' => get_class($this), - 'message' => $this->message, - 'file' => $trace[0]['file'], - 'line' => $trace[0]['line']); + $cause = array('class' => get_class($this), + 'message' => $this->message, + 'file' => 'unknown', + 'line' => 'unknown'); + if (isset($trace[0])) { + if (isset($trace[0]['file'])) { + $cause['file'] = $trace[0]['file']; + $cause['line'] = $trace[0]['line']; + } + } if ($this->cause instanceof PEAR_Exception) { $this->cause->getCauseMessage($causes); } http://cvs.php.net/diff.php/php-src/pear/PEAR/Installer.php?r1=1.150.2.1&r2=1.150.2.2&ty=u Index: php-src/pear/PEAR/Installer.php diff -u php-src/pear/PEAR/Installer.php:1.150.2.1 php-src/pear/PEAR/Installer.php:1.150.2.2 --- php-src/pear/PEAR/Installer.php:1.150.2.1 Mon Oct 25 13:14:33 2004 +++ php-src/pear/PEAR/Installer.php Mon Mar 28 11:46:06 2005 @@ -18,7 +18,7 @@ // | Martin Jansen <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Installer.php,v 1.150.2.1 2004/10/25 17:14:33 cellog Exp $ +// $Id: Installer.php,v 1.150.2.2 2005/03/28 16:46:06 cellog Exp $ require_once 'PEAR/Downloader.php'; @@ -797,28 +797,43 @@ $this->log(1, "\nBuild process completed successfully"); foreach ($built as $ext) { $bn = basename($ext['file']); - list($_ext_name, ) = explode('.', $bn); - if (extension_loaded($_ext_name)) { - $this->raiseError("Extension '$_ext_name' already loaded. Please unload it ". - "in your php.ini file prior to install or upgrade it."); - } - // extension dir must be created if it doesn't exist - // patch by Tomas Cox (modified by Greg Beaver) - $ext_dir = $this->config->get('ext_dir'); - if ([EMAIL PROTECTED]($ext_dir) && !System::mkdir(array('-p', $ext_dir))) { - $this->log(3, "+ mkdir -p $ext_dir"); - return $this->raiseError("failed to create extension dir '$ext_dir'"); - } - $dest = $ext_dir . DIRECTORY_SEPARATOR . $bn; - $this->log(1, "Installing '$bn' at ext_dir ($dest)"); - $this->log(3, "+ cp $ext[file] ext_dir ($dest)"); + list($_ext_name, $_ext_suff) = explode('.', $bn); + if ($_ext_suff == '.so' || $_ext_suff == '.dll') { + if (extension_loaded($_ext_name)) { + $this->raiseError("Extension '$_ext_name' already loaded. " . + 'Please unload it in your php.ini file ' . + 'prior to install or upgrade'); + } + $role = 'ext'; + } else { + $role = 'src'; + } + $dest = $ext['dest']; + $this->log(1, "Installing '$ext[file]'"); $copyto = $this->_prependPath($dest, $this->installroot); + $copydir = dirname($copyto); + if ([EMAIL PROTECTED]($copydir)) { + if (!$this->mkDirHier($copydir)) { + return $this->raiseError("failed to mkdir $copydir", + PEAR_INSTALLER_FAILED); + } + $this->log(3, "+ mkdir $copydir"); + } if ([EMAIL PROTECTED]($ext['file'], $copyto)) { - $this->rollbackFileTransaction(); - return $this->raiseError("failed to copy $bn to $copyto"); + return $this->raiseError("failed to write $copyto", PEAR_INSTALLER_FAILED); + } + $this->log(3, "+ cp $ext[file] $copyto"); + if (!OS_WINDOWS) { + $mode = 0666 & ~(int)octdec($this->config->get('umask')); + $this->addFileOperation('chmod', array($mode, $copyto)); + if ([EMAIL PROTECTED]($copyto, $mode)) { + $this->log(0, "failed to change mode of $copyto"); + } } + $this->addFileOperation('rename', array($ext['file'], $copyto)); + $pkginfo['filelist'][$bn] = array( - 'role' => 'ext', + 'role' => $role, 'installed_as' => $dest, 'php_api' => $ext['php_api'], 'zend_mod_api' => $ext['zend_mod_api'], http://cvs.php.net/diff.php/php-src/pear/PEAR/Registry.php?r1=1.50.4.1&r2=1.50.4.2&ty=u Index: php-src/pear/PEAR/Registry.php diff -u php-src/pear/PEAR/Registry.php:1.50.4.1 php-src/pear/PEAR/Registry.php:1.50.4.2 --- php-src/pear/PEAR/Registry.php:1.50.4.1 Mon Oct 25 13:14:33 2004 +++ php-src/pear/PEAR/Registry.php Mon Mar 28 11:46:06 2005 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Registry.php,v 1.50.4.1 2004/10/25 17:14:33 cellog Exp $ +// $Id: Registry.php,v 1.50.4.2 2005/03/28 16:46:06 cellog Exp $ /* TODO: @@ -314,7 +314,9 @@ function _unlock() { $ret = $this->_lock(LOCK_UN); - fclose($this->lock_fp); + if (is_resource($this->lock_fp)) { + fclose($this->lock_fp); + } $this->lock_fp = null; return $ret; } http://cvs.php.net/diff.php/php-src/pear/PEAR/Command/Package.php?r1=1.61.2.1&r2=1.61.2.2&ty=u Index: php-src/pear/PEAR/Command/Package.php diff -u php-src/pear/PEAR/Command/Package.php:1.61.2.1 php-src/pear/PEAR/Command/Package.php:1.61.2.2 --- php-src/pear/PEAR/Command/Package.php:1.61.2.1 Mon Oct 25 13:14:34 2004 +++ php-src/pear/PEAR/Command/Package.php Mon Mar 28 11:46:06 2005 @@ -15,9 +15,10 @@ // +----------------------------------------------------------------------+ // | Authors: Stig Bakken <[EMAIL PROTECTED]> | // | Martin Jansen <[EMAIL PROTECTED]> | +// | Greg Beaver <[EMAIL PROTECTED]> | // +----------------------------------------------------------------------+ // -// $Id: Package.php,v 1.61.2.1 2004/10/25 17:14:34 cellog Exp $ +// $Id: Package.php,v 1.61.2.2 2005/03/28 16:46:06 cellog Exp $ require_once 'PEAR/Common.php'; require_once 'PEAR/Command/Common.php'; @@ -159,7 +160,16 @@ 'recur' => array( 'shortopt' => 'r', 'doc' => 'Run tests in child directories, recursively. 4 dirs deep maximum', - ) + ), + 'ini' => array( + 'shortopt' => 'i', + 'doc' => 'actual string of settings to pass to php in format " -d setting=blah"', + 'arg' => 'SETTINGS' + ), + 'realtimelog' => array( + 'shortopt' => 'l', + 'doc' => 'Log test runs/results as they are run', + ), ), 'doc' => '[testfile|dir ...] Run regression tests with PHP\'s regression testing script (run-tests.php).', @@ -438,6 +448,7 @@ { include_once 'PEAR/RunTest.php'; $log = new PEAR_Common; + $log->ui = &$this->ui; // slightly hacky, but it will work $run = new PEAR_RunTest($log); $tests = array(); if (isset($options['recur'])) { @@ -445,6 +456,9 @@ } else { $depth = 1; } + if (!count($params)) { + $params[] = '.'; + } foreach ($params as $p) { if (is_dir($p)) { $dir = System::find(array($p, '-type', 'f', @@ -452,45 +466,99 @@ '-name', '*.phpt')); $tests = array_merge($tests, $dir); } else { - $tests[] = $p; + if ([EMAIL PROTECTED]($p)) { + if (!preg_match('/\.phpt$/', $p)) { + $p .= '.phpt'; + } + $dir = System::find(array(dirname($p), '-type', 'f', + '-maxdepth', $depth, + '-name', $p)); + $tests = array_merge($tests, $dir); + } else { + $tests[] = $p; + } } } + $ini_settings = ''; + if (isset($options['ini'])) { + $ini_settings .= $options['ini']; + } + if (isset($_ENV['TEST_PHP_INCLUDE_PATH'])) { + $ini_settings .= " -d include_path={$_ENV['TEST_PHP_INCLUDE_PATH']}"; + } + if ($ini_settings) { + $this->ui->outputData('Using INI settings: "' . $ini_settings . '"'); + } + $skipped = $passed = $failed = array(); + $this->ui->outputData('Running ' . count($tests) . ' tests', $command); + $start = time(); + if (isset($options['realtimelog'])) { + @unlink('run-tests.log'); + } foreach ($tests as $t) { - $run->run($t); + if (isset($options['realtimelog'])) { + $fp = @fopen('run-tests.log', 'a'); + if ($fp) { + fwrite($fp, "Running test $t..."); + fclose($fp); + } + } + $result = $run->run($t, $ini_settings); + if (OS_WINDOWS) { + for($i=0;$i<2000;$i++) { + $i = $i; // delay - race conditions on windows + } + } + if (isset($options['realtimelog'])) { + $fp = @fopen('run-tests.log', 'a'); + if ($fp) { + fwrite($fp, "$result\n"); + fclose($fp); + } + } + if ($result == 'FAILED') { + $failed[] = $t; + } + if ($result == 'PASSED') { + $passed[] = $t; + } + if ($result == 'SKIPPED') { + $skipped[] = $t; + } } - - return true; - /* - $cwd = getcwd(); - $php = $this->config->get('php_bin'); - putenv("TEST_PHP_EXECUTABLE=$php"); - // all core PEAR tests use this constant to determine whether they should be run or not - putenv("PHP_PEAR_RUNTESTS=1"); - $ip = ini_get("include_path"); - $ps = OS_WINDOWS ? ';' : ':'; - $run_tests = $rtsts = $this->config->get('php_dir') . DIRECTORY_SEPARATOR . 'run-tests.php'; - if (!file_exists($run_tests)) { - $run_tests = PEAR_INSTALL_DIR . DIRECTORY_SEPARATOR . 'run-tests.php'; - if (!file_exists($run_tests)) { - return $this->raiseError("No run-tests.php file found. Please copy this ". - "file from the sources of your PHP distribution to $rtsts"); - } - } - if (OS_WINDOWS) { - // note, this requires a slightly modified version of run-tests.php - // for some setups - // unofficial download location is in the pear-dev archives - $argv = $params; - array_unshift($argv, $run_tests); - $argc = count($argv); - include $run_tests; - } else { - $plist = implode(' ', $params); - $cmd = "$php -d include_path=$cwd$ps$ip -f $run_tests -- $plist"; - system($cmd); + $total = date('i:s', time() - $start); + if (count($failed)) { + $output = "TOTAL TIME: $total\n"; + $output .= count($passed) . " PASSED TESTS\n"; + $output .= count($skipped) . " SKIPPED TESTS\n"; + $output .= count($failed) . " FAILED TESTS:\n"; + foreach ($failed as $failure) { + $output .= $failure . "\n"; + } + if (isset($options['realtimelog'])) { + $fp = @fopen('run-tests.log', 'a'); + } else { + $fp = @fopen('run-tests.log', 'w'); + } + if ($fp) { + fwrite($fp, $output, strlen($output)); + fclose($fp); + $this->ui->outputData('wrote log to "' . realpath('run-tests.log') . '"', $command); + } + } elseif (@file_exists('run-tests.log') && [EMAIL PROTECTED]('run-tests.log')) { + @unlink('run-tests.log'); + } + $this->ui->outputData('TOTAL TIME: ' . $total); + $this->ui->outputData(count($passed) . ' PASSED TESTS', $command); + $this->ui->outputData(count($skipped) . ' SKIPPED TESTS', $command); + if (count($failed)) { + $this->ui->outputData(count($failed) . ' FAILED TESTS:', $command); + foreach ($failed as $failure) { + $this->ui->outputData($failure, $command); + } } + return true; - */ } // }}} http://cvs.php.net/diff.php/php-src/pear/scripts/pearcmd.php?r1=1.13&r2=1.13.2.1&ty=u Index: php-src/pear/scripts/pearcmd.php diff -u php-src/pear/scripts/pearcmd.php:1.13 php-src/pear/scripts/pearcmd.php:1.13.2.1 --- php-src/pear/scripts/pearcmd.php:1.13 Tue Jun 8 13:49:19 2004 +++ php-src/pear/scripts/pearcmd.php Mon Mar 28 11:46:06 2005 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: pearcmd.php,v 1.13 2004/06/08 17:49:19 cellog Exp $ +// $Id: pearcmd.php,v 1.13.2.1 2005/03/28 16:46:06 cellog Exp $ ob_end_clean(); /** @@ -29,7 +29,7 @@ } ini_set('allow_url_fopen', true); if (!ini_get('safe_mode')) { - set_time_limit(0); + @set_time_limit(0); } ob_implicit_flush(true); ini_set('track_errors', true); @@ -75,6 +75,11 @@ PEAR_Command::setFrontendType($fetype); $ui = &PEAR_Command::getFrontendObject(); PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError")); +if (ini_get('safe_mode')) { + $ui->outputData('WARNING: running in safe mode requires that all files created ' . + 'be the same uid as the current script. PHP reports this script is uid: ' . + @getmyuid() . ', and current user is: ' . @get_current_user()); +} $pear_user_config = ''; $pear_system_config = ''; @@ -212,9 +217,6 @@ $put = cmdHelp($helpsubject); } else { $put = - "Usage: $progname [options] command [command-options] <parameters>\n". - "Type \"$progname help options\" to list all options.\n". - "Type \"$progname help <command>\" to get the help for the specified command.\n". "Commands:\n"; $maxlen = max(array_map("strlen", $all_commands)); $formatstr = "%-{$maxlen}s %s\n"; @@ -222,6 +224,11 @@ foreach ($all_commands as $cmd => $class) { $put .= sprintf($formatstr, $cmd, PEAR_Command::getDescription($cmd)); } + $put .= + "Usage: $progname [options] command [command-options] <parameters>\n". + "Type \"$progname help options\" to list all options.\n". + "Type \"$progname help shortcuts\" to list all command shortcuts.\n". + "Type \"$progname help <command>\" to get the help for the specified command."; } fputs($stderr, "$put\n"); fclose($stderr);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php