1
0
Fork 0

Merge branch '1.10'

pull/9063/head
Jordi Boggiano 2020-07-17 13:18:02 +02:00
commit c3028c02d9
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
4 changed files with 73 additions and 67 deletions

74
composer.lock generated
View File

@ -160,16 +160,16 @@
},
{
"name": "composer/spdx-licenses",
"version": "1.5.3",
"version": "1.5.4",
"source": {
"type": "git",
"url": "https://github.com/composer/spdx-licenses.git",
"reference": "0c3e51e1880ca149682332770e25977c70cf9dae"
"reference": "6946f785871e2314c60b4524851f3702ea4f2223"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/spdx-licenses/zipball/0c3e51e1880ca149682332770e25977c70cf9dae",
"reference": "0c3e51e1880ca149682332770e25977c70cf9dae",
"url": "https://api.github.com/repos/composer/spdx-licenses/zipball/6946f785871e2314c60b4524851f3702ea4f2223",
"reference": "6946f785871e2314c60b4524851f3702ea4f2223",
"shasum": ""
},
"require": {
@ -219,9 +219,23 @@
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/spdx-licenses/issues",
"source": "https://github.com/composer/spdx-licenses/tree/1.5.3"
"source": "https://github.com/composer/spdx-licenses/tree/1.5.4"
},
"time": "2020-02-14T07:44:31+00:00"
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2020-07-15T15:35:07+00:00"
},
{
"name": "composer/xdebug-handler",
@ -519,16 +533,16 @@
},
{
"name": "seld/phar-utils",
"version": "1.1.0",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/phar-utils.git",
"reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0"
"reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8800503d56b9867d43d9c303b9cbcc26016e82f0",
"reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0",
"url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8674b1d84ffb47cc59a101f5d5a3b61e87d23796",
"reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796",
"shasum": ""
},
"require": {
@ -561,9 +575,9 @@
],
"support": {
"issues": "https://github.com/Seldaek/phar-utils/issues",
"source": "https://github.com/Seldaek/phar-utils/tree/1.1.0"
"source": "https://github.com/Seldaek/phar-utils/tree/master"
},
"time": "2020-02-14T15:25:33+00:00"
"time": "2020-07-07T18:42:57+00:00"
},
{
"name": "symfony/console",
@ -796,16 +810,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.17.0",
"version": "v1.18.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9"
"reference": "1c302646f6efc070cd46856e600e5e0684d6b454"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
"reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454",
"reference": "1c302646f6efc070cd46856e600e5e0684d6b454",
"shasum": ""
},
"require": {
@ -817,7 +831,11 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.17-dev"
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
@ -851,7 +869,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.17.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.18.0"
},
"funding": [
{
@ -867,20 +885,20 @@
"type": "tidelift"
}
],
"time": "2020-05-12T16:14:59+00:00"
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.17.0",
"version": "v1.18.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "fa79b11539418b02fc5e1897267673ba2c19419c"
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c",
"reference": "fa79b11539418b02fc5e1897267673ba2c19419c",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a",
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a",
"shasum": ""
},
"require": {
@ -892,7 +910,11 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.17-dev"
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
@ -927,7 +949,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.17.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/master"
},
"funding": [
{
@ -943,7 +965,7 @@
"type": "tidelift"
}
],
"time": "2020-05-12T16:47:27+00:00"
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/process",

View File

