1
0
Fork 0

Merge branch '2.0'

pull/9803/head
Jordi Boggiano 2021-04-01 10:15:10 +02:00
commit dca8bd7197
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
6 changed files with 62 additions and 16 deletions

View File

@ -1,3 +1,16 @@
### [2.0.12] 2021-04-01
* Fixed support for new GitHub OAuth token format (#9757)
* Fixed support for Vagrant/VirtualBox filesystem slowness by adding short sleeps in some places (#9627)
* Fixed unclear error reporting when a package is in the lock file but not in the remote repositories (#9750)
* Fixed processes silently ignoring the CWD when it does not exist
* Fixed new Windows bin handling to avoid proxying phar files (#9742)
* Fixed issue extracting archives into paths that already exist, fixing problems with some custom installers (composer/installers#479)
* Fixed support for branch names starting with master/trunk/default (#9739)
* Fixed self-update to preserve phar file permissions on Windows (#9733)
* Fixed detection of hg version when localized (#9753)
* Fixed git execution failures to also include the stdout output (#9720)
### [2.0.11] 2021-02-24 ### [2.0.11] 2021-02-24
* Reverted "Fixed runtime autoloader registration (for plugins and script handlers) to prefer the project dependencies over the bundled Composer ones" as it caused more problems than expected * Reverted "Fixed runtime autoloader registration (for plugins and script handlers) to prefer the project dependencies over the bundled Composer ones" as it caused more problems than expected
@ -183,6 +196,11 @@
* Fixed suggest output being very spammy, it now is only one line long and shows more rarely * Fixed suggest output being very spammy, it now is only one line long and shows more rarely
* Fixed conflict rules like e.g. >=5 from matching dev-master, as it is not normalized to 9999999-dev internally anymore * Fixed conflict rules like e.g. >=5 from matching dev-master, as it is not normalized to 9999999-dev internally anymore
### [1.10.21] 2021-04-01
* Fixed support for new GitHub OAuth token format
* Fixed processes silently ignoring the CWD when it does not exist
### [1.10.20] 2021-01-27 ### [1.10.20] 2021-01-27
* Fixed exclude-from-classmap causing regex issues when having too many paths * Fixed exclude-from-classmap causing regex issues when having too many paths
@ -1114,6 +1132,7 @@
* Initial release * Initial release
[2.0.12]: https://github.com/composer/composer/compare/2.0.11...2.0.12
[2.0.11]: https://github.com/composer/composer/compare/2.0.10...2.0.11 [2.0.11]: https://github.com/composer/composer/compare/2.0.10...2.0.11
[2.0.10]: https://github.com/composer/composer/compare/2.0.9...2.0.10 [2.0.10]: https://github.com/composer/composer/compare/2.0.9...2.0.10
[2.0.9]: https://github.com/composer/composer/compare/2.0.8...2.0.9 [2.0.9]: https://github.com/composer/composer/compare/2.0.8...2.0.9
@ -1131,6 +1150,7 @@
[2.0.0-alpha3]: https://github.com/composer/composer/compare/2.0.0-alpha2...2.0.0-alpha3 [2.0.0-alpha3]: https://github.com/composer/composer/compare/2.0.0-alpha2...2.0.0-alpha3
[2.0.0-alpha2]: https://github.com/composer/composer/compare/2.0.0-alpha1...2.0.0-alpha2 [2.0.0-alpha2]: https://github.com/composer/composer/compare/2.0.0-alpha1...2.0.0-alpha2
[2.0.0-alpha1]: https://github.com/composer/composer/compare/1.10.7...2.0.0-alpha1 [2.0.0-alpha1]: https://github.com/composer/composer/compare/1.10.7...2.0.0-alpha1
[1.10.21]: https://github.com/composer/composer/compare/1.10.20...1.10.21
[1.10.20]: https://github.com/composer/composer/compare/1.10.19...1.10.20 [1.10.20]: https://github.com/composer/composer/compare/1.10.19...1.10.20
[1.10.19]: https://github.com/composer/composer/compare/1.10.18...1.10.19 [1.10.19]: https://github.com/composer/composer/compare/1.10.18...1.10.19
[1.10.18]: https://github.com/composer/composer/compare/1.10.17...1.10.18 [1.10.18]: https://github.com/composer/composer/compare/1.10.17...1.10.18

View File

@ -1009,6 +1009,15 @@ cannot be guessed from VCS info and is not present in `composer.json`.
By setting this var you can make Composer install the dependencies into a By setting this var you can make Composer install the dependencies into a
directory other than `vendor`. directory other than `vendor`.
### COMPOSER_RUNTIME_ENV
This lets you hint under which environment Composer is running, which can help Composer
work around some environment specific issues. The only value currently supported is
`virtualbox`, which then enables some short `sleep()` calls to wait for the filesystem
to have written files properly before we attempt reading them. You can set the
environment variable if you use Vagrant or VirtualBox and experience issues with files not
being found during installation even though they should be present.
### http_proxy or HTTP_PROXY ### http_proxy or HTTP_PROXY
If you are using Composer from behind an HTTP proxy, you can use the standard If you are using Composer from behind an HTTP proxy, you can use the standard

View File

@ -343,7 +343,9 @@ EOT
} }
if (null === $stability) { if (null === $stability) {
if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) { if (null === $packageVersion) {
$stability = 'stable';
} elseif (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
$stability = $match[1]; $stability = $match[1];
} else { } else {
$stability = VersionParser::parseStability($packageVersion); $stability = VersionParser::parseStability($packageVersion);

View File

@ -92,7 +92,7 @@ class Hg
{ {
if (false === self::$version) { if (false === self::$version) {
self::$version = null; self::$version = null;
if (0 === $process->execute('hg --version', $output) && preg_match('/version (\d+(?:\.\d+)+)/m', $output, $matches)) { if (0 === $process->execute('hg --version', $output) && preg_match('/^.+? (\d+(?:\.\d+)+)\)?\r?\n/', $output, $matches)) {
self::$version = $matches[1]; self::$version = $matches[1];
} }
} }

View File

@ -20,7 +20,7 @@ namespace Composer\Util;
class Platform class Platform
{ {
/** @var ?bool */ /** @var ?bool */
private static $isVagrantGuest = null; private static $isVirtualBoxGuest = null;
/** /**
* Parses tildes and environment variables in paths. * Parses tildes and environment variables in paths.
@ -123,34 +123,49 @@ class Platform
public static function workaroundFilesystemIssues() public static function workaroundFilesystemIssues()
{ {
if (self::isVagrantGuest()) { if (self::isVirtualBoxGuest()) {
usleep(200000); usleep(200000);
} }
} }
/** /**
* Attempts detection of vagrant guest VMs * Attempts detection of VirtualBox guest VMs
* *
* This works based on the process' user being "vagrant", or the COMPOSER_RUNTIME_ENV env var being set to "vagrant" * This works based on the process' user being "vagrant", the COMPOSER_RUNTIME_ENV env var being set to "virtualbox", or lsmod showing the virtualbox guest additions are loaded
* *
* @return bool * @return bool
*/ */
private static function isVagrantGuest() private static function isVirtualBoxGuest()
{ {
if (null === self::$isVagrantGuest) { if (null === self::$isVirtualBoxGuest) {
self::$isVagrantGuest = false; self::$isVirtualBoxGuest = false;
if (!self::isWindows() && function_exists('posix_getpwuid') && function_exists('posix_geteuid')) { if (self::isWindows()) {
return self::$isVirtualBoxGuest;
}
if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
$processUser = posix_getpwuid(posix_geteuid()); $processUser = posix_getpwuid(posix_geteuid());
if ($processUser && $processUser['name'] === 'vagrant') { if ($processUser && $processUser['name'] === 'vagrant') {
return self::$isVagrantGuest = true; return self::$isVirtualBoxGuest = true;
} }
} }
if (getenv('COMPOSER_RUNTIME_ENV') === 'vagrant') { if (getenv('COMPOSER_RUNTIME_ENV') === 'virtualbox') {
return self::$isVagrantGuest = true; return self::$isVirtualBoxGuest = true;
}
if (defined('PHP_OS_FAMILY') && PHP_OS_FAMILY === 'Linux') {
$process = new ProcessExecutor();
try {
if (0 === $process->execute('lsmod | grep vboxguest', $ignoredOutput)) {
return self::$isVirtualBoxGuest = true;
}
} catch (\Exception $e) {
// noop
}
} }
} }
return self::$isVagrantGuest; return self::$isVirtualBoxGuest;
} }
} }

View File

@ -89,8 +89,8 @@ class ProcessExecutor
{ {
if ($this->io && $this->io->isDebug()) { if ($this->io && $this->io->isDebug()) {
$safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) { $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
// if the username looks like a long (12char+) hex string, or a modern github token (e.g. gp1_xxx) we obfuscate that // if the username looks like a long (12char+) hex string, or a modern github token (e.g. ghp_xxx) we obfuscate that
if (preg_match('{^([a-f0-9]{12,}|g[a-z]\d_[a-zA-Z0-9_]+)$}', $m['user'])) { if (preg_match('{^([a-f0-9]{12,}|gh[a-z]_[a-zA-Z0-9_]+)$}', $m['user'])) {
return '://***:***@'; return '://***:***@';
} }