cvs: php4 /pear Makefile.in /pear/scripts .cvsignore pear-get.in pear.in
| From: | Stig Bakken | Date: | Wed, 02 Jan 2002 17:11:34 +0000 |
| Subject: | cvs: php4 /pear Makefile.in /pear/scripts .cvsignore pear-get.in pear.in | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1792@lists.php.net to get a copy of this message | ||
ssb Wed Jan 2 12:11:34 2002 EDT
Added files:
/php4/pear/scripts pear-get.in
Modified files:
/php4/pear Makefile.in
/php4/pear/scripts .cvsignore pear.in
Log:
* start splitting "pear" command into "pear" and "pear-get"
Index: php4/pear/Makefile.in diff -u php4/pear/Makefile.in:1.96 php4/pear/Makefile.in:1.97 --- php4/pear/Makefile.in:1.96 Fri Dec 28 21:12:02 2001 +++ php4/pear/Makefile.in Wed Jan 2 12:11:34 2002 @@ -147,7 +147,7 @@ dynlib.m4 \ acinclude.m4 -bin_SCRIPTS = phpize php-config pear pearize phptar +bin_SCRIPTS = phpize php-config pear pear-get pearize phptar install-build: @echo "Installing build environment" @@ -192,6 +192,9 @@ scripts/pear: scripts/pear.in $(top_builddir)/config.status (cd ..;CONFIG_FILES=pear/scripts/pear CONFIG_HEADERS= $(top_builddir)/config.status) + +scripts/pear-get: scripts/pear-get.in $(top_builddir)/config.status + (cd ..;CONFIG_FILES=pear/scripts/pear-get CONFIG_HEADERS= $(top_builddir)/config.status) scripts/phpize: scripts/phpize.in $(top_builddir)/config.status (cd ..;CONFIG_FILES=pear/scripts/phpize CONFIG_HEADERS= $(top_builddir)/config.status) Index: php4/pear/scripts/.cvsignore diff -u php4/pear/scripts/.cvsignore:1.3 php4/pear/scripts/.cvsignore:1.4 --- php4/pear/scripts/.cvsignore:1.3 Sun Aug 19 14:46:55 2001 +++ php4/pear/scripts/.cvsignore Wed Jan 2 12:11:34 2002 @@ -6,3 +6,4 @@ pear pearize phptar +pear-get Index: php4/pear/scripts/pear.in diff -u php4/pear/scripts/pear.in:1.25 php4/pear/scripts/pear.in:1.26 --- php4/pear/scripts/pear.in:1.25 Tue Dec 25 23:00:30 2001 +++ php4/pear/scripts/pear.in Wed Jan 2 12:11:34 2002 @@ -52,6 +52,7 @@ PEAR::setErrorHandling(PEAR_ERROR_PRINT, "pear: %s\n"); // {{{ config file and option parsing + $options = Console_Getopt::getopt($argv, "c:C:d:D:h?sSqu:v"); if (PEAR::isError($options)) { usage($options); @@ -168,7 +169,6 @@ $cmdargs = $rest; } - // }}} switch ($command) { @@ -288,14 +288,14 @@ } // }}} - // {{{ list-available + // {{{ remote-list - case 'list-available': { + case 'remote-list': { $remote = new PEAR_Remote($config); $result = $remote->call('package.listAll'); $i = $j = 0; heading("Available packages"); - foreach ($result as $package) { + foreach ($result as $package => $info) { if ($i++ % 20 == 0) { if ($j++ > 0) { print "\n"; @@ -304,10 +304,12 @@ "Package", "Stable", "Lead", "Category"); print str_repeat("-", 75)."\n"; } - $stable = $package['stable']; - printf("%-20s %-10s %-15s %s\n", $package['name'], - $stable ? $stable : "???", - $package['lead'], $package['category']); + if (empty($info['stable'])) { + $info['stable'] = '(none)'; + } + $stable = (string)$info['stable']; + printf("%-20s %-10s %-15s %s\n", $package, + $info['stable'], $info['lead'], $info['category']); } break; } @@ -332,6 +334,17 @@ } // }}} + // {{{ upload-release + + case 'upload-release': { + if (sizeof($cmdargs) < 1) { + + } + $tarball = $cmdargs[0]; + + } + + // }}} default: { if (!$store_default_config && !$store_user_config) { usage(); @@ -360,7 +373,7 @@ " -d foo=bar set user config variable `foo' to `bar'\n". " -D foo=bar set system config variable `foo' to `bar'\n". " -s store user configuration\n". - " -s store system configuration\n". + " -S store system configuration\n". " -u foo unset `foo' in the user configuration\n". " -h, -? display help/usage (this message)\n". "Commands:\n". @@ -369,9 +382,10 @@ " uninstall [-r] <package name>\n". " package [package info file]\n". " list-installed\n". - " list-available\n". + " remote-list\n". " info\n". " show-config\n". + " upload-release\n". "\n"); fclose($stderr); exit; Index: php4/pear/scripts/pear-get.in +++ php4/pear/scripts/pear-get.in #!@prefix@/bin/php -Cq <?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 Bakken <ssb@fast.no> | // | Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // /* command structure: * list available packages * list not-installed packages * list upgrades * list packages (by author/category/state) * installation commands: ** install latest stable ** install specific release * package generation commands: */ require_once 'PEAR.php'; require_once 'PEAR/Common.php'; require_once 'PEAR/Config.php'; require_once 'PEAR/Remote.php'; require_once 'PEAR/Registry.php'; require_once 'Console/Getopt.php'; error_reporting(E_ALL & ~E_NOTICE); PEAR::setErrorHandling(PEAR_ERROR_PRINT, "pear: %s\n"); // {{{ config file and option parsing $options = Console_Getopt::getopt($argv, "c:C:d:D:h?qu:v"); if (PEAR::isError($options)) { usage($options); } if (OS_WINDOWS) { $pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pearsys.ini'; $pear_user_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.ini'; } else { $pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.conf'; $pear_user_config = getenv('HOME').DIRECTORY_SEPARATOR.'.pearrc'; } $opts = $options[0]; foreach ($opts as $opt) { switch ($opt[0]) { case 'c': $pear_user_config = $opt[1]; break; case 'C': $pear_default_config = $opt[1]; break; } } $config = new PEAR_Config($pear_user_config, $pear_default_config); $verbose = 1; foreach ($opts as $opt) { $param = $opt[1]; switch ($opt[0]) { case 'd': list($key, $value) = explode('=', $param); $config->set($key, $value); break; case 'D': list($key, $value) = explode('=', $param); $config->set($key, $value, true); break; case 'u': $config->toDefault($param); break; case 'v': $verbose++; break; case 'q': $verbose--; break; } } $fallback_config = array( 'master_server' => 'pear.php.net', 'php_dir' => PEAR_INSTALL_DIR, 'ext_dir' => PEAR_EXTENSION_DIR, 'doc_dir' => '', 'verbose' => true, ); $fallback_done = array(); foreach ($fallback_config as $key => $value) { if (!$config->isDefined($key)) { $config->set($key, $value); $fallback_done[$key] = true; } } //$verbose = $config->get("verbose"); $script_dir = $config->get("php_dir"); $ext_dir = $config->get("ext_dir"); $doc_dir = $config->get("doc_dir"); $command = (isset($options[1][1])) ? $options[1][1] : null; $rest = array_slice($options[1], 2); $command_options = array( "install" => "fr", "uninstall" => "fr", "upgrade" => "fr", ); if (isset($command_options[$command])) { $tmp = Console_Getopt::getopt($rest, $command_options[$command]); if (PEAR::isError($tmp)) { usage($tmp); } $cmdopts = $tmp[0]; $cmdargs = $tmp[1]; } else { $cmdopts = array(); $cmdargs = $rest; } // }}} switch ($command) { // {{{ install, upgrade case 'install': case 'upgrade': { include_once 'PEAR/Installer.php'; $pkgfile = $cmdargs[0]; $installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir); $installer->setErrorHandling(PEAR_ERROR_DIE, basename($pkgfile) . ": %s\n"); $installer->debug = $verbose; $install_options = array(); if ($command == 'upgrade') { $install_options['upgrade'] = true; } foreach ($cmdopts as $opt) { switch ($opt[0]) { case 'r': // This option is for use by rpm and other package // tools that can install files etc. by itself, but // still needs to register the package as installed in // PEAR's local registry. $install_options['register_only'] = true; break; case 'f': $install_options['force'] = true; break; } } if ($installer->install($pkgfile, $install_options, $config)) { print "install ok\n"; } else { print "install failed\n"; } break; } // }}} // {{{ uninstall case 'uninstall': { include_once 'PEAR/Installer.php'; $pkgfile = $cmdargs[0]; $installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir); $installer->setErrorHandling(PEAR_ERROR_DIE, basename($pkgfile) . ": %s\n"); $installer->debug = $verbose; $uninstall_options = array(); foreach ($cmdopts as $opt) { switch ($opt[0]) { case 'r': $uninstall_options['register_only'] = true; break; case 'f': $uninstall_options['force'] = true; break; } } if ($installer->uninstall($pkgfile, $uninstall_options)) { print "uninstall ok\n"; } else { print "uninstall failed\n"; } break; } // }}} // {{{ list case 'list': { $remote = new PEAR_Remote($config); $result = $remote->call('package.listAll'); $i = $j = 0; heading("Available packages"); foreach ($result as $package => $info) { if ($i++ % 20 == 0) { if ($j++ > 0) { print "\n"; } printf("%-20s %-10s %-15s %s\n", "Package", "Stable", "Lead", "Category"); print str_repeat("-", 75)."\n"; } if (empty($info['stable'])) { $info['stable'] = '(none)'; } $stable = (string)$info['stable']; printf("%-20s %-10s %-15s %s\n", $package, $info['stable'], $info['lead'], $info['category']); } break; } // }}} default: { if (!$store_default_config && !$store_user_config) { usage(); } break; } } // {{{ usage() function usage($error = null) { $stderr = fopen('php://stderr', 'w'); if (PEAR::isError($error)) { fputs($stderr, $error->getMessage()); } elseif ($error !== null) { fputs($stderr, $error); } fputs($stderr, "Usage: pear-get [options] command [command-options] <parameters>\n". "Options:\n". " -v increase verbosity level (default 1)\n". " -q be quiet, decrease verbosity level\n". " -c file find user configuration in `file'\n". " -C file find system configuration in `file'\n". " -d foo=bar set user config variable `foo' to `bar'\n". " -D foo=bar set system config variable `foo' to `bar'\n". " -u foo unset `foo' in the user configuration\n". " -h, -? display help/usage (this message)\n". "Commands:\n". " help [command]\n". " install [-r] <package file>\n". " uninstall [-r] <package name>\n". " list\n". " info\n". "\n"); fclose($stderr); exit; } // }}} // {{{ present_array() function present_array(&$arr, $keys = null) { if ($keys === null) { $keys = array_keys($arr); } $longest_key = max(array_map("strlen", array_keys($arr))) + 2; $format_string = "%{$longest_key}s : %s\n"; foreach ($keys as $k) { if (is_array($arr[$k])) { foreach ($arr[$k] as $i => $value) { $x = "$k #$i"; $cont = array(); foreach(array_keys($value) as $val) { $cont[] = "$val=" . $value[$val]; } $v = implode(", ", $cont); printf($format_string, $x, $v); } continue; } else { $v = $arr[$k]; printf($format_string, $k, $v); } } } // }}} // {{{ heading() function heading($text) { $l = strlen(trim($text)); print rtrim($text) . "\n" . str_repeat("=", $l) . "\n"; } // }}} /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: nil * End: */ ?>
Index: php4/pear/Makefile.in diff -u php4/pear/Makefile.in:1.96 php4/pear/Makefile.in:1.97 --- php4/pear/Makefile.in:1.96 Fri Dec 28 21:12:02 2001 +++ php4/pear/Makefile.in Wed Jan 2 12:11:34 2002 @@ -147,7 +147,7 @@ dynlib.m4 \ acinclude.m4 -bin_SCRIPTS = phpize php-config pear pearize phptar +bin_SCRIPTS = phpize php-config pear pear-get pearize phptar install-build: @echo "Installing build environment" @@ -192,6 +192,9 @@ scripts/pear: scripts/pear.in $(top_builddir)/config.status (cd ..;CONFIG_FILES=pear/scripts/pear CONFIG_HEADERS= $(top_builddir)/config.status) + +scripts/pear-get: scripts/pear-get.in $(top_builddir)/config.status + (cd ..;CONFIG_FILES=pear/scripts/pear-get CONFIG_HEADERS= $(top_builddir)/config.status) scripts/phpize: scripts/phpize.in $(top_builddir)/config.status (cd ..;CONFIG_FILES=pear/scripts/phpize CONFIG_HEADERS= $(top_builddir)/config.status) Index: php4/pear/scripts/.cvsignore diff -u php4/pear/scripts/.cvsignore:1.3 php4/pear/scripts/.cvsignore:1.4 --- php4/pear/scripts/.cvsignore:1.3 Sun Aug 19 14:46:55 2001 +++ php4/pear/scripts/.cvsignore Wed Jan 2 12:11:34 2002 @@ -6,3 +6,4 @@ pear pearize phptar +pear-get Index: php4/pear/scripts/pear.in diff -u php4/pear/scripts/pear.in:1.25 php4/pear/scripts/pear.in:1.26 --- php4/pear/scripts/pear.in:1.25 Tue Dec 25 23:00:30 2001 +++ php4/pear/scripts/pear.in Wed Jan 2 12:11:34 2002 @@ -52,6 +52,7 @@ PEAR::setErrorHandling(PEAR_ERROR_PRINT, "pear: %s\n"); // {{{ config file and option parsing + $options = Console_Getopt::getopt($argv, "c:C:d:D:h?sSqu:v"); if (PEAR::isError($options)) { usage($options); @@ -168,7 +169,6 @@ $cmdargs = $rest; } - // }}} switch ($command) { @@ -288,14 +288,14 @@ } // }}} - // {{{ list-available + // {{{ remote-list - case 'list-available': { + case 'remote-list': { $remote = new PEAR_Remote($config); $result = $remote->call('package.listAll'); $i = $j = 0; heading("Available packages"); - foreach ($result as $package) { + foreach ($result as $package => $info) { if ($i++ % 20 == 0) { if ($j++ > 0) { print "\n"; @@ -304,10 +304,12 @@ "Package", "Stable", "Lead", "Category"); print str_repeat("-", 75)."\n"; } - $stable = $package['stable']; - printf("%-20s %-10s %-15s %s\n", $package['name'], - $stable ? $stable : "???", - $package['lead'], $package['category']); + if (empty($info['stable'])) { + $info['stable'] = '(none)'; + } + $stable = (string)$info['stable']; + printf("%-20s %-10s %-15s %s\n", $package, + $info['stable'], $info['lead'], $info['category']); } break; } @@ -332,6 +334,17 @@ } // }}} + // {{{ upload-release + + case 'upload-release': { + if (sizeof($cmdargs) < 1) { + + } + $tarball = $cmdargs[0]; + + } + + // }}} default: { if (!$store_default_config && !$store_user_config) { usage(); @@ -360,7 +373,7 @@ " -d foo=bar set user config variable `foo' to `bar'\n". " -D foo=bar set system config variable `foo' to `bar'\n". " -s store user configuration\n". - " -s store system configuration\n". + " -S store system configuration\n". " -u foo unset `foo' in the user configuration\n". " -h, -? display help/usage (this message)\n". "Commands:\n". @@ -369,9 +382,10 @@ " uninstall [-r] <package name>\n". " package [package info file]\n". " list-installed\n". - " list-available\n". + " remote-list\n". " info\n". " show-config\n". + " upload-release\n". "\n"); fclose($stderr); exit; Index: php4/pear/scripts/pear-get.in +++ php4/pear/scripts/pear-get.in #!@prefix@/bin/php -Cq <?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 Bakken <ssb@fast.no> | // | Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // /* command structure: * list available packages * list not-installed packages * list upgrades * list packages (by author/category/state) * installation commands: ** install latest stable ** install specific release * package generation commands: */ require_once 'PEAR.php'; require_once 'PEAR/Common.php'; require_once 'PEAR/Config.php'; require_once 'PEAR/Remote.php'; require_once 'PEAR/Registry.php'; require_once 'Console/Getopt.php'; error_reporting(E_ALL & ~E_NOTICE); PEAR::setErrorHandling(PEAR_ERROR_PRINT, "pear: %s\n"); // {{{ config file and option parsing $options = Console_Getopt::getopt($argv, "c:C:d:D:h?qu:v"); if (PEAR::isError($options)) { usage($options); } if (OS_WINDOWS) { $pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pearsys.ini'; $pear_user_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.ini'; } else { $pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.conf'; $pear_user_config = getenv('HOME').DIRECTORY_SEPARATOR.'.pearrc'; } $opts = $options[0]; foreach ($opts as $opt) { switch ($opt[0]) { case 'c': $pear_user_config = $opt[1]; break; case 'C': $pear_default_config = $opt[1]; break; } } $config = new PEAR_Config($pear_user_config, $pear_default_config); $verbose = 1; foreach ($opts as $opt) { $param = $opt[1]; switch ($opt[0]) { case 'd': list($key, $value) = explode('=', $param); $config->set($key, $value); break; case 'D': list($key, $value) = explode('=', $param); $config->set($key, $value, true); break; case 'u': $config->toDefault($param); break; case 'v': $verbose++; break; case 'q': $verbose--; break; } } $fallback_config = array( 'master_server' => 'pear.php.net', 'php_dir' => PEAR_INSTALL_DIR, 'ext_dir' => PEAR_EXTENSION_DIR, 'doc_dir' => '', 'verbose' => true, ); $fallback_done = array(); foreach ($fallback_config as $key => $value) { if (!$config->isDefined($key)) { $config->set($key, $value); $fallback_done[$key] = true; } } //$verbose = $config->get("verbose"); $script_dir = $config->get("php_dir"); $ext_dir = $config->get("ext_dir"); $doc_dir = $config->get("doc_dir"); $command = (isset($options[1][1])) ? $options[1][1] : null; $rest = array_slice($options[1], 2); $command_options = array( "install" => "fr", "uninstall" => "fr", "upgrade" => "fr", ); if (isset($command_options[$command])) { $tmp = Console_Getopt::getopt($rest, $command_options[$command]); if (PEAR::isError($tmp)) { usage($tmp); } $cmdopts = $tmp[0]; $cmdargs = $tmp[1]; } else { $cmdopts = array(); $cmdargs = $rest; } // }}} switch ($command) { // {{{ install, upgrade case 'install': case 'upgrade': { include_once 'PEAR/Installer.php'; $pkgfile = $cmdargs[0]; $installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir); $installer->setErrorHandling(PEAR_ERROR_DIE, basename($pkgfile) . ": %s\n"); $installer->debug = $verbose; $install_options = array(); if ($command == 'upgrade') { $install_options['upgrade'] = true; } foreach ($cmdopts as $opt) { switch ($opt[0]) { case 'r': // This option is for use by rpm and other package // tools that can install files etc. by itself, but // still needs to register the package as installed in // PEAR's local registry. $install_options['register_only'] = true; break; case 'f': $install_options['force'] = true; break; } } if ($installer->install($pkgfile, $install_options, $config)) { print "install ok\n"; } else { print "install failed\n"; } break; } // }}} // {{{ uninstall case 'uninstall': { include_once 'PEAR/Installer.php'; $pkgfile = $cmdargs[0]; $installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir); $installer->setErrorHandling(PEAR_ERROR_DIE, basename($pkgfile) . ": %s\n"); $installer->debug = $verbose; $uninstall_options = array(); foreach ($cmdopts as $opt) { switch ($opt[0]) { case 'r': $uninstall_options['register_only'] = true; break; case 'f': $uninstall_options['force'] = true; break; } } if ($installer->uninstall($pkgfile, $uninstall_options)) { print "uninstall ok\n"; } else { print "uninstall failed\n"; } break; } // }}} // {{{ list case 'list': { $remote = new PEAR_Remote($config); $result = $remote->call('package.listAll'); $i = $j = 0; heading("Available packages"); foreach ($result as $package => $info) { if ($i++ % 20 == 0) { if ($j++ > 0) { print "\n"; } printf("%-20s %-10s %-15s %s\n", "Package", "Stable", "Lead", "Category"); print str_repeat("-", 75)."\n"; } if (empty($info['stable'])) { $info['stable'] = '(none)'; } $stable = (string)$info['stable']; printf("%-20s %-10s %-15s %s\n", $package, $info['stable'], $info['lead'], $info['category']); } break; } // }}} default: { if (!$store_default_config && !$store_user_config) { usage(); } break; } } // {{{ usage() function usage($error = null) { $stderr = fopen('php://stderr', 'w'); if (PEAR::isError($error)) { fputs($stderr, $error->getMessage()); } elseif ($error !== null) { fputs($stderr, $error); } fputs($stderr, "Usage: pear-get [options] command [command-options] <parameters>\n". "Options:\n". " -v increase verbosity level (default 1)\n". " -q be quiet, decrease verbosity level\n". " -c file find user configuration in `file'\n". " -C file find system configuration in `file'\n". " -d foo=bar set user config variable `foo' to `bar'\n". " -D foo=bar set system config variable `foo' to `bar'\n". " -u foo unset `foo' in the user configuration\n". " -h, -? display help/usage (this message)\n". "Commands:\n". " help [command]\n". " install [-r] <package file>\n". " uninstall [-r] <package name>\n". " list\n". " info\n". "\n"); fclose($stderr); exit; } // }}} // {{{ present_array() function present_array(&$arr, $keys = null) { if ($keys === null) { $keys = array_keys($arr); } $longest_key = max(array_map("strlen", array_keys($arr))) + 2; $format_string = "%{$longest_key}s : %s\n"; foreach ($keys as $k) { if (is_array($arr[$k])) { foreach ($arr[$k] as $i => $value) { $x = "$k #$i"; $cont = array(); foreach(array_keys($value) as $val) { $cont[] = "$val=" . $value[$val]; } $v = implode(", ", $cont); printf($format_string, $x, $v); } continue; } else { $v = $arr[$k]; printf($format_string, $k, $v); } } } // }}} // {{{ heading() function heading($text) { $l = strlen(trim($text)); print rtrim($text) . "\n" . str_repeat("=", $l) . "\n"; } // }}} /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: nil * End: */ ?>