wez Wed Sep 22 15:04:56 2004 EDT
Modified files:
/php-src/pear/PEAR Builder.php Installer.php
Log:
fix for pecl modules; runs "make install" and correctly adds the files to the
transaction and package.
(as far as I know).
http://cvs.php.net/diff.php/php-src/pear/PEAR/Builder.php?r1=1.16&r2=1.17&ty=u
Index: php-src/pear/PEAR/Builder.php
diff -u php-src/pear/PEAR/Builder.php:1.16 php-src/pear/PEAR/Builder.php:1.17
--- php-src/pear/PEAR/Builder.php:1.16 Tue Jun 8 14:15:11 2004
+++ php-src/pear/PEAR/Builder.php Wed Sep 22 15:04:56 2004
@@ -16,7 +16,7 @@
// | Authors: Stig S�ther Bakken <[EMAIL PROTECTED]> |
// +----------------------------------------------------------------------+
//
-// $Id: Builder.php,v 1.16 2004/06/08 18:15:11 cellog Exp $
+// $Id: Builder.php,v 1.17 2004/09/22 19:04:56 wez Exp $
require_once 'PEAR/Common.php';
@@ -152,6 +152,40 @@
// {{{ 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 @@
}
$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 @@
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,7 @@
$to_run = array(
$configure_command,
$make_command,
+ "$make_command INSTALL_ROOT=$inst_dir install"
);
if ([EMAIL PROTECTED]($build_dir)) {
return $this->raiseError("could not chdir to $build_dir");
@@ -267,26 +309,9 @@
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;
}
http://cvs.php.net/diff.php/php-src/pear/PEAR/Installer.php?r1=1.150&r2=1.151&ty=u
Index: php-src/pear/PEAR/Installer.php
diff -u php-src/pear/PEAR/Installer.php:1.150 php-src/pear/PEAR/Installer.php:1.151
--- php-src/pear/PEAR/Installer.php:1.150 Sat Jun 12 01:48:10 2004
+++ php-src/pear/PEAR/Installer.php Wed Sep 22 15:04:56 2004
@@ -18,7 +18,7 @@
// | Martin Jansen <[EMAIL PROTECTED]> |
// +----------------------------------------------------------------------+
//
-// $Id: Installer.php,v 1.150 2004/06/12 05:48:10 cellog Exp $
+// $Id: Installer.php,v 1.151 2004/09/22 19:04:56 wez Exp $
require_once 'PEAR/Downloader.php';
@@ -790,30 +790,46 @@
$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)");
- $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 ([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 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'],
);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php