From ecf93ec1fdb351e533b1e193822622782318794e Mon Sep 17 00:00:00 2001 From: Stig Bakken Date: Tue, 28 May 2002 01:01:43 +0000 Subject: * update 0.11 release notes * move build logic into PEAR_Builder --- pear/PEAR/Builder.php | 106 ++++++++++++++++++++++++++++++++++++++++++++ pear/PEAR/Command/Build.php | 48 +++++--------------- pear/package-PEAR.xml | 5 ++- 3 files changed, 120 insertions(+), 39 deletions(-) create mode 100644 pear/PEAR/Builder.php diff --git a/pear/PEAR/Builder.php b/pear/PEAR/Builder.php new file mode 100644 index 0000000000..8cf44b5f6d --- /dev/null +++ b/pear/PEAR/Builder.php @@ -0,0 +1,106 @@ + | +// +----------------------------------------------------------------------+ +// +// $Id$ + +require_once 'PEAR/Common.php'; + +/** + * Class to handle building (compiling) extensions. + * + * @author Stig Sæther Bakken + */ +class PEAR_Builder extends PEAR_Common +{ + // {{{ properties + + // }}} + + // {{{ constructor + + /** + * PEAR_Builder constructor. + * + * @param object $ui user interface object (instance of PEAR_Frontend_*) + * + * @access public + */ + function PEAR_Builder(&$ui) + { + $this->PEAR_Common(); + $this->setFrontendObject($ui); + } + + function build($descfile, $callback = null) + { + if (PEAR::isError($info = $this->infoFromDescriptionFile($descfile))) { + return $info; + } + $configure_command = "./configure"; + if (isset($info['configure_options'])) { + foreach ($info['configure_options'] as $o) { + $r = $this->ui->userDialog($o['prompt'], 'text', @$o['default']); + if (substr($o['name'], 0, 5) == 'with-' && + ($r == 'yes' || $r == 'autodetect')) { + $configure_command .= " --$o[name]"; + } else { + $configure_command .= " --$o[name]=$r"; + } + } + } + if (isset($_ENV['MAKE'])) { + $make_command = $_ENV['MAKE']; + } else { + $make_command = 'make'; + } + $to_run = array( + "phpize", + $configure_command, + $make_command, + ); + foreach ($to_run as $cmd) { + $err = $this->_runCommand($cmd, $callback); + if (PEAR::isError($err)) { + return $err; + } + if (!$err) { + break; + } + } + return true; + + } + + // }}} + + + function _runCommand($command, $callback = null) + { + $pp = @popen($command, "r"); + if (!$pp) { + return $this->raiseError("failed to run `$command'"); + } + while ($line = fgets($pp, 1024)) { + call_user_func($callback, 'output', $line); + } + pclose($pp); + return true; + } +} + +?> diff --git a/pear/PEAR/Command/Build.php b/pear/PEAR/Command/Build.php index 6a661eb9f4..ee03d09201 100644 --- a/pear/PEAR/Command/Build.php +++ b/pear/PEAR/Command/Build.php @@ -21,6 +21,7 @@ // $Id$ require_once "PEAR/Command/Common.php"; +require_once "PEAR/Builder.php"; /** * PEAR commands for building extensions. @@ -54,49 +55,20 @@ Builds one or more extensions contained in a package.' if (sizeof($params) < 1) { $params[0] = 'package.xml'; } - $obj = &new PEAR_Common(); - if (PEAR::isError($info = $obj->infoFromAny($params[0]))) { - return $info; - } - $configure_command = "./configure"; - if (isset($info['configure_options'])) { - foreach ($info['configure_options'] as $o) { - $r = $this->ui->userDialog($o['prompt'], 'text', @$o['default']); - if ($r == 'yes' && substr($o['name'], 0, 5) == 'with-') { - $configure_command .= " --$o[name]"; - } else { - $configure_command .= " --$o[name]=$r"; - } - } - } - if (isset($_ENV['MAKE'])) { - $make_command = $_ENV['MAKE']; - } else { - $make_command = 'make'; - } - $to_run = array( - "phpize", - $configure_command, - $make_command, - ); - foreach ($to_run as $cmd) { - if (PEAR::isError($err = $this->_runCommand($cmd))) { - return $err; - } + $builder = &new PEAR_Builder($this->ui); + $err = $builder->build($params[0], array(&$this, 'buildCallback')); + if (PEAR::isError($err)) { + return $err; } return true; } - function _runCommand($command) + function buildCallback($what, $data) { - $pp = @popen($command, "r"); - if (!$pp) { - return $this->raiseError("failed to run `$command'"); - } - while ($line = fgets($pp, 1024)) { - $this->ui->displayLine(rtrim($line)); + switch ($what) { + case 'output': + $this->ui->displayLine(rtrim($data)); + break; } - pclose($pp); - } } diff --git a/pear/package-PEAR.xml b/pear/package-PEAR.xml index a049d6895b..ae5a41ca55 100644 --- a/pear/package-PEAR.xml +++ b/pear/package-PEAR.xml @@ -35,11 +35,13 @@ beta YYYY-MM-DD -* fixed broken "help" command +* fix: "help" command was broken * new command: "info" * new command: "config-help" * un-indent multi-line data from xml description files * new command: "build" +* fix: config-set did not work with "set" parameters +* disable magic_quotes_runtime @@ -65,6 +67,7 @@ + -- cgit v1.2.1