@ -41,6 +41,7 @@ use Composer\Util\Filesystem;
use Composer\Util\ProcessExecutor;
use Composer\Util\Loop;
use Composer\Package\Version\VersionParser;
use Composer\EventDispatcher\EventDispatcher;
/**
* Install a package as new project into new directory.
@ -351,9 +352,13 @@ EOT
throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
}
$composer = Factory::create($io, $config->all(), $disablePlugins);
$config = $composer->getConfig();
$rm = $composer->getRepositoryManager();
$repositorySet = new RepositorySet($stability);
if (null === $repositories) {
$repositorySet->addRepository(new CompositeRepository(RepositoryFactory::defaultRepos($io, $config)));
$repositorySet->addRepository(new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm)));
} else {
foreach ($repositories as $repo) {
$repoConfig = RepositoryFactory::configFromString($io, $config, $repo, true);
@ -363,7 +368,7 @@ EOT
) {
continue;
}
$repositorySet->addRepository(RepositoryFactory::createRepo($io, $config, $repoConfig));
$repositorySet->addRepository(RepositoryFactory::createRepo($io, $config, $repoConfig, $rm));
}
}
@ -422,15 +427,12 @@ EOT
$package = $package->getAliasOf();
}
$factory = new Factory();
$httpDownloader = $factory->createHttpDownloader($io, $config);
$dm = $factory->createDownloadManager($io, $config, $httpDownloader, $process);
$dm = $composer->getDownloadManager();
$dm->setPreferSource($preferSource)
->setPreferDist($preferDist);
$projectInstaller = new ProjectInstaller($directory, $dm, $fs);
$im = $factory->createInstallationManager(new Loop($httpDownloader, $process), $io);
$im = $composer->getInstallationManager();
$im->setOutputProgress(!$noProgress);
$im->addInstaller($projectInstaller);
$im->execute(new InstalledFilesystemRepository(new JsonFile('php://memory')), array(new InstallOperation($package)));

View File

@ -380,8 +380,8 @@ TAGSPUBKEY
// see if we can run this operation as an Admin on Windows
if (!is_writable(dirname($localFilename))
&& $io->isInteractive()
&& $this->isWindowsNonAdminUser($isCygwin)) {
return $this->tryAsWindowsAdmin($localFilename, $newFilename, $isCygwin);
&& $this->isWindowsNonAdminUser()) {
return $this->tryAsWindowsAdmin($localFilename, $newFilename);
}
$action = 'Composer '.($backupTarget ? 'update' : 'rollback');
@ -467,20 +467,16 @@ TAGSPUBKEY
/**
* Returns true if this is a non-admin Windows user account
*
* @param null|bool $isCygwin Set by method
* @return bool
*/
protected function isWindowsNonAdminUser(&$isCygwin)
protected function isWindowsNonAdminUser()
{
$isCygwin = preg_match('/cygwin/i', php_uname());
if (!$isCygwin && !Platform::isWindows()) {
if (!Platform::isWindows()) {
return false;
}
// fltmc.exe manages filter drivers and errors without admin privileges
$command = sprintf('%sfltmc.exe filters', $isCygwin ? 'cmd.exe /c ' : '');
exec($command, $output, $exitCode);
exec('fltmc.exe filters', $output, $exitCode);
return $exitCode !== 0;
}
@ -492,10 +488,9 @@ TAGSPUBKEY
*
* @param string $localFilename The composer.phar location
* @param string $newFilename The downloaded or backup phar
* @param bool $isCygwin Whether we are running on Cygwin
* @return bool Whether composer.phar has been updated
*/
protected function tryAsWindowsAdmin($localFilename, $newFilename, $isCygwin)
protected function tryAsWindowsAdmin($localFilename, $newFilename)
{
$io = $this->getIO();
@ -515,15 +510,9 @@ TAGSPUBKEY
$checksum = hash_file('sha256', $newFilename);
// format the file names for cmd.exe
if ($isCygwin) {
$source = exec(sprintf("cygpath -w '%s'", $newFilename));
$destination = exec(sprintf("cygpath -w '%s'", $localFilename));
} else {
// cmd's internal move is fussy about backslashes
$source = str_replace('/', '\\', $newFilename);
$destination = str_replace('/', '\\', $localFilename);
}
$vbs = <<<EOT
Set UAC = CreateObject("Shell.Application")
@ -532,16 +521,7 @@ Wscript.Sleep(300)
EOT;
file_put_contents($script, $vbs);
if ($isCygwin) {
chmod($script, 0755);
$cygscript = sprintf('"%s"', exec(sprintf("cygpath -w '%s'", $script)));
$command = sprintf("cmd.exe /c '%s'", $cygscript);
} else {
$command = sprintf('"%s"', $script);
}
exec($command);
exec('"'.$script.'"');
@unlink($script);
// see if the file was moved

View File

@ -63,11 +63,11 @@ class RepositoryFactory
* @param bool $allowFilesystem
* @return RepositoryInterface
*/
public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false, RepositoryManager $rm = null)
{
$repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
return static::createRepo($io, $config, $repoConfig);
return static::createRepo($io, $config, $repoConfig, $rm);
}
/**
@ -76,9 +76,11 @@ class RepositoryFactory
* @param array $repoConfig
* @return RepositoryInterface
*/
public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
public static function createRepo(IOInterface $io, Config $config, array $repoConfig, RepositoryManager $rm = null)
{
if (!$rm) {
$rm = static::manager($io, $config, Factory::createHttpDownloader($io, $config));
}
$repos = static::createRepos($rm, array($repoConfig));
return reset($repos);