- Fix #1249 (wrong print out the wrong state with force option)

- some NL issues, sorry, commit now too
This commit is contained in:
Pierre Joye 2004-05-16 15:37:13 +00:00
parent bb88a86240
commit 59727034b7

View File

@ -68,7 +68,7 @@ class PEAR_Downloader extends PEAR_Common
/**
* Options from command-line passed to Install.
*
*
* Recognized options:<br />
* - onlyreqdeps : install all required dependencies as well
* - alldeps : install all dependencies, including optional
@ -82,7 +82,7 @@ class PEAR_Downloader extends PEAR_Common
/**
* Downloaded Packages after a call to download().
*
*
* Format of each entry:
*
* <code>
@ -97,7 +97,7 @@ class PEAR_Downloader extends PEAR_Common
/**
* Packages slated for download.
*
*
* This is used to prevent downloading a package more than once should it be a dependency
* for two packages to be installed.
* Format of each entry:
@ -110,10 +110,10 @@ class PEAR_Downloader extends PEAR_Common
* @var array
*/
var $_toDownload = array();
/**
* Array of every package installed, with names lower-cased.
*
*
* Format:
* <code>
* array('package1' => 0, 'package2' => 1, );
@ -121,7 +121,7 @@ class PEAR_Downloader extends PEAR_Common
* @var array
*/
var $_installed = array();
/**
* @var array
* @access private
@ -129,7 +129,7 @@ class PEAR_Downloader extends PEAR_Common
var $_errorStack = array();
// {{{ PEAR_Downloader()
function PEAR_Downloader(&$ui, $options, &$config)
{
$this->_options = $options;
@ -158,7 +158,7 @@ class PEAR_Downloader extends PEAR_Common
}
parent::PEAR_Common();
}
// }}}
// {{{ configSet()
function configSet($key, $value, $layer = 'user')
@ -170,14 +170,14 @@ class PEAR_Downloader extends PEAR_Common
$this->_preferredState = null;
}
}
// }}}
// {{{ setOptions()
function setOptions($options)
{
$this->_options = $options;
}
// }}}
// {{{ _downloadFile()
/**
@ -302,7 +302,7 @@ class PEAR_Downloader extends PEAR_Common
/**
* Retrieve a list of downloaded packages after a call to {@link download()}.
*
*
* Also resets the list of downloaded packages.
* @return array
*/
@ -327,7 +327,7 @@ class PEAR_Downloader extends PEAR_Common
{
return $this->doDownload($packages);
}
// }}}
// {{{ doDownload()
@ -404,7 +404,7 @@ class PEAR_Downloader extends PEAR_Common
// }}}
// {{{ _downloadNonFile($pkgfile)
/**
* @return false|PEAR_Error|string false if loop should be broken out of,
* string if the file was downloaded,
@ -466,17 +466,24 @@ class PEAR_Downloader extends PEAR_Common
$states = $this->betterStates($this->_preferredState, true);
$possible = false;
$version = 0;
$higher_version = 0;
$prev_hi_ver = 0;
foreach ($releases as $ver => $inf) {
if (in_array($inf['state'], $states) && version_compare("$version", "$ver") < 0) {
$version = $ver;
break;
}
} else {
$ver = (string)$ver;
if (version_compare($prev_hi_ver, $ver) < 0) {
$prev_hi_ver = $higher_version = $ver;
}
}
}
if ($version === 0 && !isset($this->_options['force'])) {
return $this->raiseError('No release with state equal to: \'' . implode(', ', $states) .
"' found for '$pkgfile'");
} elseif ($version === 0) {
$this->log(0, "Warning: $pkgfile is state '$inf[state]' which is less stable " .
$this->log(0, "Warning: $pkgfile is state '" . $releases[$higher_version]['state'] . "' which is less stable " .
"than state '$this->_preferredState'");
}
}
@ -494,10 +501,10 @@ class PEAR_Downloader extends PEAR_Common
$this->_toDownload[] = $pkgfile;
return $this->_downloadFile($pkgfile, $version, $origpkgfile, $state);
}
// }}}
// {{{ _processDependency($package, $info, $mywillinstall)
/**
* Process a dependency, download if necessary
* @param array dependency information from PEAR_Remote call
@ -587,7 +594,7 @@ class PEAR_Downloader extends PEAR_Common
}
return $info['name'];
}
// }}}
// {{{ _downloadCallback()
@ -634,7 +641,7 @@ class PEAR_Downloader extends PEAR_Common
}
// }}}
// {{{ pushError($errmsg, $code)
/**
* @param string
* @param integer
@ -643,10 +650,10 @@ class PEAR_Downloader extends PEAR_Common
{
array_push($this->_errorStack, array($errmsg, $code));
}
// }}}
// {{{ getErrorMsgs()
function getErrorMsgs()
{
$msgs = array();
@ -657,7 +664,7 @@ class PEAR_Downloader extends PEAR_Common
$this->_errorStack = array();
return $msgs;
}
// }}}
}
// }}}