Subversion Repositories Applications.gtt

Compare Revisions

Ignore whitespace Rev 186 → Rev 187

/trunk/bibliotheque/pear/PEAR/PackageFile/Generator/v1.php
4,18 → 4,11
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: v1.php,v 1.72 2006/05/10 02:56:19 cellog Exp $
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
33,9 → 26,9
* @category pear
* @package PEAR
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: 1.5.1
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.10.1
* @link http://pear.php.net/package/PEAR
* @since Class available since Release 1.4.0a1
*/
45,7 → 38,7
* @var PEAR_PackageFile_v1
*/
var $_packagefile;
function PEAR_PackageFile_Generator_v1(&$packagefile)
function __construct(&$packagefile)
{
$this->_packagefile = &$packagefile;
}
52,7 → 45,7
 
function getPackagerVersion()
{
return '1.5.1';
return '1.10.1';
}
 
/**
115,7 → 108,7
// }}}
$packagexml = $this->toPackageFile($where, PEAR_VALIDATE_PACKAGING, 'package.xml', true);
if ($packagexml) {
$tar =& new Archive_Tar($dest_package, $compress);
$tar = new Archive_Tar($dest_package, $compress);
$tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors
// ----- Creates with the package.xml file
$ok = $tar->createModify(array($packagexml), '', $where);
174,9 → 167,6
*/
function _fixXmlEncoding($string)
{
if (version_compare(phpversion(), '5.0.0', 'lt')) {
$string = utf8_encode($string);
}
return strtr($string, array(
'&' => '&amp;',
'>' => '&gt;',
206,7 → 196,7
);
$ret = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
$ret .= "<!DOCTYPE package SYSTEM \"http://pear.php.net/dtd/package-1.0\">\n";
$ret .= "<package version=\"1.0\" packagerversion=\"1.5.1\">\n" .
$ret .= "<package version=\"1.0\" packagerversion=\"1.10.1\">\n" .
" <name>$pkginfo[package]</name>";
if (isset($pkginfo['extends'])) {
$ret .= "\n<extends>$pkginfo[extends]</extends>";
521,6 → 511,7
return $a;
}
}
 
$arr = array(
'attribs' => array(
'version' => '2.0',
550,6 → 541,7
);
$arr['lead'][] = $new;
}
 
if (!isset($arr['lead'])) { // some people... you know?
$arr['lead'] = array(
'name' => 'unknown',
558,9 → 550,11
'active' => 'no',
);
}
 
if (count($arr['lead']) == 1) {
$arr['lead'] = $arr['lead'][0];
}
 
foreach ($maintainers as $maintainer) {
if ($maintainer['role'] == 'lead') {
continue;
573,15 → 567,19
);
$arr[$maintainer['role']][] = $new;
}
 
if (isset($arr['developer']) && count($arr['developer']) == 1) {
$arr['developer'] = $arr['developer'][0];
}
 
if (isset($arr['contributor']) && count($arr['contributor']) == 1) {
$arr['contributor'] = $arr['contributor'][0];
}
 
if (isset($arr['helper']) && count($arr['helper']) == 1) {
$arr['helper'] = $arr['helper'][0];
}
 
$arr['date'] = $this->_packagefile->getDate();
$arr['version'] =
array(
605,6 → 603,7
'gpl' => 'http://www.gnu.org/copyleft/gpl.html',
'apache' => 'http://www.opensource.org/licenses/apache2.0.php'
);
 
if (isset($licensemap[strtolower($this->_packagefile->getLicense())])) {
$arr['license'] = array(
'attribs' => array('uri' =>
615,6 → 614,7
// don't use bogus uri
$arr['license'] = $this->_packagefile->getLicense();
}
 
$arr['notes'] = $this->_packagefile->getNotes();
$temp = array();
$arr['contents'] = $this->_convertFilelist2_0($temp);
625,6 → 625,7
$arr['channel'] = 'pecl.php.net';
$arr['providesextension'] = $arr['name']; // assumption
}
 
$arr[$release] = array();
if ($this->_packagefile->getConfigureOptions()) {
$arr[$release]['configureoption'] = $this->_packagefile->getConfigureOptions();
635,11 → 636,13
$arr[$release]['configureoption'] = $arr[$release]['configureoption'][0];
}
}
 
$this->_convertRelease2_0($arr[$release], $temp);
if ($release == 'extsrcrelease' && count($arr[$release]) > 1) {
// multiple extsrcrelease tags added in PEAR 1.4.1
$arr['dependencies']['required']['pearinstaller']['min'] = '1.4.1';
}
 
if ($cl = $this->_packagefile->getChangelog()) {
foreach ($cl as $release) {
$rel = array();
651,6 → 654,7
if (!isset($release['release_state'])) {
$release['release_state'] = 'stable';
}
 
$rel['stability'] =
array(
'release' => $release['release_state'],
661,6 → 665,7
} else {
$rel['date'] = date('Y-m-d');
}
 
if (isset($release['release_license'])) {
if (isset($licensemap[strtolower($release['release_license'])])) {
$uri = $licensemap[strtolower($release['release_license'])];
674,18 → 679,22
} else {
$rel['license'] = $arr['license'];
}
 
if (!isset($release['release_notes'])) {
$release['release_notes'] = 'no release notes';
}
 
$rel['notes'] = $release['release_notes'];
$arr['changelog']['release'][] = $rel;
}
}
 
$ret = new $class;
$ret->setConfig($this->_packagefile->_config);
if (isset($this->_packagefile->_logger) && is_object($this->_packagefile->_logger)) {
$ret->setLogger($this->_packagefile->_logger);
}
 
$ret->fromArray($arr);
return $ret;
}
700,7 → 709,7
$peardep = array('pearinstaller' =>
array('min' => '1.4.0b1')); // this is a lot safer
$required = $optional = array();
$release['dependencies'] = array();
$release['dependencies'] = array('required' => array());
if ($this->_packagefile->hasDeps()) {
foreach ($this->_packagefile->getDeps() as $dep) {
if (!isset($dep['optional']) || $dep['optional'] == 'no') {
831,9 → 840,9
/**
* Post-process special files with install-as/platform attributes and
* make the release tag.
*
*
* This complex method follows this work-flow to create the release tags:
*
*
* <pre>
* - if any install-as/platform exist, create a generic release and fill it with
* o <install as=..> tags for <file name=... install-as=...>
849,10 → 858,10
* o <ignore> tags for <file name=... platform=other platform install-as=..>
* o <ignore> tags for <file name=... platform=!this platform install-as=..>
* </pre>
*
*
* It does this by accessing the $package parameter, which contains an array with
* indices:
*
*
* - platform: mapping of file => OS the file should be installed on
* - install-as: mapping of file => installed name
* - osmap: mapping of OS => list of files that should be installed
866,7 → 875,7
*/
function _convertRelease2_0(&$release, $package)
{
//- if any install-as/platform exist, create a generic release and fill it with
//- if any install-as/platform exist, create a generic release and fill it with
if (count($package['platform']) || count($package['install-as'])) {
$generic = array();
$genericIgnore = array();
1165,13 → 1174,15
}
if (count($min)) {
// get the highest minimum
$min = array_pop($a = array_flip($min));
$a = array_flip($min);
$min = array_pop($a);
} else {
$min = false;
}
if (count($max)) {
// get the lowest maximum
$max = array_shift($a = array_flip($max));
$a = array_flip($max);
$max = array_shift($a);
} else {
$max = false;
}
1202,16 → 1213,15
*/
function _processMultipleDepsName($deps)
{
$tests = array();
$ret = $tests = array();
foreach ($deps as $name => $dep) {
foreach ($dep as $d) {
$tests[$name][] = $this->_processDep($d);
}
}
 
foreach ($tests as $name => $test) {
$php = array();
$min = array();
$max = array();
$max = $min = $php = array();
$php['name'] = $name;
foreach ($test as $dep) {
if (!$dep) {
1238,13 → 1248,15
}
if (count($min)) {
// get the highest minimum
$min = array_pop($a = array_flip($min));
$a = array_flip($min);
$min = array_pop($a);
} else {
$min = false;
}
if (count($max)) {
// get the lowest maximum
$max = array_shift($a = array_flip($max));
$a = array_flip($max);
$max = array_shift($a);
} else {
$max = false;
}
1269,4 → 1281,4
return $ret;
}
}
?>
?>