Revert Locker change, ignore PEAR packages whose version cannot be parsed.
parent
9ba3deb91b
commit
22aef0124e
|
@ -229,22 +229,18 @@ In this case the short name of the channel is `pear2`, so the
|
||||||
It is possible to alias all pear channel packages with custom name.
|
It is possible to alias all pear channel packages with custom name.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
You own private pear repository and going to use composer abilities to bring
|
You own private pear repository and going to use composer abilities to bring dependencies from vcs or transit to composer repository scheme.
|
||||||
dependencies from vcs or transit to composer repository scheme.
|
Your repository list of packages:
|
||||||
List of packages:
|
|
||||||
* BasePackage, requires nothing
|
* BasePackage, requires nothing
|
||||||
* IntermediatePackage, depends on BasePackage
|
* IntermediatePackage, depends on BasePackage
|
||||||
* TopLevelPackage1 and TopLevelPackage2 both dependth on IntermediatePackage.
|
* TopLevelPackage1 and TopLevelPackage2 both dependth on IntermediatePackage.
|
||||||
For composer it looks like:
|
|
||||||
|
For composer it looks like:
|
||||||
* "pear-pear.foobar.repo/IntermediatePackage" depends on "pear-pear.foobar.repo/BasePackage",
|
* "pear-pear.foobar.repo/IntermediatePackage" depends on "pear-pear.foobar.repo/BasePackage",
|
||||||
* "pear-pear.foobar.repo/TopLevelPackage1" depends on "pear-pear.foobar.repo/IntermediatePackage",
|
* "pear-pear.foobar.repo/TopLevelPackage1" depends on "pear-pear.foobar.repo/IntermediatePackage",
|
||||||
* "pear-pear.foobar.repo/TopLevelPackage2" depends on "pear-pear.foobar.repo/IntermediatePackage"
|
* "pear-pear.foobar.repo/TopLevelPackage2" depends on "pear-pear.foobar.repo/IntermediatePackage"
|
||||||
When you update one of your packages to composer naming scheme or made it
|
|
||||||
available through vcs your older dependencies would not see new version cause it would be named
|
When you update one of your packages to composer naming scheme or made it available through vcs, your older dependencies would not see new version, cause it would be named like "foobar/IntermediatePackage". Specifying 'vendor-alias' for pear repository, you will get all its packages aliased with composer-like names. Following example would take BasePackage, TopLevelPackage1 and TopLevelPackage2 packages from pear repository and IntermediatePackage from github repository:
|
||||||
like "foobar/IntermediatePackage".
|
|
||||||
Specifying 'vendor-alias' for pear repository you will get all its packages aliased with composer-like names.
|
|
||||||
Following example would take BasePackage, TopLevelPackage1 and TopLevelPackage2 packages from pear repository
|
|
||||||
and IntermediatePackage from github repository:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"repositories": [
|
"repositories": [
|
||||||
|
|
|
@ -211,7 +211,7 @@ class Locker
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = $package->getPrettyName();
|
$name = $package->getPrettyName();
|
||||||
$version = $package->getVersion();
|
$version = $package->getPrettyVersion();
|
||||||
|
|
||||||
if (!$name || !$version) {
|
if (!$name || !$version) {
|
||||||
throw new \LogicException(sprintf(
|
throw new \LogicException(sprintf(
|
||||||
|
|
|
@ -91,9 +91,13 @@ class PearRepository extends ArrayRepository
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach ($channelInfo->getPackages() as $packageDefinition) {
|
foreach ($channelInfo->getPackages() as $packageDefinition) {
|
||||||
foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
|
foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
|
||||||
$normalizedVersion = $this->parseVersion($version);
|
try {
|
||||||
if (!$normalizedVersion) {
|
$normalizedVersion = $versionParser->normalize($version);
|
||||||
continue; // skip packages with unparsable versions
|
} catch (\UnexpectedValueException $e) {
|
||||||
|
if ($this->io->isVerbose()) {
|
||||||
|
$this->io->write('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage());
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
|
$composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
|
||||||
|
@ -175,24 +179,4 @@ class PearRepository extends ArrayRepository
|
||||||
|
|
||||||
return "pear-{$channelName}/{$packageName}";
|
return "pear-{$channelName}/{$packageName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Softened version parser.
|
|
||||||
*
|
|
||||||
* @param string $version
|
|
||||||
* @return null|string
|
|
||||||
*/
|
|
||||||
private function parseVersion($version)
|
|
||||||
{
|
|
||||||
if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
|
|
||||||
$version = $matches[1]
|
|
||||||
.(!empty($matches[2]) ? $matches[2] : '.0')
|
|
||||||
.(!empty($matches[3]) ? $matches[3] : '.0')
|
|
||||||
.(!empty($matches[4]) ? $matches[4] : '.0');
|
|
||||||
|
|
||||||
return $version;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
->will($this->returnValue('pkg1'));
|
->will($this->returnValue('pkg1'));
|
||||||
$package1
|
$package1
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getVersion')
|
->method('getPrettyVersion')
|
||||||
->will($this->returnValue('1.0.0-beta'));
|
->will($this->returnValue('1.0.0-beta'));
|
||||||
|
|
||||||
$package2
|
$package2
|
||||||
|
@ -147,7 +147,7 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
->will($this->returnValue('pkg2'));
|
->will($this->returnValue('pkg2'));
|
||||||
$package2
|
$package2
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('getVersion')
|
->method('getPrettyVersion')
|
||||||
->will($this->returnValue('0.1.10'));
|
->will($this->returnValue('0.1.10'));
|
||||||
|
|
||||||
$json
|
$json
|
||||||
|
|
Loading…
Reference in New Issue