Hello community, here is the log from the commit of package platformsh-cli for openSUSE:Factory checked in at 2017-11-17 10:57:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/platformsh-cli (Old) and /work/SRC/openSUSE:Factory/.platformsh-cli.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "platformsh-cli" Fri Nov 17 10:57:25 2017 rev:24 rq:542510 version:3.22.3 Changes: -------- --- /work/SRC/openSUSE:Factory/platformsh-cli/platformsh-cli.changes 2017-11-09 14:08:01.520755525 +0100 +++ /work/SRC/openSUSE:Factory/.platformsh-cli.new/platformsh-cli.changes 2017-11-17 11:00:56.714655402 +0100 @@ -1,0 +2,9 @@ +Fri Nov 17 02:10:19 UTC 2017 - [email protected] + +- Update to version 3.22.3: + * Release v3.22.3 + * Add a timeout to the Drush aliases check (#646) + * Fix exit code from db:dump to respect errors (#645) + * Normalize user-defined aliases too + +------------------------------------------------------------------- Old: ---- platformsh-cli-3.22.2.tar.xz New: ---- platformsh-cli-3.22.3.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ platformsh-cli.spec ++++++ --- /var/tmp/diff_new_pack.LwNiVe/_old 2017-11-17 11:00:57.506626417 +0100 +++ /var/tmp/diff_new_pack.LwNiVe/_new 2017-11-17 11:00:57.510626271 +0100 @@ -17,7 +17,7 @@ Name: platformsh-cli -Version: 3.22.2 +Version: 3.22.3 Release: 0 Summary: Tool for managing Platform.sh services from the command line # See licenses.txt for dependency licenses. ++++++ _service ++++++ --- /var/tmp/diff_new_pack.LwNiVe/_old 2017-11-17 11:00:57.542625099 +0100 +++ /var/tmp/diff_new_pack.LwNiVe/_new 2017-11-17 11:00:57.542625099 +0100 @@ -2,7 +2,7 @@ <service name="tar_scm" mode="disabled"> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> - <param name="revision">refs/tags/v3.22.2</param> + <param name="revision">refs/tags/v3.22.3</param> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> <param name="scm">git</param> <param name="changesgenerate">enable</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.LwNiVe/_old 2017-11-17 11:00:57.566624221 +0100 +++ /var/tmp/diff_new_pack.LwNiVe/_new 2017-11-17 11:00:57.566624221 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> - <param name="changesrevision">0126117bbc346ee5d370d0b104b69a060407bf7d</param> + <param name="changesrevision">da1c7f22409c1b63dd2dd23d99542774506b41c7</param> </service> </servicedata> ++++++ platformsh-cli-3.22.2.tar.xz -> platformsh-cli-3.22.3.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.22.2/config.yaml new/platformsh-cli-3.22.3/config.yaml --- old/platformsh-cli-3.22.2/config.yaml 2017-11-08 23:50:06.000000000 +0100 +++ new/platformsh-cli-3.22.3/config.yaml 2017-11-16 11:12:57.000000000 +0100 @@ -1,7 +1,7 @@ # Metadata about the CLI application itself. application: name: 'Platform.sh CLI' - version: '3.x-dev' + version: '3.22.3' executable: 'platform' package_name: 'platformsh/cli' installer_url: 'https://platform.sh/cli/installer' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.22.2/src/Command/CommandBase.php new/platformsh-cli-3.22.3/src/Command/CommandBase.php --- old/platformsh-cli-3.22.2/src/Command/CommandBase.php 2017-11-08 23:50:06.000000000 +0100 +++ new/platformsh-cli-3.22.3/src/Command/CommandBase.php 2017-11-16 11:12:57.000000000 +0100 @@ -486,7 +486,11 @@ $this->debug('Updating Drush aliases'); /** @var \Platformsh\Cli\Service\Drush $drush */ $drush = $this->getService('drush'); - $drush->createAliases($event->getProject(), $projectRoot, $event->getEnvironments()); + try { + $drush->createAliases($event->getProject(), $projectRoot, $event->getEnvironments()); + } catch (\RuntimeException $e) { + $this->stdErr->writeln('<comment>Failed to update Drush aliases:</comment> ' . $e->getMessage()); + } } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.22.2/src/Command/Db/DbDumpCommand.php new/platformsh-cli-3.22.3/src/Command/Db/DbDumpCommand.php --- old/platformsh-cli-3.22.2/src/Command/Db/DbDumpCommand.php 2017-11-08 23:50:06.000000000 +0100 +++ new/platformsh-cli-3.22.3/src/Command/Db/DbDumpCommand.php 2017-11-16 11:12:57.000000000 +0100 @@ -161,9 +161,15 @@ $sshCommand = $ssh->getSshCommand(); if ($gzip) { - $dumpCommand .= ' | gzip --stdout'; + // If dump compression is enabled, pipe the dump command into gzip, + // but not before switching on "pipefail" to ensure a non-zero exit + // code is returned if any part of the pipe fails. + $dumpCommand = 'set -o pipefail;' + . $dumpCommand + . ' | gzip --stdout'; } else { - // Compress data transparently as it's sent over the SSH connection. + // If dump compression is not enabled, data can still be compressed + // transparently as it's streamed over the SSH connection. $sshCommand .= ' -C'; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.22.2/src/Command/Project/ProjectGetCommand.php new/platformsh-cli-3.22.3/src/Command/Project/ProjectGetCommand.php --- old/platformsh-cli-3.22.2/src/Command/Project/ProjectGetCommand.php 2017-11-08 23:50:06.000000000 +0100 +++ new/platformsh-cli-3.22.3/src/Command/Project/ProjectGetCommand.php 2017-11-16 11:12:57.000000000 +0100 @@ -57,7 +57,7 @@ // First check if the repo actually exists. try { $repoExists = $git->remoteRepoExists($gitUrl); - } catch (\Exception $e) { + } catch (\RuntimeException $e) { // The ls-remote command failed. $this->stdErr->writeln(sprintf( '<error>Failed to connect to the %s Git server</error>', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.22.2/src/Exception/ProcessFailedException.php new/platformsh-cli-3.22.3/src/Exception/ProcessFailedException.php --- old/platformsh-cli-3.22.2/src/Exception/ProcessFailedException.php 1970-01-01 01:00:00.000000000 +0100 +++ new/platformsh-cli-3.22.3/src/Exception/ProcessFailedException.php 2017-11-16 11:12:57.000000000 +0100 @@ -0,0 +1,53 @@ +<?php + +namespace Platformsh\Cli\Exception; + +use Symfony\Component\Process\Exception\RuntimeException; +use Symfony\Component\Process\Process; + +/** + * An exception thrown when a process fails. + * + * This is a copy of Symfony's ProcessFailedException, with an improved error + * message. + * + * @see \Symfony\Component\Process\Exception\ProcessFailedException + */ +class ProcessFailedException extends RuntimeException +{ + private $process; + + /** + * ProcessFailedException constructor. + * + * @param \Symfony\Component\Process\Process $process + * The failed process. + * @param bool $includeErrorOutput + * Whether to include the error output in the exception message. Set to + * false if the error output would have already been displayed. + */ + public function __construct(Process $process, $includeErrorOutput) + { + if ($process->isSuccessful()) { + throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.'); + } + + $message = 'The command failed with the exit code: ' . $process->getExitCode(); + $message .= "\n\nFull command: " . $process->getCommandLine(); + if ($includeErrorOutput) { + $message .= "\n\nError output:\n" . $process->getErrorOutput(); + } + + parent::__construct($message); + + $this->process = $process; + } + + /** + * @return \Symfony\Component\Process\Process + */ + public function getProcess() + { + return $this->process; + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.22.2/src/Service/Drush.php new/platformsh-cli-3.22.3/src/Service/Drush.php --- old/platformsh-cli-3.22.2/src/Service/Drush.php 2017-11-08 23:50:06.000000000 +0100 +++ new/platformsh-cli-3.22.3/src/Service/Drush.php 2017-11-16 11:12:57.000000000 +0100 @@ -3,6 +3,7 @@ namespace Platformsh\Cli\Service; use Platformsh\Cli\Exception\DependencyMissingException; +use Platformsh\Cli\Exception\ProcessFailedException; use Platformsh\Cli\Local\BuildFlavor\Drupal; use Platformsh\Cli\Local\LocalApplication; use Platformsh\Cli\Local\LocalProject; @@ -214,6 +215,8 @@ * @param string $groupName * @param bool $reset * + * @throws \Exception If the "drush sa" command fails. + * * @return array */ public function getAliases($groupName, $reset = false) @@ -224,12 +227,25 @@ // Drush 9 uses 'site:alias', Drush <9 uses 'site-alias'. Fortunately // the alias 'sa' exists in both. - $args = ['@none', 'sa', '--format=json', '@' . $groupName]; - $result = $this->execute($args); + $args = [$this->getDrushExecutable(), '@none', 'sa', '--format=json', '@' . $groupName]; + $aliases = []; - if (is_string($result)) { - $aliases = (array) json_decode($result, true); + + // Run the command with a 5-second timeout. An exception will be thrown + // if it fails. + try { + $result = $this->shellHelper->execute($args, null, true, true, [], 5); + if (is_string($result)) { + $aliases = (array) json_decode($result, true); + } + } catch (ProcessFailedException $e) { + // The command will fail if the alias is not found. Throw an + // exception for any other failures. + if (strpos($e->getProcess()->getErrorOutput(), 'Not found') === false) { + throw $e; + } } + $this->aliases[$groupName] = $aliases; return $aliases; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.22.2/src/Service/Shell.php new/platformsh-cli-3.22.3/src/Service/Shell.php --- old/platformsh-cli-3.22.2/src/Service/Shell.php 2017-11-08 23:50:06.000000000 +0100 +++ new/platformsh-cli-3.22.3/src/Service/Shell.php 2017-11-16 11:12:57.000000000 +0100 @@ -177,15 +177,16 @@ /** * Run a process. * - * @param Process $process - * @param bool $mustRun - * @param bool $quiet + * @param Process $process + * @param bool $mustRun + * @param bool $quiet + * + * @throws \Symfony\Component\Process\Exception\RuntimeException + * If the process fails or times out, and $mustRun is true. * * @return int|string * The exit code of the process if it fails, true if it succeeds with no * output, or a string if it succeeds with output. - * - * @throws \Exception */ protected function runProcess(Process $process, $mustRun = false, $quiet = true) { @@ -198,16 +199,12 @@ if (!$mustRun) { return $process->getExitCode(); } - // The default for ProcessFailedException is to print the entire - // STDOUT and STDERR. But if $quiet is disabled, then the user will - // have already seen the command's output. So we need to re-throw - // the exception with a much shorter message. - $message = "The command failed with the exit code: " . $process->getExitCode(); - $message .= "\n\nFull command: " . $process->getCommandLine(); - if ($quiet) { - $message .= "\n\nError output:\n" . $process->getErrorOutput(); - } - throw new \Exception($message); + // The default for Symfony's ProcessFailedException is to print the + // entire STDOUT and STDERR. But if $quiet is disabled, then the user + // will have already seen the command's output. So we need to + // re-throw the exception with our own ProcessFailedException, which + // will generate a much shorter message. + throw new \Platformsh\Cli\Exception\ProcessFailedException($process, $quiet); } $output = $process->getOutput(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.22.2/src/SiteAlias/DrushAlias.php new/platformsh-cli-3.22.3/src/SiteAlias/DrushAlias.php --- old/platformsh-cli-3.22.2/src/SiteAlias/DrushAlias.php 2017-11-08 23:50:06.000000000 +0100 +++ new/platformsh-cli-3.22.3/src/SiteAlias/DrushAlias.php 2017-11-16 11:12:57.000000000 +0100 @@ -51,9 +51,6 @@ // Merge new aliases with existing ones. $newAliases = $this->mergeExisting($newAliases, $existingAliases); - // Normalize the new aliases. - $newAliases = $this->normalize($newAliases); - // Add any user-defined (pre-existing) aliases. $autoRemoveKey = $this->getAutoRemoveKey(); $userDefinedAliases = []; @@ -64,9 +61,11 @@ } $userDefinedAliases[$name] = $alias; } - $aliases = $userDefinedAliases + $newAliases; + // Normalize the aliases. + $aliases = $this->normalize($aliases); + // Format the aliases as a string. $header = rtrim($this->getHeader($project)) . "\n\n"; $content = $header . $this->formatAliases($aliases); @@ -291,4 +290,26 @@ unlink($filename); } } + + /** + * Swap the key names in an array of aliases. + * + * @param array $aliases + * @param array $map + * + * @return array + */ + protected function swapKeys(array $aliases, array $map) + { + return array_map(function ($alias) use ($map) { + foreach ($map as $from => $to) { + if (isset($alias[$from])) { + $alias[$to] = $alias[$from]; + unset($alias[$from]); + } + } + + return $alias; + }, $aliases); + } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.22.2/src/SiteAlias/DrushPhp.php new/platformsh-cli-3.22.3/src/SiteAlias/DrushPhp.php --- old/platformsh-cli-3.22.2/src/SiteAlias/DrushPhp.php 2017-11-08 23:50:06.000000000 +0100 +++ new/platformsh-cli-3.22.3/src/SiteAlias/DrushPhp.php 2017-11-16 11:12:57.000000000 +0100 @@ -36,15 +36,10 @@ */ protected function normalize(array $aliases) { - foreach ($aliases as &$alias) { - if (!isset($alias['remote-host'], $alias['remote-user']) && isset($alias['host'], $alias['user'])) { - $alias['remote-host'] = $alias['host']; - $alias['remote-user'] = $alias['user']; - } - unset($alias['host'], $alias['user']); - } - - return $aliases; + return $this->swapKeys($aliases, [ + 'host' => 'remote-host', + 'user' => 'remote-user', + ]); } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.22.2/src/SiteAlias/DrushYaml.php new/platformsh-cli-3.22.3/src/SiteAlias/DrushYaml.php --- old/platformsh-cli-3.22.2/src/SiteAlias/DrushYaml.php 2017-11-08 23:50:06.000000000 +0100 +++ new/platformsh-cli-3.22.3/src/SiteAlias/DrushYaml.php 2017-11-16 11:12:57.000000000 +0100 @@ -46,15 +46,10 @@ */ protected function normalize(array $aliases) { - foreach ($aliases as &$alias) { - if (!isset($alias['host'], $alias['user']) && isset($alias['remote-host'], $alias['remote-user'])) { - $alias['host'] = $alias['remote-host']; - $alias['user'] = $alias['remote-user']; - } - unset($alias['remote-host'], $alias['remote-user']); - } - - return $aliases; + return $this->swapKeys($aliases, [ + 'remote-host' => 'host', + 'remote-user' => 'user', + ]); } /** ++++++ platformsh-cli-vendor.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/autoload.php new/vendor/autoload.php --- old/vendor/autoload.php 2017-11-09 00:39:40.820371812 +0100 +++ new/vendor/autoload.php 2017-11-17 03:10:21.750250969 +0100 @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInitfaed85afa934cd13bf628b41c632d0c4::getLoader(); +return ComposerAutoloaderInit9af1103173d4746089e91b605155fbbc::getLoader(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/ClassLoader.php new/vendor/composer/ClassLoader.php --- old/vendor/composer/ClassLoader.php 2017-11-09 00:39:40.820371812 +0100 +++ new/vendor/composer/ClassLoader.php 2017-11-17 03:10:21.750250969 +0100 @@ -374,9 +374,13 @@ $first = $class[0]; if (isset($this->prefixLengthsPsr4[$first])) { - foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { - if (0 === strpos($class, $prefix)) { - foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath.'\\'; + if (isset($this->prefixDirsPsr4[$search])) { + foreach ($this->prefixDirsPsr4[$search] as $dir) { + $length = $this->prefixLengthsPsr4[$first][$search]; if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { return $file; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/LICENSE new/vendor/composer/LICENSE --- old/vendor/composer/LICENSE 2017-11-09 00:39:40.820371812 +0100 +++ new/vendor/composer/LICENSE 2017-11-17 03:10:21.750250969 +0100 @@ -1,5 +1,5 @@ -Copyright (c) 2016 Nils Adermann, Jordi Boggiano +Copyright (c) Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/autoload_real.php new/vendor/composer/autoload_real.php --- old/vendor/composer/autoload_real.php 2017-11-09 00:39:40.820371812 +0100 +++ new/vendor/composer/autoload_real.php 2017-11-17 03:10:21.750250969 +0100 @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInitfaed85afa934cd13bf628b41c632d0c4 +class ComposerAutoloaderInit9af1103173d4746089e91b605155fbbc { private static $loader; @@ -19,15 +19,15 @@ return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInitfaed85afa934cd13bf628b41c632d0c4', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit9af1103173d4746089e91b605155fbbc', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInitfaed85afa934cd13bf628b41c632d0c4', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit9af1103173d4746089e91b605155fbbc', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInitfaed85afa934cd13bf628b41c632d0c4::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit9af1103173d4746089e91b605155fbbc::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitfaed85afa934cd13bf628b41c632d0c4::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit9af1103173d4746089e91b605155fbbc::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequirefaed85afa934cd13bf628b41c632d0c4($fileIdentifier, $file); + composerRequire9af1103173d4746089e91b605155fbbc($fileIdentifier, $file); } return $loader; } } -function composerRequirefaed85afa934cd13bf628b41c632d0c4($fileIdentifier, $file) +function composerRequire9af1103173d4746089e91b605155fbbc($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/composer/autoload_static.php new/vendor/composer/autoload_static.php --- old/vendor/composer/autoload_static.php 2017-11-09 00:39:40.820371812 +0100 +++ new/vendor/composer/autoload_static.php 2017-11-17 03:10:21.750250969 +0100 @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInitfaed85afa934cd13bf628b41c632d0c4 +class ComposerStaticInit9af1103173d4746089e91b605155fbbc { public static $files = array ( '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', @@ -188,9 +188,9 @@ public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitfaed85afa934cd13bf628b41c632d0c4::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitfaed85afa934cd13bf628b41c632d0c4::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInitfaed85afa934cd13bf628b41c632d0c4::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit9af1103173d4746089e91b605155fbbc::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit9af1103173d4746089e91b605155fbbc::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit9af1103173d4746089e91b605155fbbc::$classMap; }, null, ClassLoader::class); }
