Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.15

Bug #3505 pecl can't install PDO
Submitted: 2005-02-17 16:05 UTC
From: cellog Assigned: cellog
Status: Closed Package: PEAR
PHP Version: Irrelevant OS: linux
Roadmaps: (Not assigned)    
Subscription  


 [2005-02-17 16:05 UTC] cellog
Description: ------------ pear needs to run make install. Patch by Wez Furlong: ? .Builder.php.swp ? .Installer.php.swp Index: Builder.php =================================================================== RCS file: /repository/php-src/pear/PEAR/Builder.php,v retrieving revision 1.16 diff -u -p -r1.16 Builder.php --- Builder.php 8 Jun 2004 18:15:11 -0000 1.16 +++ Builder.php 20 Sep 2004 15:06:00 -0000 @@ -152,6 +152,40 @@ class PEAR_Builder extends PEAR_Common // {{{ build() + function _harvest_inst_dir($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->_harvest_inst_dir( + $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 an extension from source. Runs "phpize" in the source * directory, but compiles in a temporary directory @@ -231,6 +265,7 @@ class PEAR_Builder extends PEAR_Common } $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"); @@ -238,7 +273,13 @@ class PEAR_Builder extends PEAR_Common if (!System::mkDir("-p $build_dir")) { return $this->raiseError("could not create build dir: $build_dir"); } + $this->addTempFile($build_dir); + if (!System::mkDir("-p $inst_dir")) { + return $this->raiseError("could not create install dir: $inst_dir"); + } + $this->addTempFile($inst_dir); + if (getenv('MAKE')) { $make_command = getenv('MAKE'); } else { @@ -247,6 +288,8 @@ class PEAR_Builder extends PEAR_Common $to_run = array( $configure_command, $make_command, + "$make_command INSTALL_ROOT=$inst_dir install", + "find $inst_dir -ls" ); if (!@chdir($build_dir)) { return $this->raiseError("could not chdir to $build_dir"); @@ -267,26 +310,9 @@ class PEAR_Builder extends PEAR_Common 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->_harvest_inst_dir($prefix, $inst_dir . DIRECTORY_SEPARATOR . $prefix, $built_files); + print_r($built_files); chdir($old_cwd); return $built_files; } Index: Installer.php =================================================================== RCS file: /repository/php-src/pear/PEAR/Installer.php,v retrieving revision 1.150 diff -u -p -r1.150 Installer.php --- Installer.php 12 Jun 2004 05:48:10 -0000 1.150 +++ Installer.php 20 Sep 2004 15:06:01 -0000 @@ -790,30 +790,46 @@ class PEAR_Installer extends PEAR_Downlo $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 (!@is_dir($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)"); - $copyto = $this->_prependPath($dest, $this->installroot); + list($_ext_name, $_ext_suff) = explode('.', $bn); + + if ($_ext_suff == '.so' || $_ext_suff == '.dll' /* || something more portable */) { + /* it is an extension */ + if (extension_loaded($_ext_name)) { + $this->raiseError( + "Extension '$_ext_name' already loaded. Please unload it ". + "from your php.ini file prior to install or upgrade it."); + } + $role = 'ext'; + } else { + $role = 'src'; + } + + $this->log(1, "Installing $ext[file]\n"); + $copyto = $this->_prependPath($ext['dest'], $this->installroot); + $copydir = dirname($copyto); + if (!@is_dir($copydir)) { + if (!$this->mkDirHier($copydir)) { + return $this->raiseError("failed to mkdir $copydir", PEAR_INSTALLER_FAILED); + } + $this->log(3, "+ mkdir $copydir"); + } if (!@copy($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 (!@chmod($copyto, $mode)) { + $this->log(0, "failed to chamge mode of $copyto"); + } } + $this->addFileOperation('rename', array($ext['file'], $copyto)); + $pkginfo['filelist'][$bn] = array( - 'role' => 'ext', - 'installed_as' => $dest, - 'php_api' => $ext['php_api'], + 'role' => $role, + 'installed_as' => $ext['dest'], + 'php_api' => $ext['php_api'], 'zend_mod_api' => $ext['zend_mod_api'], 'zend_ext_api' => $ext['zend_ext_api'], );

Comments

 [2005-02-17 17:48 UTC] cellog
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. modified patch slightly to support spaces in pathnames