Load root packages as aliases if they are aliased so that they replace everything
parent
f3df4772f9
commit
a4c2337433
|
@ -15,6 +15,7 @@ namespace Composer\Package\Loader;
|
||||||
use Composer\Package\Version\VersionParser;
|
use Composer\Package\Version\VersionParser;
|
||||||
use Composer\Repository\RepositoryManager;
|
use Composer\Repository\RepositoryManager;
|
||||||
use Composer\Util\ProcessExecutor;
|
use Composer\Util\ProcessExecutor;
|
||||||
|
use Composer\Package\AliasPackage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArrayLoader built for the sole purpose of loading the root package
|
* ArrayLoader built for the sole purpose of loading the root package
|
||||||
|
@ -48,13 +49,6 @@ class RootPackageLoader extends ArrayLoader
|
||||||
foreach ($this->process->splitLines($output) as $branch) {
|
foreach ($this->process->splitLines($output) as $branch) {
|
||||||
if ($branch && preg_match('{^(?:\* ) *(?:[^/ ]+?/)?(\S+) *[a-f0-9]+ .*$}', $branch, $match)) {
|
if ($branch && preg_match('{^(?:\* ) *(?:[^/ ]+?/)?(\S+) *[a-f0-9]+ .*$}', $branch, $match)) {
|
||||||
$version = 'dev-'.$match[1];
|
$version = 'dev-'.$match[1];
|
||||||
if (isset($config['extra']['branch-alias'][$version])
|
|
||||||
&& substr($config['extra']['branch-alias'][$version], -4) === '-dev'
|
|
||||||
) {
|
|
||||||
$targetBranch = $config['extra']['branch-alias'][$version];
|
|
||||||
$normalized = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
|
|
||||||
$version = preg_replace('{(\.9{7})+}', '.x', $normalized);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,6 +91,16 @@ class RootPackageLoader extends ArrayLoader
|
||||||
$package->setRepositories($config['repositories']);
|
$package->setRepositories($config['repositories']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($config['extra']['branch-alias'][$version])
|
||||||
|
&& substr($config['extra']['branch-alias'][$version], -4) === '-dev'
|
||||||
|
) {
|
||||||
|
$targetBranch = $config['extra']['branch-alias'][$version];
|
||||||
|
$normalized = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
|
||||||
|
$version = preg_replace('{(\.9{7})+}', '.x', $normalized);
|
||||||
|
|
||||||
|
return new AliasPackage($package, $normalized, $version);
|
||||||
|
}
|
||||||
|
|
||||||
return $package;
|
return $package;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue