summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2002-06-02 12:59:19 +0000
committerStig Bakken <ssb@php.net>2002-06-02 12:59:19 +0000
commit45401d43dc737c1fdda130c38fcb6384dbd49428 (patch)
treedeaa1ffb1b2e0fb5ad8734d96d95b909b7f3f50b
parenta529e58b76d937569f22fb291ac67f4594f77874 (diff)
downloadphp-git-45401d43dc737c1fdda130c38fcb6384dbd49428.tar.gz
* implemented "package-info" replacement in package.xml
# look for @pear_version@ in scripts/pear.in for an example
-rw-r--r--pear/PEAR/Common.php2
-rw-r--r--pear/PEAR/Installer.php6
-rw-r--r--pear/package-PEAR.xml1
-rw-r--r--pear/scripts/pear.in6
4 files changed, 9 insertions, 6 deletions
diff --git a/pear/PEAR/Common.php b/pear/PEAR/Common.php
index 6629b64d59..b75486e1a2 100644
--- a/pear/PEAR/Common.php
+++ b/pear/PEAR/Common.php
@@ -67,7 +67,7 @@ $GLOBALS['_PEAR_Common_file_roles'] = array('php','ext','test','doc','data','src
* Valid replacement types
* @var array
*/
-$GLOBALS['_PEAR_Common_replacement_types'] = array('php-const', 'pear-config');
+$GLOBALS['_PEAR_Common_replacement_types'] = array('php-const', 'pear-config', 'package-info');
/**
* Valid "provide" types
diff --git a/pear/PEAR/Installer.php b/pear/PEAR/Installer.php
index fef5751d69..a3c8f100d2 100644
--- a/pear/PEAR/Installer.php
+++ b/pear/PEAR/Installer.php
@@ -223,10 +223,12 @@ class PEAR_Installer extends PEAR_Common
}
} elseif ($a['type'] == 'pear-config') {
$to = $this->config->get($a['to']);
+ } elseif ($a['type'] == 'package-info') {
+ $to = $this->pkginfo[$a['to']];
}
if ($to) {
- $subst_from = $a['from'];
- $subst_to = $to;
+ $subst_from[] = $a['from'];
+ $subst_to[] = $to;
}
}
$this->log(2, "doing ".sizeof($subst_from)." substitution(s) for $dest_file");
diff --git a/pear/package-PEAR.xml b/pear/package-PEAR.xml
index b02466aed6..0ec6cacfcc 100644
--- a/pear/package-PEAR.xml
+++ b/pear/package-PEAR.xml
@@ -80,6 +80,7 @@
<dir name="scripts">
<file baseinstalldir="/" role="script" install-as="pear" name="pear.in">
<replace from="@prefix@/bin" to="PHP_BINDIR" type="php-const"/>
+ <replace from="@pear_version@" to="version" type="package-info"/>
</file>
<file baseinstalldir="/" role="script" platform="windows" name="pear.bat"></file>
</dir>
diff --git a/pear/scripts/pear.in b/pear/scripts/pear.in
index 43d49d739b..d7d77a3e23 100644
--- a/pear/scripts/pear.in
+++ b/pear/scripts/pear.in
@@ -33,6 +33,8 @@ ini_set('magic_quotes_runtime', false);
error_reporting(E_ALL & ~E_NOTICE);
set_error_handler('error_handler');
+$pear_package_version = "@pear_version@";
+
require_once 'PEAR.php';
require_once 'PEAR/Config.php';
require_once 'PEAR/Command.php';
@@ -227,7 +229,6 @@ function cmdHelp($command)
" -u foo unset `foo' in the user configuration\n".
" -h, -? display help/usage (this message)\n".
" -V version information\n";
-
} elseif ($command == "shortcuts") {
$sc = PEAR_Command::getShortcuts();
$ret = "Shortcuts:\n";
@@ -237,8 +238,7 @@ function cmdHelp($command)
return $ret;
} elseif ($command == "version") {
- $reg = &new PEAR_Registry($config->get('php_dir'));
- return "PEAR " . $reg->packageInfo('PEAR', 'version');
+ return "PEAR $GLOBALS[pear_package_version]";
} elseif ($help = PEAR_Command::getHelp($command)) {
if (is_string($help)) {