Permalink
Browse files

Revert Locker change, ignore PEAR packages whose version cannot be pa…

…rsed.
  • Loading branch information...
1 parent 9ba3deb commit 22aef0124e2a8f6d5fa7395410faf3f498ffc044 Alexey Prilipko committed Jul 2, 2012
View
@@ -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.
Example:
- You own private pear repository and going to use composer abilities to bring
- dependencies from vcs or transit to composer repository scheme.
- List of packages:
+You own private pear repository and going to use composer abilities to bring dependencies from vcs or transit to composer repository scheme.
+Your repository list of packages:
* BasePackage, requires nothing
* IntermediatePackage, depends on BasePackage
* 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/TopLevelPackage1" 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
- 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:
+
+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:
{
"repositories": [
@@ -211,7 +211,7 @@ private function lockPackages(array $packages)
}
$name = $package->getPrettyName();
- $version = $package->getVersion();
+ $version = $package->getPrettyVersion();
if (!$name || !$version) {
throw new \LogicException(sprintf(
@@ -91,9 +91,13 @@ private function buildComposerPackages(ChannelInfo $channelInfo, VersionParser $
$result = array();
foreach ($channelInfo->getPackages() as $packageDefinition) {
foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
- $normalizedVersion = $this->parseVersion($version);
- if (!$normalizedVersion) {
- continue; // skip packages with unparsable versions
+ try {
+ $normalizedVersion = $versionParser->normalize($version);
+ } 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());
@@ -175,24 +179,4 @@ private function buildComposerPackageName($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 @@ public function testSetLockData()
->will($this->returnValue('pkg1'));
$package1
->expects($this->once())
- ->method('getVersion')
+ ->method('getPrettyVersion')
->will($this->returnValue('1.0.0-beta'));
$package2
@@ -147,7 +147,7 @@ public function testSetLockData()
->will($this->returnValue('pkg2'));
$package2
->expects($this->once())
- ->method('getVersion')
+ ->method('getPrettyVersion')
->will($this->returnValue('0.1.10'));
$json

0 comments on commit 22aef01

Please sign in to comment.