Remove support for deprecated lock format
parent
d929a0813a
commit
7e4ca7638c
|
@ -315,7 +315,7 @@ class Installer
|
||||||
$pool->addRepository($lockedRepository, $aliases);
|
$pool->addRepository($lockedRepository, $aliases);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$installFromLock || !$this->locker->isCompleteFormat()) {
|
if (!$installFromLock) {
|
||||||
$repositories = $this->repositoryManager->getRepositories();
|
$repositories = $this->repositoryManager->getRepositories();
|
||||||
foreach ($repositories as $repository) {
|
foreach ($repositories as $repository) {
|
||||||
$pool->addRepository($repository, $aliases);
|
$pool->addRepository($repository, $aliases);
|
||||||
|
@ -393,10 +393,6 @@ class Installer
|
||||||
} elseif ($installFromLock) {
|
} elseif ($installFromLock) {
|
||||||
$this->io->write('<info>Installing dependencies'.($withDevReqs?' (including require-dev)':'').' from lock file</info>');
|
$this->io->write('<info>Installing dependencies'.($withDevReqs?' (including require-dev)':'').' from lock file</info>');
|
||||||
|
|
||||||
if (!$this->locker->isCompleteFormat($withDevReqs)) {
|
|
||||||
$this->io->write('<warning>Warning: Your lock file is in a deprecated format. It will most likely take a *long* time for composer to install dependencies, and may cause dependency solving issues.</warning>');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->locker->isFresh()) {
|
if (!$this->locker->isFresh()) {
|
||||||
$this->io->write('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.</warning>');
|
$this->io->write('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.</warning>');
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,23 +84,6 @@ class Locker
|
||||||
return $this->hash === $lock['hash'];
|
return $this->hash === $lock['hash'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether the lock file is in the new complete format or not
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isCompleteFormat()
|
|
||||||
{
|
|
||||||
$lockData = $this->getLockData();
|
|
||||||
$lockedPackages = $lockData['packages'];
|
|
||||||
|
|
||||||
if (empty($lockedPackages) || isset($lockedPackages[0]['name'])) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches and returns an array of locked packages, retrieved from registered repositories.
|
* Searches and returns an array of locked packages, retrieved from registered repositories.
|
||||||
*
|
*
|
||||||
|
@ -133,50 +116,7 @@ class Locker
|
||||||
return $packages;
|
return $packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
// legacy lock file support
|
throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
|
||||||
$repo = $this->repositoryManager->getLocalRepository();
|
|
||||||
foreach ($lockedPackages as $info) {
|
|
||||||
$resolvedVersion = !empty($info['alias-version']) ? $info['alias-version'] : $info['version'];
|
|
||||||
|
|
||||||
// try to find the package in the local repo (best match)
|
|
||||||
$package = $repo->findPackage($info['package'], $resolvedVersion);
|
|
||||||
|
|
||||||
// try to find the package in any repo
|
|
||||||
if (!$package) {
|
|
||||||
$package = $this->repositoryManager->findPackage($info['package'], $resolvedVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
// try to find the package in any repo (second pass without alias + rebuild alias since it disappeared)
|
|
||||||
if (!$package && !empty($info['alias-version'])) {
|
|
||||||
$package = $this->repositoryManager->findPackage($info['package'], $info['version']);
|
|
||||||
if ($package) {
|
|
||||||
$package->setAlias($info['alias-version']);
|
|
||||||
$package->setPrettyAlias($info['alias-pretty-version']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$package) {
|
|
||||||
throw new \LogicException(sprintf(
|
|
||||||
'Can not find "%s-%s" package in registered repositories',
|
|
||||||
$info['package'], $info['version']
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
$package = clone $package;
|
|
||||||
if (!empty($info['time'])) {
|
|
||||||
$package->setReleaseDate($info['time']);
|
|
||||||
}
|
|
||||||
if (!empty($info['source-reference'])) {
|
|
||||||
$package->setSourceReference($info['source-reference']);
|
|
||||||
if (is_callable($package, 'setDistReference')) {
|
|
||||||
$package->setDistReference($info['source-reference']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$packages->addPackage($package);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $packages;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue