cvs: php4 /pear package-PEAR.xml /pear/PEAR Builder.php /pear/PEAR/Command Build.php

From: Date: Tue, 28 May 2002 01:01:43 +0000
Subject: cvs: php4 /pear package-PEAR.xml /pear/PEAR Builder.php /pear/PEAR/Command Build.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4180@lists.php.net to get a copy of this message
ssb Mon May 27 21:01:43 2002 EDT Added files: /php4/pear/PEAR Builder.php Modified files: /php4/pear package-PEAR.xml /php4/pear/PEAR/Command Build.php Log: * update 0.11 release notes * move build logic into PEAR_Builder Index: php4/pear/package-PEAR.xml diff -u php4/pear/package-PEAR.xml:1.10 php4/pear/package-PEAR.xml:1.11 --- php4/pear/package-PEAR.xml:1.10 Mon May 27 08:45:03 2002 +++ php4/pear/package-PEAR.xml Mon May 27 21:01:41 2002 @@ -35,11 +35,13 @@ <state>beta</state> <date>YYYY-MM-DD</date> <notes> -* 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 </notes> <filelist> <file role="data" name="package.dtd"/> @@ -65,6 +67,7 @@ <file role="php" name="CLI.php"/> <file role="php" name="Gtk.php"/> </dir> + <file role="php" name="Builder.php"/> <file role="php" name="Installer.php"/> <file role="php" name="Packager.php"/> <file role="php" name="Registry.php"/> Index: php4/pear/PEAR/Command/Build.php diff -u php4/pear/PEAR/Command/Build.php:1.1 php4/pear/PEAR/Command/Build.php:1.2 --- php4/pear/PEAR/Command/Build.php:1.1 Sun May 26 21:20:10 2002 +++ php4/pear/PEAR/Command/Build.php Mon May 27 21:01:43 2002 @@ -18,9 +18,10 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Build.php,v 1.1 2002/05/27 01:20:10 ssb Exp $ +// $Id: Build.php,v 1.2 2002/05/28 01:01:43 ssb Exp $ require_once "PEAR/Command/Common.php"; +require_once "PEAR/Builder.php"; /** * PEAR commands for building extensions. @@ -54,49 +55,20 @@ 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); - } } Index: php4/pear/PEAR/Builder.php +++ php4/pear/PEAR/Builder.php <?php // // +----------------------------------------------------------------------+ // | PHP Version 4 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2002 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.02 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Stig Sæther Bakken <ssb@fast.no> | // +----------------------------------------------------------------------+ // // $Id: Builder.php,v 1.1 2002/05/28 01:01:42 ssb Exp $ require_once 'PEAR/Common.php'; /** * Class to handle building (compiling) extensions. * * @author Stig Sæther Bakken <ssb@fast.no> */ 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; } } ?>

« previous php.pear.cvs (#4180) next »