Merge remote-tracking branch 'digitalkaoz/issue_209'
commit
d52feb1a9f
|
@ -25,6 +25,8 @@ use Composer\Repository\PlatformRepository;
|
|||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Composer\DependencyResolver\Operation\InstallOperation;
|
||||
use Composer\DependencyResolver\Solver;
|
||||
|
||||
/**
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
|
@ -142,7 +144,10 @@ EOT
|
|||
// TODO this belongs in the solver, but this will do for now to report top-level deps missing at least
|
||||
foreach ($request->getJobs() as $job) {
|
||||
if ('install' === $job['cmd']) {
|
||||
foreach ($installedRepo->getPackages() as $package) {
|
||||
foreach ($installedRepo->getPackages() as $package ) {
|
||||
if ($installedRepo->hasPackage($package) && !$package->isPlatform() && !$installationManager->isPackageInstalled($package)) {
|
||||
$operations[$job['packageName']] = new InstallOperation($package, Solver::RULE_PACKAGE_NOT_EXIST);
|
||||
}
|
||||
if (in_array($job['packageName'], $package->getNames())) {
|
||||
continue 2;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ class LibraryInstaller implements InstallerInterface
|
|||
*/
|
||||
public function isInstalled(PackageInterface $package)
|
||||
{
|
||||
return $this->repository->hasPackage($package);
|
||||
return $this->repository->hasPackage($package) && is_readable($this->getInstallPath($package));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,12 +80,19 @@ class LibraryInstaller implements InstallerInterface
|
|||
*/
|
||||
public function install(PackageInterface $package)
|
||||
{
|
||||
$downloadPath = $this->getInstallPath($package);
|
||||
//remove the binaries first if its missing on filesystem
|
||||
if (!is_readable($this->getInstallPath($package)) && $this->repository->hasPackage($package)) {
|
||||
$this->removeBinaries($package);
|
||||
}
|
||||
|
||||
$downloadPath = $this->getInstallPath($package);
|
||||
$this->downloadManager->download($package, $downloadPath);
|
||||
$this->installBinaries($package);
|
||||
|
||||
if(!$this->repository->hasPackage($package)) {
|
||||
$this->repository->addPackage(clone $package);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Composer\Package;
|
|||
use Composer\Package\LinkConstraint\LinkConstraintInterface;
|
||||
use Composer\Package\LinkConstraint\VersionConstraint;
|
||||
use Composer\Repository\RepositoryInterface;
|
||||
use Composer\Repository\PlatformRepository;
|
||||
|
||||
/**
|
||||
* Base class for packages providing name storage and default match implementation
|
||||
|
@ -134,6 +135,16 @@ abstract class BasePackage implements PackageInterface
|
|||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if this package is a platform package
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPlatform()
|
||||
{
|
||||
return $this->getRepository() instanceof PlatformRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns package unique name, constructed from name, version and release type.
|
||||
*
|
||||
|
|
|
@ -85,7 +85,7 @@ class LibraryInstallerTest extends \PHPUnit_Framework_TestCase
|
|||
$package = $this->createPackageMock();
|
||||
|
||||
$package
|
||||
->expects($this->once())
|
||||
->expects($this->exactly(2))
|
||||
->method('getPrettyName')
|
||||
->will($this->returnValue('some/package'));
|
||||
|
||||
|
|
Loading…
Reference in New Issue