From: Stig Bakken Date: Wed, 27 Nov 2002 01:01:25 +0000 (+0000) Subject: MFH X-Git-Tag: php-4.3.0RC2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5301c168e40b0a387b0f3718db7e6c93c1faa3e6;p=php MFH --- diff --git a/pear/PEAR/Common.php b/pear/PEAR/Common.php index eeabe3c0a5..03c47295bc 100644 --- a/pear/PEAR/Common.php +++ b/pear/PEAR/Common.php @@ -119,6 +119,12 @@ class PEAR_Common extends PEAR var $current_path = null; + /** + * PEAR_SourceAnalyzer instance + * @var object + */ + var $source_analyzer = null; + // }}} // {{{ constructor @@ -418,13 +424,6 @@ class PEAR_Common extends PEAR $this->filelist[$this->current_path]['replacements'][] = $attribs; } break; - - case 'libfile': - if (!$this->in_changelog) { - $this->lib_atts = $attribs; - $this->lib_atts['role'] = 'extsrc'; - } - break; case 'maintainers': $this->pkginfo['maintainers'] = array(); $this->m_i = 0; // maintainers array index @@ -563,9 +562,6 @@ class PEAR_Common extends PEAR case 'license': $this->pkginfo['release_license'] = $data; break; - case 'sources': - $this->lib_sources[] = $data; - break; case 'dep': if ($data && !$this->in_changelog) { $this->pkginfo['release_deps'][$this->d_i]['name'] = $data; @@ -602,37 +598,6 @@ class PEAR_Common extends PEAR } } break; - case 'libfile': - if ($this->in_changelog) { - break; - } - $path = ''; - if (!empty($this->dir_names)) { - foreach ($this->dir_names as $dir) { - $path .= $dir . DIRECTORY_SEPARATOR; - } - } - $path .= $this->lib_name; - $this->filelist[$path] = $this->lib_atts; - // Set the baseinstalldir only if the file don't have this attrib - if (!isset($this->filelist[$path]['baseinstalldir']) && - isset($this->dir_install)) - { - $this->filelist[$path]['baseinstalldir'] = $this->dir_install; - } - if (isset($this->lib_sources)) { - $this->filelist[$path]['sources'] = implode(' ', $this->lib_sources); - } - unset($this->lib_atts); - unset($this->lib_sources); - unset($this->lib_name); - break; - case 'libname': - if ($this->in_changelog) { - break; - } - $this->lib_name = $data; - break; case 'maintainer': if (empty($this->pkginfo['maintainers'][$this->m_i]['role'])) { $this->pkginfo['maintainers'][$this->m_i]['role'] = 'lead'; @@ -696,26 +661,28 @@ class PEAR_Common extends PEAR function infoFromTgzFile($file) { if (!@is_file($file)) { - return $this->raiseError("tgz :: could not open file \"$file\""); + return $this->raiseError("could not open file \"$file\""); } $tar = new Archive_Tar($file); $content = $tar->listContent(); if (!is_array($content)) { - return $this->raiseError("tgz :: could not get contents of package \"$file\""); + return $this->raiseError("could not get contents of package \"$file\""); } $xml = null; foreach ($content as $file) { $name = $file['filename']; if ($name == 'package.xml') { $xml = $name; - } elseif (ereg('^.*/package.xml$', $name, $match)) { + break; + } elseif (ereg('package.xml$', $name, $match)) { $xml = $match[0]; + break; } } $tmpdir = System::mkTemp('-d pear'); $this->addTempFile($tmpdir); if (!$xml || !$tar->extractList($xml, $tmpdir)) { - return $this->raiseError('tgz :: could not extract the package.xml file'); + return $this->raiseError('could not extract the package.xml file'); } return $this->infoFromDescriptionFile("$tmpdir/$xml"); } @@ -805,6 +772,44 @@ class PEAR_Common extends PEAR } return $this->pkginfo; } + // }}} + // {{{ infoFromAny() + + /** + * Returns package information from different sources + * + * This method is able to extract information about a package + * from a .tgz archive or from a XML package definition file. + * + * @access public + * @param string Filename of the source ('package.xml', '.tgz') + * @return string + */ + function infoFromAny($info) + { + if (is_string($info) && file_exists($info)) { + $tmp = substr($info, -4); + if ($tmp == '.xml') { + $info = $this->infoFromDescriptionFile($info); + } elseif ($tmp == '.tar' || $tmp == '.tgz') { + $info = $this->infoFromTgzFile($info); + } else { + $fp = fopen($info, "r"); + $test = fread($fp, 5); + fclose($fp); + if ($test == "infoFromDescriptionFile($info); + } else { + $info = $this->infoFromTgzFile($info); + } + } + if (PEAR::isError($info)) { + return $this->raiseError($info); + } + } + return $info; + } + // }}} // {{{ xmlFromInfo() @@ -923,41 +928,34 @@ class PEAR_Common extends PEAR if (isset($pkginfo['filelist'])) { $ret .= "$indent \n"; foreach ($pkginfo['filelist'] as $file => $fa) { - if (@$fa['role'] == 'extsrc') { - $ret .= "$indent \n"; - $ret .= "$indent $file\n"; - $ret .= "$indent $fa[sources]\n"; - $ret .= "$indent \n"; + @$ret .= "$indent $v) { - $ret .= " $k=\"" . htmlspecialchars($v) .'"'; - } - $ret .= "/>\n"; + $ret .= ">\n"; + foreach ($fa['replacements'] as $r) { + $ret .= "$indent $v) { + $ret .= " $k=\"" . htmlspecialchars($v) .'"'; } - @$ret .= "$indent \n"; + $ret .= "/>\n"; } + @$ret .= "$indent \n"; } } $ret .= "$indent \n"; @@ -966,44 +964,6 @@ class PEAR_Common extends PEAR return $ret; } - // }}} - // {{{ infoFromAny() - - /** - * Returns package information from different sources - * - * This method is able to extract information about a package - * from a .tgz archive or from a XML package definition file. - * - * @access public - * @param string Filename of the source ('package.xml', '.tgz') - * @return string - */ - function infoFromAny($info) - { - if (is_string($info) && file_exists($info)) { - $tmp = substr($info, -4); - if ($tmp == '.xml') { - $info = $this->infoFromDescriptionFile($info); - } elseif ($tmp == '.tar' || $tmp == '.tgz') { - $info = $this->infoFromTgzFile($info); - } else { - $fp = fopen($info, "r"); - $test = fread($fp, 5); - fclose($fp); - if ($test == "infoFromDescriptionFile($info); - } else { - $info = $this->infoFromTgzFile($info); - } - } - if (PEAR::isError($info)) { - return $this->raiseError($info); - } - } - return $info; - } - // }}} // {{{ validatePackageInfo() @@ -1129,12 +1089,10 @@ class PEAR_Common extends PEAR $errors[] = "file $file: missing role"; } elseif (!in_array($fa['role'], $_PEAR_Common_file_roles)) { $errors[] = "file $file: invalid role, should be one of: ".implode(' ', $_PEAR_Common_file_roles); - } elseif ($fa['role'] == 'extsrc' && empty($fa['sources'])) { - $errors[] = "file $file: no source files"; } // (ssb) Any checks we can do for baseinstalldir? - // (cox) Perhaps checks that either the target dir and baseInstall - // doesn't cointain "../../" + // (cox) Perhaps checks that either the target dir and + // baseInstall doesn't cointain "../../" } } return true; diff --git a/pear/package-PEAR.xml b/pear/package-PEAR.xml index 01003e5151..5532498a14 100644 --- a/pear/package-PEAR.xml +++ b/pear/package-PEAR.xml @@ -31,16 +31,11 @@ - 1.0b2 + 1.0b3-dev stable - 2002-11-26 + 2002-12-01 -Changes, Installer: -* --force option no longer ignores errors, use - --ignore-errors instead -* installer transactions: failed installs abort - cleanly, without leaving half-installed packages - around +* fixed "info" shortcut (conflicted with "install") @@ -91,6 +86,19 @@ Changes, Installer: + + 1.0b2 + stable + 2002-11-26 + +Changes, Installer: +* --force option no longer ignores errors, use + --ignore-errors instead +* installer transactions: failed installs abort + cleanly, without leaving half-installed packages + around + + 1.0b1 stable diff --git a/pear/package.dtd b/pear/package.dtd index ddeb702371..7d1f469d8f 100644 --- a/pear/package.dtd +++ b/pear/package.dtd @@ -1,10 +1,10 @@