1
0
Fork 0

Adjust -vv output of operation reasons in the installer

pull/1836/head
Jordi Boggiano 2013-04-27 11:01:08 +02:00
parent 2ec75f298d
commit 73f4ce59ca
1 changed files with 11 additions and 5 deletions

View File

@ -490,23 +490,29 @@ class Installer
} }
} }
// output alias operations in verbose mode, or all ops in dry run // output non-alias ops in dry run, output alias ops in debug verbosity
if ($this->dryRun || ($this->verbose && false !== strpos($operation->getJobType(), 'Alias'))) { if ($this->dryRun && false === strpos($operation->getJobType(), 'Alias')) {
$this->io->write(' - ' . $operation); $this->io->write(' - ' . $operation);
$this->io->write('');
} elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
$this->io->write(' - ' . $operation);
$this->io->write('');
} }
$this->installationManager->execute($localRepo, $operation); $this->installationManager->execute($localRepo, $operation);
// output reasons why the operation was ran // output reasons why the operation was ran, only for install/update operations
if ($this->verbose && $this->io->isVeryVerbose()) { if ($this->verbose && $this->io->isVeryVerbose() && in_array($operation->getJobType(), array('install', 'update'))) {
$reason = $operation->getReason(); $reason = $operation->getReason();
if ($reason instanceof Rule) { if ($reason instanceof Rule) {
switch ($reason->getReason()) { switch ($reason->getReason()) {
case Rule::RULE_JOB_INSTALL: case Rule::RULE_JOB_INSTALL:
$this->io->write(' REASON: Required to be installed: '.$reason->getRequiredPackage()); $this->io->write(' REASON: Required by root: '.$reason->getRequiredPackage());
$this->io->write('');
break; break;
case Rule::RULE_PACKAGE_REQUIRES: case Rule::RULE_PACKAGE_REQUIRES:
$this->io->write(' REASON: '.$reason->getPrettyString()); $this->io->write(' REASON: '.$reason->getPrettyString());
$this->io->write('');
break; break;
} }
} }