Merge branch '2.0'
commit
b40b93bc7d
|
@ -26,6 +26,7 @@ use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
|
||||||
use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
|
use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
|
||||||
use Composer\EventDispatcher\EventDispatcher;
|
use Composer\EventDispatcher\EventDispatcher;
|
||||||
use Composer\Util\Loop;
|
use Composer\Util\Loop;
|
||||||
|
use Composer\Util\Platform;
|
||||||
use React\Promise\PromiseInterface;
|
use React\Promise\PromiseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -440,6 +441,8 @@ class InstallationManager
|
||||||
$this->waitOnPromises($promises);
|
$this->waitOnPromises($promises);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Platform::workaroundFilesystemIssues();
|
||||||
|
|
||||||
foreach ($postExecCallbacks as $cb) {
|
foreach ($postExecCallbacks as $cb) {
|
||||||
$cb();
|
$cb();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ use Composer\IO\IOInterface;
|
||||||
use Composer\Repository\InstalledRepositoryInterface;
|
use Composer\Repository\InstalledRepositoryInterface;
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
use Composer\Util\Filesystem;
|
use Composer\Util\Filesystem;
|
||||||
|
use Composer\Util\Platform;
|
||||||
use React\Promise\PromiseInterface;
|
use React\Promise\PromiseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,6 +97,7 @@ class PluginInstaller extends LibraryInstaller
|
||||||
|
|
||||||
return $promise->then(function () use ($self, $pluginManager, $initial, $target, $repo) {
|
return $promise->then(function () use ($self, $pluginManager, $initial, $target, $repo) {
|
||||||
try {
|
try {
|
||||||
|
Platform::workaroundFilesystemIssues();
|
||||||
$pluginManager->deactivatePackage($initial, true);
|
$pluginManager->deactivatePackage($initial, true);
|
||||||
$pluginManager->registerPackage($target, true);
|
$pluginManager->registerPackage($target, true);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
|
@ -19,6 +19,9 @@ namespace Composer\Util;
|
||||||
*/
|
*/
|
||||||
class Platform
|
class Platform
|
||||||
{
|
{
|
||||||
|
/** @var ?bool */
|
||||||
|
private static $isVagrantGuest = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses tildes and environment variables in paths.
|
* Parses tildes and environment variables in paths.
|
||||||
*
|
*
|
||||||
|
@ -117,4 +120,37 @@ class Platform
|
||||||
// Check if formatted mode is S_IFCHR
|
// Check if formatted mode is S_IFCHR
|
||||||
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
|
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function workaroundFilesystemIssues()
|
||||||
|
{
|
||||||
|
if (self::isVagrantGuest()) {
|
||||||
|
usleep(200000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts detection of vagrant guest VMs
|
||||||
|
*
|
||||||
|
* This works based on the process' user being "vagrant", or the COMPOSER_RUNTIME_ENV env var being set to "vagrant"
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private static function isVagrantGuest()
|
||||||
|
{
|
||||||
|
if (null === self::$isVagrantGuest) {
|
||||||
|
self::$isVagrantGuest = false;
|
||||||
|
if (!self::isWindows() && function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
|
||||||
|
$processUser = posix_getpwuid(posix_geteuid());
|
||||||
|
if ($processUser && $processUser['name'] === 'vagrant') {
|
||||||
|
return self::$isVagrantGuest = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getenv('COMPOSER_RUNTIME_ENV') === 'vagrant') {
|
||||||
|
return self::$isVagrantGuest = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$isVagrantGuest;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue