Hello community, here is the log from the commit of package platformsh-cli for openSUSE:Factory checked in at 2017-09-12 19:56:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/platformsh-cli (Old) and /work/SRC/openSUSE:Factory/.platformsh-cli.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "platformsh-cli" Tue Sep 12 19:56:16 2017 rev:18 rq:523423 version:3.20.2 Changes: -------- --- /work/SRC/openSUSE:Factory/platformsh-cli/platformsh-cli.changes 2017-08-29 11:48:06.394274119 +0200 +++ /work/SRC/openSUSE:Factory/.platformsh-cli.new/platformsh-cli.changes 2017-09-12 19:56:25.902330246 +0200 @@ -1,0 +2,13 @@ +Mon Sep 11 20:28:28 UTC 2017 - [email protected] + +- Update to version 3.20.2: + * Update self:install command for consistency with installer + * Remove Drush location hack for travis/phpunit + * Find Drush in the CLI root if it is there via require-dev + * Only include shell config if the shell is Bash or ZSH (#622) + * Only include shell config if the shell is Bash or ZSH (#622) + * Installer / self:install consistency + * Check config dir existence in writability check + * Release v3.20.2 + +------------------------------------------------------------------- Old: ---- platformsh-cli-3.20.1.tar.xz New: ---- platformsh-cli-3.20.2.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ platformsh-cli.spec ++++++ --- /var/tmp/diff_new_pack.Bk28c4/_old 2017-09-12 19:56:26.614230147 +0200 +++ /var/tmp/diff_new_pack.Bk28c4/_new 2017-09-12 19:56:26.618229585 +0200 @@ -17,7 +17,7 @@ Name: platformsh-cli -Version: 3.20.1 +Version: 3.20.2 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.Bk28c4/_old 2017-09-12 19:56:26.646225648 +0200 +++ /var/tmp/diff_new_pack.Bk28c4/_new 2017-09-12 19:56:26.650225086 +0200 @@ -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.20.1</param> + <param name="revision">refs/tags/v3.20.2</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.Bk28c4/_old 2017-09-12 19:56:26.670222274 +0200 +++ /var/tmp/diff_new_pack.Bk28c4/_new 2017-09-12 19:56:26.670222274 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/platformsh/platformsh-cli.git</param> - <param name="changesrevision">c113051c280d815807ee8125943571a33ced2158</param> + <param name="changesrevision">a000b8fea3cdcedf54d91af2b14ebe754531a76a</param> </service> </servicedata> ++++++ platformsh-cli-3.20.1.tar.xz -> platformsh-cli-3.20.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.20.1/config.yaml new/platformsh-cli-3.20.2/config.yaml --- old/platformsh-cli-3.20.1/config.yaml 2017-08-23 20:20:41.000000000 +0200 +++ new/platformsh-cli-3.20.2/config.yaml 2017-08-31 16:45:24.000000000 +0200 @@ -1,7 +1,7 @@ # Metadata about the CLI application itself. application: name: 'Platform.sh CLI' - version: '3.20.1' + version: '3.20.2' 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.20.1/dist/installer.php new/platformsh-cli-3.20.2/dist/installer.php --- old/platformsh-cli-3.20.1/dist/installer.php 2017-08-23 20:20:41.000000000 +0200 +++ new/platformsh-cli-3.20.2/dist/installer.php 2017-08-31 16:45:24.000000000 +0200 @@ -144,18 +144,18 @@ ); // The necessary checks have passed. Start downloading the right version. -output(PHP_EOL . "Download", 'heading'); +output(PHP_EOL . 'Download', 'heading'); -output(" Finding the latest version..."); +output(' Finding the latest version...'); $manifest = file_get_contents(CLI_UPDATE_MANIFEST_URL); if ($manifest === false) { - output(" Failed to download manifest file: " . CLI_UPDATE_MANIFEST_URL, 'error'); + output(' Failed to download manifest file: ' . CLI_UPDATE_MANIFEST_URL, 'error'); exit(1); } $manifest = json_decode($manifest); if ($manifest === null) { - output(" Failed to decode manifest file: " . CLI_UPDATE_MANIFEST_URL, 'error'); + output(' Failed to decode manifest file: ' . CLI_UPDATE_MANIFEST_URL, 'error'); exit(1); } @@ -170,33 +170,33 @@ } } if (empty($latest)) { - output(" No download was found.", 'error'); + output(' No download was found.', 'error'); exit(1); } output(" Downloading version {$latest->version}..."); if (!file_put_contents(CLI_PHAR, file_get_contents($latest->url))) { - output(" The download failed.", 'error'); + output(' The download failed.', 'error'); } -output(" Checking file integrity..."); +output(' Checking file integrity...'); if ($latest->sha256 !== hash_file('sha256', CLI_PHAR)) { unlink(CLI_PHAR); - output(" The download was corrupted.", 'error'); + output(' The download was corrupted.', 'error'); exit(1); } -output(" Checking that the file is a valid Phar (PHP Archive)..."); +output(' Checking that the file is a valid Phar (PHP Archive)...'); try { new Phar(CLI_PHAR); } catch (Exception $e) { - output(" The file is not a valid Phar archive.", 'error'); + output(' The file is not a valid Phar archive.', 'error'); throw $e; } -output(" Making the Phar executable..."); +output(' Making the Phar executable...'); chmod(CLI_PHAR, 0755); // Attempt automatic configuration of the shell (including the PATH). @@ -213,74 +213,77 @@ // in the user's shell configuration. N.B. reading from a Phar only works // while it still has the '.phar' extension. output(' Extracting the shell configuration file...'); - $rcDestination = $configDir . '/shell-config.rc'; + $shellConfigDestination = $configDir . '/shell-config.rc'; $rcSource = 'phar://' . CLI_PHAR . '/shell-config.rc'; if (($rcContents = file_get_contents($rcSource)) === false) { output(sprintf(' Failed to read file: %s', $rcSource), 'warning'); } - elseif (file_put_contents($rcDestination, $rcContents) === false) { - output(sprintf(' Failed to write file: %s', $rcDestination), 'warning'); + elseif (file_put_contents($shellConfigDestination, $rcContents) === false) { + output(sprintf(' Failed to write file: %s', $shellConfigDestination), 'warning'); } - output(" Installing the Phar into your home directory..."); + output(' Installing the Phar into your home directory...'); if (rename(CLI_PHAR, $configDir . '/bin/' . CLI_EXECUTABLE)) { $installedInHomeDir = true; output( - " The Phar was saved to: " . $configDir . '/bin/' . CLI_EXECUTABLE + ' The Phar was saved to: ' . $configDir . '/bin/' . CLI_EXECUTABLE ); } else { - output(" Failed to move the Phar.", 'warning'); + output(' Failed to move the Phar.', 'warning'); } + $suggestedShellConfig = 'export PATH=' . escapeshellarg($configDir . '/bin') . ':"$PATH"' . PHP_EOL + . '{[ "$BASH" ] || [ "$ZSH" ]} && . ' . escapeshellarg($shellConfigDestination) . ' 2>/dev/null || true'; + // Configure the user's shell to add to the $PATH and to source the // shell-config.rc file. if ($shellConfigFile = findShellConfigFile($home)) { - output(" Configuring the shell..."); + output(' Configuring the shell...'); $configured = true; $currentShellConfig = file_exists($shellConfigFile) ? file_get_contents($shellConfigFile) : false; - if ($currentShellConfig === false) { - $currentShellConfig = ''; - } + if ($currentShellConfig !== false && strpos($currentShellConfig, $configDir . '/bin') === false) { + $newShellConfig = rtrim($currentShellConfig, PHP_EOL) + . PHP_EOL . PHP_EOL + . '# Automatically added by the ' . CLI_NAME . ' installer' . PHP_EOL + . $suggestedShellConfig . PHP_EOL; - if (strpos($currentShellConfig, $configDir . "/bin") === false) { - $currentShellConfig .= PHP_EOL . PHP_EOL - . "# Automatically added by the " . CLI_NAME . " installer" . PHP_EOL - . "export PATH=\"$configDir/bin:\$PATH\"" . PHP_EOL - . '. ' . escapeshellarg($rcDestination) . " 2>/dev/null || true" . PHP_EOL; - if (!file_put_contents($shellConfigFile, $currentShellConfig)) { + copy($shellConfigFile, $shellConfigFile . '.cli.bak'); + + if (!file_put_contents($shellConfigFile, $newShellConfig)) { $configured = false; - output(" Failed to configure the shell automatically.", 'warning'); + output(' Failed to configure the shell automatically.', 'warning'); } } } } output( - PHP_EOL . "The " . CLI_NAME . " v{$latest->version} was installed successfully!", + PHP_EOL . 'The ' . CLI_NAME . ' v' . $latest->version . ' was installed successfully!', 'success' ); // Tell the user what to do if the automatic installation succeeded. if ($installedInHomeDir) { if ($configured) { - output(PHP_EOL . "To get started, run:", 'info'); + output(PHP_EOL . 'To get started, run:', 'info'); $toSource = getcwd() === $home ? str_replace(getcwd() . '/', '', $shellConfigFile) : $shellConfigFile; - if ($toSource !== '.environment') { - output(' source ' . $toSource); - } + output(' source ' . $toSource); output(' ' . CLI_EXECUTABLE); } else { - output(PHP_EOL . "Add this to your shell configuration file:", 'info'); - output(' export PATH="' . $home . '/' . CLI_CONFIG_DIR . '/bin:$PATH"'); - output(' . ' . escapeshellarg($rcDestination) . ' 2>/dev/null || true'); - output(PHP_EOL . "Start a new shell, and then you can run '" . CLI_EXECUTABLE . "'", 'info'); + $suggestedShellConfig = '# ' . CLI_NAME . ' configuration' + . PHP_EOL + . $suggestedShellConfig; + + output(PHP_EOL . 'Add this to your shell configuration file:', 'info'); + output(PHP_EOL . preg_replace('/^/m', ' ', $suggestedShellConfig)); + output(PHP_EOL . 'Then start a new shell, and you can run: ' . CLI_EXECUTABLE, 'info'); } } else { // Otherwise, the user still has a Phar file. - output(PHP_EOL . "Use it as a local file:", 'info'); + output(PHP_EOL . 'Use it as a local file:', 'info'); output(' php ' . CLI_PHAR); - output(PHP_EOL . "Or install it globally on your system:", 'info'); + output(PHP_EOL . 'Or install it globally on your system:', 'info'); output(' mv ' . CLI_PHAR . ' /usr/local/bin/' . CLI_EXECUTABLE); output(' ' . CLI_EXECUTABLE); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.20.1/src/Command/Self/SelfInstallCommand.php new/platformsh-cli-3.20.2/src/Command/Self/SelfInstallCommand.php --- old/platformsh-cli-3.20.1/src/Command/Self/SelfInstallCommand.php 2017-08-23 20:20:41.000000000 +0200 +++ new/platformsh-cli-3.20.2/src/Command/Self/SelfInstallCommand.php 2017-08-31 16:45:24.000000000 +0200 @@ -49,13 +49,18 @@ $this->stdErr->writeln(sprintf('Reading shell configuration file: %s', $shellConfigFile)); $currentShellConfig = file_get_contents($shellConfigFile); + if ($currentShellConfig === false) { + $this->stdErr->writeln('Failed to read file'); + return 1; + } + if (strpos($currentShellConfig, $configDir . "/bin") !== false) { $this->stdErr->writeln(sprintf('Already configured: <info>%s</info>', $shellConfigFile)); return 0; } - $suggestedShellConfig = "export PATH=\"$configDir/bin:\$PATH\"" . PHP_EOL - . '. ' . escapeshellarg($shellConfigDestination) . " 2>/dev/null || true"; + $suggestedShellConfig = 'export PATH=' . escapeshellarg($configDir . '/bin') . ':"$PATH"' . PHP_EOL + . '{[ "$BASH" ] || [ "$ZSH" ]} && . ' . escapeshellarg($shellConfigDestination) . ' 2>/dev/null || true'; /** @var \Platformsh\Cli\Service\QuestionHelper $questionHelper */ $questionHelper = $this->getService('question_helper'); @@ -76,7 +81,7 @@ $newShellConfig = rtrim($currentShellConfig, PHP_EOL) . PHP_EOL . PHP_EOL . '# Automatically added by the ' . $this->config()->get('application.name') - . PHP_EOL . $suggestedShellConfig; + . PHP_EOL . $suggestedShellConfig . PHP_EOL; copy($shellConfigFile, $shellConfigFile . '.cli.bak'); @@ -109,6 +114,14 @@ */ protected function findShellConfigFile() { + // Special handling for the .environment file on Platform.sh environments. + $envPrefix = $this->config()->get('service.env_prefix'); + if (getenv($envPrefix . 'PROJECT') !== false + && getenv($envPrefix . 'APP_DIR') !== false + && getenv($envPrefix . 'APP_DIR') === Filesystem::getHomeDirectory()) { + return getenv($envPrefix . 'APP_DIR') . '/.environment'; + } + $candidates = [ '.bash_profile', '.bashrc', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.20.1/src/Service/Config.php new/platformsh-cli-3.20.2/src/Service/Config.php --- old/platformsh-cli-3.20.1/src/Service/Config.php 2017-08-23 20:20:41.000000000 +0200 +++ new/platformsh-cli-3.20.2/src/Service/Config.php 2017-08-31 16:45:24.000000000 +0200 @@ -78,7 +78,7 @@ // If the config directory is not writable (e.g. if we are on a // Platform.sh environment), use a temporary directory instead. - if (!is_writable($configDir)) { + if (!$this->canWriteToDir($configDir)) { return sys_get_temp_dir() . '/' . $this->get('application.tmp_sub_dir'); } @@ -86,6 +86,27 @@ } /** + * @param string $dir + * + * @return bool + */ + protected function canWriteToDir($dir) + { + if (is_writable($dir)) { + return true; + } + + $current = $dir; + while (!file_exists($current) && ($parent = dirname($current)) && $parent !== $current) { + if (is_writable($parent)) { + return true; + } + } + + return false; + } + + /** * @param string $filename * * @return array diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.20.1/src/Service/Drush.php new/platformsh-cli-3.20.2/src/Service/Drush.php --- old/platformsh-cli-3.20.1/src/Service/Drush.php 2017-08-23 20:20:41.000000000 +0200 +++ new/platformsh-cli-3.20.2/src/Service/Drush.php 2017-08-31 16:45:24.000000000 +0200 @@ -160,6 +160,12 @@ } } + // Find Drush if it is installed within the CLI. + $drushCli = CLI_ROOT . '/vendor/bin/drush'; + if (is_executable($drushCli)) { + return $drushCli; + } + return $this->shellHelper->resolveCommand('drush'); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/platformsh-cli-3.20.1/tests/bootstrap.php new/platformsh-cli-3.20.2/tests/bootstrap.php --- old/platformsh-cli-3.20.1/tests/bootstrap.php 2017-08-23 20:20:41.000000000 +0200 +++ new/platformsh-cli-3.20.2/tests/bootstrap.php 2017-08-31 16:45:24.000000000 +0200 @@ -5,8 +5,3 @@ */ require __DIR__ . '/../vendor/autoload.php'; - -$env_prefix = (new \Platformsh\Cli\Service\Config())->get('application.env_prefix'); -if (!getenv($env_prefix . 'DRUSH')) { - putenv($env_prefix . 'DRUSH=' . CLI_ROOT . '/vendor/bin/drush'); -} ++++++ 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-08-28 22:20:04.546440044 +0200 +++ new/vendor/autoload.php 2017-09-11 22:28:32.302813855 +0200 @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit43da8b7e837c7fede5b52ed96b8e8c7d::getLoader(); +return ComposerAutoloaderInit5b5733a206603b0560ca753ffa47c644::getLoader(); 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-08-28 22:20:04.546440044 +0200 +++ new/vendor/composer/autoload_real.php 2017-09-11 22:28:32.302813855 +0200 @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit43da8b7e837c7fede5b52ed96b8e8c7d +class ComposerAutoloaderInit5b5733a206603b0560ca753ffa47c644 { private static $loader; @@ -19,15 +19,15 @@ return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit43da8b7e837c7fede5b52ed96b8e8c7d', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit5b5733a206603b0560ca753ffa47c644', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit43da8b7e837c7fede5b52ed96b8e8c7d', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit5b5733a206603b0560ca753ffa47c644', '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\ComposerStaticInit43da8b7e837c7fede5b52ed96b8e8c7d::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit5b5733a206603b0560ca753ffa47c644::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\ComposerStaticInit43da8b7e837c7fede5b52ed96b8e8c7d::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit5b5733a206603b0560ca753ffa47c644::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire43da8b7e837c7fede5b52ed96b8e8c7d($fileIdentifier, $file); + composerRequire5b5733a206603b0560ca753ffa47c644($fileIdentifier, $file); } return $loader; } } -function composerRequire43da8b7e837c7fede5b52ed96b8e8c7d($fileIdentifier, $file) +function composerRequire5b5733a206603b0560ca753ffa47c644($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-08-28 22:20:04.546440044 +0200 +++ new/vendor/composer/autoload_static.php 2017-09-11 22:28:32.302813855 +0200 @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit43da8b7e837c7fede5b52ed96b8e8c7d +class ComposerStaticInit5b5733a206603b0560ca753ffa47c644 { public static $files = array ( '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', @@ -183,9 +183,9 @@ public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit43da8b7e837c7fede5b52ed96b8e8c7d::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit43da8b7e837c7fede5b52ed96b8e8c7d::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit43da8b7e837c7fede5b52ed96b8e8c7d::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit5b5733a206603b0560ca753ffa47c644::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit5b5733a206603b0560ca753ffa47c644::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit5b5733a206603b0560ca753ffa47c644::$classMap; }, null, ClassLoader::class); }
