1
0
Fork 0

Require first version of a root package alias, rather than alias

This makes sure that the alias will always be installed, even if it isn't
technically needed.
pull/733/head
Nils Adermann 2012-05-24 23:29:08 +02:00
parent 9857145830
commit 41215a0e47
5 changed files with 7 additions and 15 deletions

View File

@ -436,14 +436,6 @@ class Installer
$package->getRepository()->addPackage($aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']));
$aliasPackage->setRootPackageAlias(true);
}
foreach ($this->repositoryManager->getLocalRepositories() as $repo) {
foreach ($repo->findPackages($alias['package'], $alias['version']) as $package) {
$package->setAlias($alias['alias_normalized']);
$package->setPrettyAlias($alias['alias']);
$package->getRepository()->addPackage($aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']));
$aliasPackage->setRootPackageAlias(true);
}
}
}
return $aliases;

View File

@ -80,7 +80,7 @@ class VersionParser
// ignore aliases and just assume the alias is required instead of the source
if (preg_match('{^([^,\s]+) +as +([^,\s]+)$}', $version, $match)) {
$version = $match[2];
$version = $match[1];
}
// match master-like branches

View File

@ -22,7 +22,7 @@ Aliases take precedence over default package even if default is selected
"package": [
{
"name": "a/a", "version": "dev-master",
"require": { "a/req": "1.*" }
"require": { "a/req": "dev-master" }
},
{
"name": "a/b", "version": "dev-master",
@ -43,7 +43,7 @@ Aliases take precedence over default package even if default is selected
}
}
--EXPECT--
Marking a/req (dev-master feat.f) as installed, alias of a/req (dev-feature-foo feat.f)
Installing a/req (dev-feature-foo feat.f)
Marking a/req (dev-master feat.f) as installed, alias of a/req (dev-master feat.f)
Installing a/b (dev-master)
Installing a/a (dev-master)

View File

@ -45,9 +45,9 @@ Aliases take precedence over default package
}
}
--EXPECT--
Installing a/c (dev-feature-foo feat.f)
Marking a/c (dev-master feat.f) as installed, alias of a/c (dev-feature-foo feat.f)
Installing a/b (dev-master forked)
Marking a/b (1.0.x-dev forked) as installed, alias of a/b (dev-master forked)
Marking a/c (dev-master feat.f) as installed, alias of a/c (dev-feature-foo feat.f)
Installing a/a (dev-master master)
Installing a/c (dev-feature-foo feat.f)
Marking a/a (1.0.x-dev master) as installed, alias of a/a (dev-master master)

View File

@ -54,7 +54,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
'parses branches' => array('1.x-dev', '1.9999999.9999999.9999999-dev'),
'parses arbitrary' => array('dev-feature-foo', 'dev-feature-foo'),
'parses arbitrary2' => array('DEV-FOOBAR', 'dev-foobar'),
'ignores aliases' => array('dev-master as 1.0.0', '1.0.0.0'),
'ignores aliases' => array('dev-master as 1.0.0', '9999999-dev'),
);
}
@ -156,7 +156,7 @@ class VersionParserTest extends \PHPUnit_Framework_TestCase
'accepts master/2' => array('dev-master', new VersionConstraint('=', '9999999-dev')),
'accepts arbitrary' => array('dev-feature-a', new VersionConstraint('=', 'dev-feature-a')),
'regression #550' => array('dev-some-fix', new VersionConstraint('=', 'dev-some-fix')),
'ignores aliases' => array('dev-master as 1.0.0', new VersionConstraint('=', '1.0.0.0')),
'ignores aliases' => array('dev-master as 1.0.0', new VersionConstraint('=', '9999999-dev')),
);
}